[Libav-user] avformat_write_header produces invalid header (resulting MPG broken)

Jan drabner drabner at zoobe.com
Tue Jan 22 11:30:14 CET 2013


Hey,

I am rendering a video file from input pictures that come from a 3D engine
at runtime (I don't pass an actual picture file, just RGB memory).
This works perfectly when outputting MP4 using CODEC_ID_H264 as video codec.

But when I want to create an MPG file using CODEC_ID_MPEG2VIDEO, the
resulting file is simply broken. It is unplayable by any player* and when I
then want to transform that MPG to MP4 in another step (I need to do that
to concatenate it with some other video, which only works with MPG afaik),
the resulting .mp4 file has both videos, but many frames from the original
MPG video (and only video!) are simply skipped.

*Well, VLC manages to play it starting at some random second, playing only
sound and some weird pictures...

At first I thought the MPG -> MP4 conversion was the problem, but then I
noticed that the initial MPG, which comes from the video render engine, is
already broken, which would speak for broken headers. Not sure if it is the
system or sequence headers that are broken, though.
Or if it could be something totally different.

If you want to have a look, here is the file:
http://www.file-upload.net/download-7093306/broken.mpg.html

Again, the exact same muxing code works perfectly fine when directly
creating an MP4 from the video render engine, so I'm pretty sure the input
data, swscale(), etc. is correct. The only difference is that CODEC_ID_H264
is used and some additional variables (like qmin, qmax, etc.) are set,
which are all specific to H264 so should not have an impact.

Also, neither avformat_write_header nor av_write_trailer report an error.

As an additional info, when viewing the codec data of the MPG in VLC
player, it is not able to show the FPS, resolution and format (should show
640x360, 30 fps and 4:2:0 YUV).

I am using a very new (some weeks, maybe) FFmpeg version, which I compiled
from sources with MinGW.

-- 
Jan Drabner ׀ TD Programming Engine & Animation



 zoobe message entertainment gmbh

kurfürstendamm 226 l 10719 berlin



  email: drabner at zoobe.com <nachname at zoobe.com> l  mob: 0172 7017640



  geschäftsführer: lenard f. krawinkel

 tel: +49 30. 288 838 88 l site: *www.zoobe.com* <http://www.zoobe.com/> ׀
email: *info at zoobe.com* <info at zoobe.com>



  amtsgericht charlottenburg, berlin ׀ hrb-nr. 11 42 79 b
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130122/3d3830cd/attachment.html>


More information about the Libav-user mailing list