[FFmpeg-devel] Muxing h.264 to MP4 gives broken files

Baptiste Coudurier baptiste.coudurier
Fri Mar 14 13:36:07 CET 2008


Hi,

Thorsten Jordan wrote:
> Hi there,
> 
> Using ffmpeg to write MP4 files with h.264 video gives files that are
> not muxed correctly. Playback of these files with mplayer look strange
> during the first gop, like the Keyframe is missing, and mplayer reports
> that on initial play and also on every seek:
> 
> [h264 @ 0x8926e50]warning: first frame is no keyframe
> 
> I guess that warning comes also right out of ffmpeg inside mplayer, but
> that doesn't matter.
> 
> As ffmpeg.c does not configure the video encoder to use b-frames i can
> not give a commandline to produce such files. You can use any file as
> source and add a
> 
> ost->st->codec->max_b_frames=2;
> 
> right before avcodec_open() in ffmpeg.c to try this scenario.
> 
> I havn't found a related bug report on the ML nor the bugtracker.
> 
> There is some interesting additional information though:
> If you encode video with b-frames (h264), but give linear increasing
> values as pts (decoding order, so to say) instead of what the encoder
> gives as pts AND if you state that has_b_frames and max_b_frames of the
> context are zero before calling av_interleaved_write_frame, then the
> resulting MP4 file seems ok and mplayer doesn't report the "no keyframe"
> line.
> 

IMHO broken files are declared based on specs, and not
player/decoder/demuxer behaviour.
Can you tell exactly in where generated mp4 is broken ?

-- 
Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA
SMARTJOG SAS                                     http://www.smartjog.com
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
Phone: +33 1 49966312




More information about the ffmpeg-devel mailing list