0

I've used iOS (and AVFoundation) to encode an mp4 video (h264).

While the video plays fine on my iphone, I have random lags on VLC or on the Facebook player. I've tested on several platforms (Mac, Windows, etc) and I always have random lags, but more or less depending on the player.

I guess it could be a problem of settings in the video ? Where should I look at to identify the problem ? Do you know anything that could help me ? Thanks a lot in advance, any help would be appreciated.

Format                                   : MPEG-4
Format profile                           : Base Media / Version 2
Codec ID                                 : mp42 (mp41/mp42/isom)
File size                                : 15.5 MiB
Duration                                 : 40 s 0 ms
Overall bit rate                         : 3 247 kb/s

Here's the full log about my video (obtained with MediaInfo) :

https://pastebin.com/57q9mrGg

And here's a dropbox link to my video :

https://www.dropbox.com/s/e1sl0qqwvnb2nqu/Video%2002-11-17%2014%2052%2045.mp4?dl=0

Xys
  • 8,486
  • 2
  • 38
  • 56

1 Answers1

0

You don't mention if you are playing ti locally or streaming, but assuming you are streaming to the various devices then streaming videos over IP networks usually uses techniques like ABR to avoid buffering delays.

ABR, Adaptive Bit Rate Streaming, essentially allows the client device or player download the video in chunks, e.g 10 second chunks, and select the next chunk from the bit rate most appropriate to the current network conditions.

See this answer for a little more info and to see how you can see this on YouTube for example: https://stackoverflow.com/a/42365034/334402

Without a technique like this it will be very hard to guarantee that you avoid some buffering delays, unless you are prepared to really compromise on video quality and only encode to a low bit rate.

It is quite a specialised area which is why many will use third party services to host their videos - there are also open source video streaming servers available such as:

These have plugins that support ABR etc - if you search for 'GStreamer streaming server ABR' you will find some good blogs about setting this up.

Mick
  • 24,231
  • 1
  • 54
  • 120
  • Thanks for your answer, but I'm playing the video locally on VLC. For the facebook player, I guess it's streaming though ? – Xys Nov 03 '17 at 16:41
  • It depends how you are using it and how it works - if you are using a browser on your local machine and giving it a local file URL then it will be a local file rather than streamed from the internet. – Mick Nov 03 '17 at 17:40
  • If you play it from the dropbox link without downloading it, you are also streaming it, btw. It plays without any stutters on a MacBook I tested it on here when I download it and then play it back. Playing from the dropbox link had the occasional small stutter. – Mick Nov 03 '17 at 17:44
  • You are totally right. I was not playing it using the dropbox player, but locally with VLC :) . Were you playing it with QuickTime or VLC ? Because on QuickTime the lag is not very visible. – Xys Nov 03 '17 at 17:53
  • I was using Quicktime, so I tried again with a number of players and VLC does seem to stutter slightly. I think it was improved by playing around with the caching in the preferences but I couldn't really determine if the results were repeatable - this may be worth you looking at also. – Mick Nov 03 '17 at 18:54
  • I increased VLC's cache but it did nothing. My other videos are not lagging, neither on Facebook. I don't know what's wrong with this video... – Xys Nov 06 '17 at 13:18