Qasim Zafar


Cricingif investment and getting content licenses

It’s been a tough four months, with the uncertainty of the future bearing down upon us. Every day a stifling dread filled our workspace. We have been freelancing to pay the bills under the name of Lemotech Studios. For Cricingif investment could not have come at a more critical time. If it were a month delayed, we would have shut down the company altogether.

For the first three months it looked like all was lost. I had used up all of my contacts from my Savaree days and while people would hear us out, nobody in the tech industry has had exposure to the media and content industry. The biggest challenge is content licensing and acquisition, and potential investors are skeptical about our ability to solve that.

However, we read a press release by the ICC indicating that a certain Khaleef Technologies had acquired exclusive Digital Clip Rights licenses for Pakistan for the next 3 years. We reached out to the CEO, and initially he did not respond. However, as it turns out, he has had limited success building his own cricket coverage platform to leverage the rights he has already acquired.

Therefore, it was a natural synergy between Cricingif’s proven track record and Khaleef Technologies’ content rights. In addition, Khaleef has committed to investing a few million dollars in Cricingif – including developing the product and marketing it. The investment will also cater to acquiring future copyrights and licensing.

Product revamp and strategy shift

One of the challenges that I’ve realized will always remain is licensing. You can do everything right, but if you are out-bid in the auction you can’t broadcast that series. Also, you are paying to put content on your platform. We will in the coming weeks finalize a strategy to create original quality content so that we can wean ourselves off of this dependency on copyrighted content.

This pushes our current valuation to $4 million, but I’m confident we will compound this massively within a year. We’re moving into a new office at the start of next week, as our current one is too small for us to grow.

The immediate next steps are to revamp the platform and do a public launch before the end of this year. The newly-minted Pakistan Super League is coming up, and should be a huge boost to our user acquisition.

For now, it’s back to the drawing board.

For more on what I’ve done, do check out my resume
Get in touch with me at: qasimzafar AT outlook DOT com

Offline Until Further Notice

We have received a DMCA takedown notice on behalf of the International Cricket Council. Our Facebook and Twitter accounts are now suspended, and our website is offline. The reason must have been the Cricingif Twitter integration, our video clips of the ICC Twenty20 World Cup were going viral on Twitter and elsewhere and must have caught the attention of the Council.

Our proof-of-concept has convinced us that the idea holds weight. However, until we can sort out our copyrights issues we will not be able to move forward. Pirating content is a no-go for us, so all focus is now shifted to figuring out how to get some video clip licenses. It seems like an obscure world, but we will need to make sense of it. There is no other way.

Fast Video Compression With FFmpeg

As I mentioned previously, at Cricingif we are focusing on building a fast, efficient play by play highlights platform. One of the bottlenecks we have been facing is video compression – some of the programs we have been using for video and audio capture are very clunky, slow and CPU-intensive. After burning through a couple of laptop motherboards, I’ve decided to give FFmpeg a go.

Here are the results of my experiment with video compression using FFmpeg. For the purpose of this experiment, I used a pre-recorded video clip, but in our production environment at Cricingif we record video and audio capture through live streams. Nevertheless, the results are equally valid in that scenario as well.

I’ve taken an input video with the following specs:

1920×1080 16394 52,199,424b25.51s

For the record, the test machine is a Microsoft Surface Pro 4 with 8 gigabytes of RAM, 256gb of hard drive space and powered by the i7-6650u processor. Granted this isn’t the best machine for video encoding, but it’s my work machine and it’s what I’m experimenting on. I have run the tests on our production setups but these results are illustrative of what I achieved there.

The first step is to do a simple mp4 video encoding using the h.264 codec:

ffmpeg.exe -i "Take 4.MTS" -vcodec libx264 -acodec aac test1.mp4

Thirty-two seconds to encode a 25-second video at run-time is too much, we cannot afford to have an encoding time longer than the video itself in our real-time application. However, for now we will be streaming 640×480 video to our users due to the limited capability of Pakistan’s network and device landscape. Let’s try that:

ffmpeg.exe -i "Take 4.MTS" -vcodec libx264 -filter:v scale=640:-1 -acodec aac -pix_fmt yuv420p test3.mp4

Using this, the file size is now down to 3,504,438 bytes at 640×480. The encoding time is also now just 7.2 seconds. This works, but at 134 kbps this is more than most Wi-Fi can handle. Time to improve further.

Playing around with the constant rate factor (default: 23) allows for lossy compression of the input stream while negligibly affecting the output. In addition, since Cricingif videos are mainly consumed on mobile, the minor loss of quality is acceptable.

Also realized that the x.264 codec does not allow for odd values, so in case the input video dimensions are slightly off, it will throw a “width or height not divisible by 2” error. A very nice explanation is here. So I’ve updated the command:
ffmpeg.exe -i "Take 4.MTS" -vcodec libx264 -crf 29 -filter:v scale="640:trunc(ow/a/2)*2" -acodec aac -pix_fmt yuv420p test3.mp4
Size (bytes)

A 7 second encoding time is a decent trade-off. Using different options such as the superfast preset or defining fixed rates does bring down the compression time to 5 seconds or thereabouts, but the trade-off is in the increased file size. In the current state, the data transmission is about 63kbps, something reasonably achievable with only about 220MB of data consumed per hour of streaming.

One further test involved testing out at 360p resolution, which is a standard YouTube playback format. With this, a file size of just 1,222,874 bytes is achieved with an encoding time of only 6.2 seconds. At 46kbps, only 160MB of data per hour is consumed. Good enough for now.

A detailed table of results for all experiments:

Size (b)
Encoding Time (s)
Input File1920×1080163942552,199,424
Test 11920×1080102202533,236,06232.01
Test 21920×1080102202533,236,06229.80
Test 3640×4801071253,504,4387.17
Test 4640×360202332565,774,1068.31
Test 5640×36032832510,690,9167.68
Test 6640×360507251,671,1977.07
Test 7640×3601381254,504,8015.91
Test 8640×3601490254,865,8146.06
Test 9480×270369251,222,8746.24

For more on what I’ve done, do check out my resume
Get in touch with me at: qasimzafar AT outlook DOT com

Cricingif, The World’s Fastest Live Cricket Scores

An quick update from last time when we were just setting up Cricingif. We seem to have underestimated our premise that there would be a market for on-demand cricket coverage. Our platform’s users are growing extremely rapidly, in a month we’ve already hit 100,000 users. And keeping pace with that sort of demand is proving to be a challenge.

We’ve developed a clipping system that automatically extracts a video clip for each ball and then waits for an operator to enter the score on that ball. Effectively, we provide live cricket scores alongside play by play highlights. We can add some computer vision-fu to automate this scoring but considering how many scores are reversed in cricket, it’s more complexity than currently worth.

We’re starting off in Pakistan, and the infrastructure and state of handheld devices prohibits HD streaming. So our focus on the Cricingif app is to build a light web/mobile client and minimize data consumption. I’ve been working with the FFmpeg library to minimize our file sizes, which are down to about 1.5-2MB per clip.

A side effect of our focus on building a light client is that we now provide the fastest live cricket scores online. I don’t know how, but we are on average 10 seconds faster than ESPNCricinfo and around 5 seconds faster than Cricbuzz. Both of these are giants in the field, billion-dollar companies. It is surprising that their scoring is so delayed as we are using laggy online streams for scoring.

My cofounder hacked together an automated Twitter uploading service that has gone viral. Journalists, commentators and other influencers from the world of cricket now regularly use our tweets. The philosophy of providing bite-sized, replay-able match coverage in real time seems to be working out.

I’ll keep updating on what’s new at Cricingif. In the meanwhile, follow us on Twitter!

For more on what I’ve done, do check out my resume
Get in touch with me at: qasimzafar AT outlook DOT com

Cricingif, A New Kind of Play by Play Cricket Highlights

As you might know, I recently left my first company, Savaree. I’ve been working as an associate product manager at, Pakistan’s largest used car classifieds. It’s only been a couple of months but I’ve switched yet again (bad move?) to Cricingif; the opportunity is too exciting to pass up. Here’s why:

Based on my post on leaving on leaving Savaree, my co-founder reached out to me with an idea that will revolutionize the world of cricket highlights. Consider the following example: You’re following a cricket match, which will be at least 4 hours long and up to 5 days long. Things are going along at a slow pace with dot ball after dot ball.

You get up to go to the kitchen to grab a drink, and by the time you come back Shahid Afridi has struck three sixes in a row and the game has turned on its head. With every mention by the commentators of how the maximums have already gone down in history, you rue your misfortune.

Now, you are at the mercy of the TV programmer’s whims on when they show the replay, if at all. Or, you can wait for a couple of days for a pirated copy of the match highlights to show up on YouTube. That too something you would have to seek through to find the exact moment you were searching for.

What if there were a platform that allowed you to find and watch those moments of a cricket match that matter to you the most? Enter Cricingif, something we’ve hacked together to bring to you a clip for every ball of a cricket match. What’s more, we upload these clips in real-time. We like to call this live highlights.

Cricingif provides a live feed of play by play cricket highlights as they happen.
Cricingif provides a live feed of play by play cricket highlights as they happen.

We’ve added some filters so that you can select what you want to watch e.g. highlights, boundaries only, all balls bowled by Mohammad Amir, or all balls played by Virat Kohli, etc. In effect, you get a live feed of the most important moments of a match. In our experience, on average, an entire T20 match can be condensed into 40 minutes.

An entire T20 match can be condensed into 40 minutes.

Cut out all the standing around and that’s what a cricket match is. If you prefer watching only deliveries that have an impact on the game, all scoring balls can be condensed down to about 15 minutes.

And that’s where the real value is. Our next step is to see if we can make the user experience more seamless, along with a couple of creative growth hacks we have planned.

Download the Cricingif app here
Or visit our website

For more on what I’ve done, do check out my resume
Get in touch with me at: qasimzafar AT outlook DOT com

Personal Growth When You’re Unemployed

Beyond the low is a sweet, mellow high.

Just left your previous job? Just graduated and nobody’s hiring? Or perhaps you decided to part with your previous business. There comes a time in everybody’s life when they are, for lack of a better word, unemployed. Maybe your boss gave you the boot, or it could have been the professor’s fault. Or your last business tanked.

In any case, the onset of unemployment is often a bummer. You have vast swathes of free time before you, with seemingly nothing to fill the gaping emptiness work left in its wake except for brooding over the turn of events that led you to this junction of life — a series of regrets on doing things differently, and “if only”s usually follow. Where there was once routine, order and a plan, there is now chaos and uncertainty. The damage to morale is tremendous, however long it lasts.

What people often fail to see is the brighter side of this circumstance — you now have time, the most precious commodity of all. You no longer have to work late answering calls or balancing the ledgers or prepping to meet the boss in the morning. You should put your time to good use and focus on your personal growth. Set some positive goals that will make you feel good when you get there, and follow them through. Here’s how:

1. Catch up with good people.

Who do you feel good being around, but haven’t really had a chance to meet recently? What about that friend from college you used to spend nights sitting on the library steps with, but who moved away and you haven’t heard from since? Or even better, how about the friend that lives two blocks down? Never underestimate the power of sitting down with someone from long ago to have a friendly chat and catch up. It gives much needed perspective and often opens up opportunities you never knew you had.

Remember, this could be your parents, wife and kids too — they have a habit of disappearing behind routine and proximity. When was the last time you actually spent time with them, in a proper, stimulating conversation? How much do you know of what’s really going on in each other’s lives and minds?

2. Acquire a Fun Skill

If you’re not doing anything you can tell your next interviewer about, then in career terms you’re wasting time. Potential employers will see your time spent doing nothing in a negative light — or  maybe you have been interviewing but nobody else wanted to hire you  — which is a big red flag.

Instead, acquire a new skill that you’re interested in and that makes you more employable. If you’re curious about how people figure out things like there are only seven types of women on OkCupid, then try looking at something like Coursera’s Data Science Specialization (disclaimer: yes, I’m interested in things like that and am almost done with the specialization).

Learning activates parts of your brain that you potentially haven’t used in a long time, not to mention that data science is one of the hottest fields around right now, so that’s a badge that will look good on any resume, anywhere.

3. Do What You’ve Been Meaning To Do

While you’re at it, make sure that you do take some time out to catch up on your backlog of life. The trip you’ve really wanted to make but have been putting off? Nike was right, now’s the time to pick yourself up and just do it. Personal growth is not just about learning new skills, but also about gratitude, contentment and doing what you want to do in life.

Doing something that’s been on your wish list for a long time will help you unwind after the previous session of workaholicism, and get you to look forward to the next one, while keeping you positively occupied.

4. Set Some Goals

Setting realistic goals and accomplishing them is one of the most important motivational factors in life. Dedicate some time to setting goals, short-, medium- and long-term. This helps you evaluate whether your life is going where you want it to, and take measures accordingly. Not to mention that making a list of things to do vastly reduces mental clutter and gives you a renewed sense of purpose.

When goal-setting, try to make them specific and measurable, realistic yet challenging, and meaningful. This will vastly reduce your procrastination levels and boost your productivity by orders of magnitude. Alex Vermeer does a much better job of explaining how to reduce procrastination than I possibly could here.

Which is But to Say,

If you don’t have a job it’s not the end of the world. Take it as a new beginning. It’s easy to do things you enjoy while you wait for the right employment offer to come along, all the while increasing your chances of getting that perfect job. Trust me, I’ve been there.

For more on what I’ve done, do check out my resume
Get in touch with me at: qasimzafar AT outlook DOT com

Leaving Savaree – Lessons From a Technology Startup

IN February of 2014, I walked into the Lahore Civic Hackathon organized by Code for Pakistan as a final-semester college student with no inkling of what was to come. Following the usual pitching round, I was confused as to whether I should join up with a team of senior developers working on a community-backed blood bank registry or two other newbies who wanted to bring ridesharing to Pakistan through technology.

Ridesharing in Pakistan? Who in their right mind would ever do such a thing, I wondered. Especially given the security situation in the country. But I realized that I had shared rides to and from college for four years now. Still a difficult idea. Nevertheless, I decided that I was game and the challenge doing such a thing would entail was appealing. I would go against the flow, I proudly told myself. There is a strange charm in feeling that you are different, that there is something in you that is not in others.

Ridesharing in Pakistan? Who in their right mind would ever do such a thing?

Over the next 48 hours, notwithstanding my Ubuntu installation failing, we hacked together a prototype for what I suggested should be called ‘Savaree’, a name I’m still proud of. We ended up winning the hackathon, and several industry bigwigs encouraged us to pursue Savaree full-time. And so it began.

Fast forward 2 years, and a pivot and technology partnership and some growth later, I am leaving the company. I have learned a lot, grown a lot, and had the opportunity to meet some truly inspiring people, but now I feel it is time to move on. There are several factors that have contributed to this decision, but I would like to highlight some of the critical aspects that I feel we should have focused more on. I have learned tremendously from these and will try my best to do more at the next thing I decide to put myself to.

1. Bookkeeping, Metrics and Analytics

You’ve probably heard more than enough of this, but it really is true that if you can’t measure something, you can’t improve it. You don’t have to track everything, because while more metrics help, that will only confuse beginners. Just focus on a couple of key metrics and work on improving those. With time the metrics and the analytics will automatically become more sophisticated. But if you don’t know where your clientele comes from, you won’t know to increase operations in that part of the city. Oh, and don’t forget to create official invoices and other documents and store each and every transaction.

2. Realistic Technology Deadlines and Expectations

This is extremely important: Every team member must know what their milestones are and how well they are progressing to meet them. If someone is having difficulty meeting their goals, then have a talk with them timely so that the issue can be fixed. Another, equally important thing is to give tasks to those that can complete them: if the person in charge of technology development is having a hard time deploying on schedule, maybe the expectations are unrealistic. Or maybe that person is better at something else and some role reshuffling is required. Either way, dealing with this is important.

3. Take What is Rightfully Yours

You are running a business, and you need to make sure that you charge appropriately. This is doubly important in the beginning, when revenue is small: you cannot, in any case, let any of your revenue slip. Don’t sink the boat before it has even sailed. It is tempting in the beginning, especially for technology service-based startups, to forgo some revenue because the margin is so small that you feel demanding your two cents is pointless. It isn’t.

4. Shared Vision and Exit Strategy

This is THE most important thing in a startup. All founders must be on the same page with regards to business strategy and vision. If half are working towards an early acquisition while the other half would like to be with the company for life, then things will at some point cease working out. This is also true if half are willing to pivot to a more lucrative segment while the other half are determined to stick to the original plan through to the end. It is important that you decide and decide early what the strategy will be. After that, make sure that it is clear who is in charge in case a deviation from the original plan is necessary.

These are some of the most important takeaways for me from Savaree going forward. I hope to try my best to make sure that I give these things the importance they require at what I do next. There are several exciting opportunities before me, and I would like to take a two to three weeks to thoroughly explore each of them before deciding what my move will be. It is an exciting time to be, and I am determined to make the most of it.

For more on what I’ve done, do check out my resume
Get in touch with me at: qasimzafar AT outlook DOT com

Building Trust – A Savaree Carpool Perspective

When I first pitched the ride sharing idea that is now Savaree at the Lahore Civic Hackathon, I was emphatically encouraged by tech industry bigwigs to pursue it as a serious carpool venture. I was in my final year of college with a knack for tinkering and hacks, numerous examples of people my age ‘making it big’ across the world in front of me, and little experience of the world beyond the classroom. With so much media coverage and so many rooting for me, what could go wrong?

My rosy landscape of the future got its first reality check when, a couple of months in, we finally launched Savaree as a beta service and began trying to sign people up. We pitched Savaree to our friends, students in universities and employees at offices, pointing out how such a service could help them drastically cut commuting costs while at the same time be a significant upgrade over rickety old public transport. We’d help them get in touch with fun, energetic people going the same way and voila, you’d have a carpool!

Continue reading “Building Trust – A Savaree Carpool Perspective”

Augmented Reality Eyewear

A couple of weeks ago, I had my first virtual reality experience with a dev kit of Oculus’ Rift. I can say with certainty that augmented reality is going to be a large part of our future. I’m very intrigued by the idea of augmented reality for shoppers wishing to try out apparel or accessories, the only goods that customers like to try on physically before they buy.

I have fleshed out a working proof-of-concept that is very light and efficient, so that even low-powered devices such as smartphones and smart displays can successfully present a proper AR virtual dressing room experience.

The idea is to be able to affix articles of clothing and accessories onto the user’s body in a video feed from a camera. It needs to be good enough to make the experience believable without stretching the user’s imagination. Real-time articulated full-body pose detection algorithms are a work in progress and would have to be coupled to a face tracker to get a proper usable detection, so for the sake of simplicity I have focused my efforts on the head only. I decided to choose glasses as a proof-of-concept accessory.

The project involved four stages: Tracking the face of the subject, recovering the 3D pose of the face from a 2D image, aligning a 3D model of the eyewear to ‘fit’ the head, and then projecting the 3D eyewear back onto the 2D face.

AR Face Tracker Glasses Fitting

Continue reading “Augmented Reality Eyewear”

A Route Matching Algorithm for Ride Sharing

Our backend lead has left for a lucrative job in Dubai, but we are moving onward. I don’t have much software engineering experience so I’m building our tech with Parse as a backend-as-a-service in JavaScript together with a client android app for beta testing. We’ve brought two additional developers into the Savaree team to help refine and polish the android app as well as create a complete web front-end for Pakistan’s first ride sharing app.

I began focusing on business development around June this year, but have retained responsibility for the backend and associated APIs. The most interesting part of this was the search algorithm that returned the set of feasible routes for any carpooler needing a ride.

The spatial search of two overlapping or closely lying paths is complex enough in itself, and the added constraints of reasonable accommodation by the driver and the passenger as well as human behavior (I’m less likely to drop you off two blocks down if I’m going cross-country than if I’m going three blocks down) make the question even more challenging.

Continue reading “A Route Matching Algorithm for Ride Sharing”