[FFmpeg-user] Transcoding MP4s so that the video starts with Keyframe

Tarun singhal tsinghal18 at gmail.com
Mon Jun 3 08:36:46 CEST 2013

>  > How can I transcode MP4 so that it starts with keyframe
> I don't think it is possible to encode to mp4 with
> ffmpeg without starting with a keyframe.
> Please add your failing command line together with
> the complete, uncut console output.
> Carl Eugen
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
My objective is to create DASH package using ffmpeg and mp4box in conjuction
 Source file: http://statustreat.com/privatestream/flight_master.mp4<http://www.linkedin.com/redirect?url=http%3A%2F%2Fstatustreat%2Ecom%2Fprivatestream%2Fflight_master%2Emp4&urlhash=tyHb&_t=tracking_disc>

1) ffmpeg -i flight_master.mp4 -f mp4 -r 24 -vcodec libx264 -preset fast
-profile:v high -an -s 1280x720 -aspect 16:9 -b:v 3000k -map 0:0 -map 0:1
-b:a 128k -ar 44100 -ac 2 -maxrate 3080k -minrate 2920k -bufsize 6000k
-acodec aac -strict experimental -x264opts keyint=25:min-keyint=25:sps-id=1
-keyint_min 25 -g 25 -flags +cgop -sc_threshold 0 -pix_fmt yuv420p -threads
0 -y flight_3000.mp4

2) ffmpeg -i flight_master.mp4 -f mp4 -r 24 -vcodec libx264 -preset fast
-profile:v high -an -s 640x360 -aspect 16:9 -b:v 1000k -map 0:0 -map 0:1
-b:a 128k -ar 44100 -ac 2 -maxrate 1080k -minrate 920k -bufsize 2000k
-acodec aac -strict experimental -x264opts keyint=25:min-keyint=25:sps-id=2
-keyint_min 25 -g 25 -flags +cgop -sc_threshold 0 -pix_fmt yuv420p -threads
0 -y flight_1000.mp4

3) ffmpeg -i flight_master.mp4 -f mp4 -r 24 -vcodec libx264 -preset fast
-profile:v high -an -s 320x180 -aspect 16:9 -b:v 600k -map 0:0 -map 0:1
-b:a 128k -ar 44100 -ac 2 -maxrate 680k -minrate 520k -bufsize 1200k
-acodec aac -strict experimental -x264opts keyint=25:min-keyint=25:sps-id=3
-keyint_min 25 -g 25 -flags +cgop -sc_threshold 0 -pix_fmt yuv420p -threads
0 -y flight_600.mp4

MP4BOX command: mp4box -dash 20000 -frag 2000 -segment-name flight_test_%s
-segment-ext mp4 -rap -url-template -out flight.mpd flight_600.mp4
flight_1000.mp4 flight_3000.mpd

When I played mpd file on chrome browser using DASH player, I get following
pipeline_state: kStopped
url: blob:http%3A//dashif.org/fcca1029-ba6e-430d-ab9d-ca3ed3ff7821
error: *Media segment did not begin with keyframe. *
duration: 151.625
pipeline_error: pipeline: decode error
seek_target: 0
*Tarun Singhal*

More information about the ffmpeg-user mailing list