Question

Can anyone produce a readable H264 file from this FFMPEG tutorial example? The only thing I have changed is the output format on line 350:

avformat_alloc_output_context2(&oc, NULL, "h264", filename);

Running it with FFMPEG 1.0.1+libx64 v129 produces a 6MB .3gp file that is unreadable by most players (including VLC). When I load it I can see that it contains all frames and I can decode and view them successfully, but for some reason most players will just fail to open it.

Does anyone have more success?

Was it helpful?

Solution

The output format should refer to the container, not the codecs used. What you are doing is equivalent to encoding (on the commandline) to a filename with ".h264" extension. This will produce a raw H.264 file (no container). Many players should be able to handle this, but may not be able to probe it, they would rely on the extension to figure out what it is. If you have a raw file which is saved with .3gp extension, that will fail. Try setting the format to ".3gp" or better yet, leave format NULL as well and let ffmpeg guess from the filename :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top