After a reader identified that a re-wrap method wasn’t working, they kindly supplied a test file to analyse.
In the original post I detailed how easy it was to re-wrap the DVR export streams so that they could be dealt with for any purpose. That post was written in Nov 2013. After receiving the test file, I attempted the documented method again and it failed.
It all comes down to a number of issues. The version of FFmpeg, the type of H264 Bitstream and the type of container used to house the H264 Bitsream.
Above is a FFmpeg version from March 2014. The exact version number is at the top.
Using the same command as on the previous post, the placing of the H264 stream into an AVI container worked.
ffmpeg -f h264 -i thefile.mp4 -vcodec copy -fflags genpts -f avi thefile.avi
As can be seen below, the avi has been created successfully and the thumbnail is displayed:
What about a recent version of FFmpeg?
Above is the FFmpeg version from June 2014.
This time – problems!
Various error messages appear but the clue lies in the red lines at the bottom. This detailed a problem with the bitstream. The last red line is a common error message which, in my experience, suggests that that the frames cannot be placed inside a specific container.
If we change the stream by transcoding, will it go into an AVI? – Yes. By transcoding to Raw Uncompressed – it worked.
If we change the Container Format, will it work? – Yes. By retaining the original H264 Bitstream and placing it into either the M4V Container or the MKV Container – it worked. Example:
ffmpeg -f h264 -i thefile.mp4 -c:v copy thefile.m4v
In summary, the older FFmpeg allows the bitstream type used by the DVR to be placed into the avi container. The newer FFmpeg does not. This is not a fault with FFmpeg. This is down to the AVI Container format being old and not really designed for the H264 video format.
Transcoding is fine, whether to uncompressed for editing and then further transcoding or direct to another format such as Windows Media. Example for High Quality WMV..
ffmpeg -f h264 -i thefile.mp4 -qscale 2 thefile.wmv
There are various documents online regarding the bitstream types and the suitable containers but I found this one particularly helpful.
www.szatmary.org/blog/25 – The h.264 Bitstream
As always, hope it helps….