[FFmpeg-user] Apple live HTTP streaming: video slows down if processed with ffmpeg

i-love-spam i-love-spam at yandex.ru
Fri Apr 22 04:12:42 CEST 2011


I'm trying to make live http streaming working with and iPhone 4. For live http streaming I have to use mpegts segments that contain h264 and mp3/aac for audio. I use 10 sec segments and I use opensource segmenter.c that uses libavformat/avcodec to segment videos into mpegts chunks.

What I noticed, is that many of my segmented videos didn't play properly: after playing for 30 seconds or so video starts to play twice slower while sound plays at normal speed. So I tried to investigate what's wrong and I came to conclusion that chunks generated from flv/mp4 etc always have this problem and segments generated from other ts files do not have the problem.
I tried to different tests, and it looks that ffmpeg somehow modifies bitstream so that live http streaming does not work on iPhone.

I have an original family guy mpegts video clip. If I use this clip for segmenting then live http streaming works perfectly. If I convert this file with
ffmpeg -i famili_guy.ts -acodec copy -vcodec copy family_guy.flv (or mp4) then if I try to segment that resulting file then iPhone will have video slowdown problem (at the beginning it plays it normally, but after 30 seconds or so video starts to play approx twice slower).
What I also observed, is that if I take that family_guy.flv or mp4 and convert it back to family_guy2.ts then this new famili_guy2.ts will also have the same problem as mp4 or flv file. I used binary compare tool to check and it looks like after mpegts -> mp4 -> mpegts h264 bitstream becomes somewhat different and doesn't play normally on iPhone 4.

Did anybody had the same problem, any idea what I could do to "fix" some of these video to make them segmentable with ffmpeg and segmenter?


thank you.


PS. just to clarify, I do use -vbsf h264_mp4toannexb to convert from mp4 back to ts file, I think the problem is somehow related to that bitstream re-format.


More information about the ffmpeg-user mailing list