Is there an easy way to extract h.264 raw stream in application format?

When I retrieve the video stream using ffmpeg using the command line:

ffmpeg -i {some file} -vcodec copy -an -f {rawvideo | h264 | whatever} out.h264

with some media files created by Adobe Media Encoder, only .m4v files (encoded as h.264 blu-ray) can produce some useful results.

Some other formats (e.g. .f4v) can create an h.264 stream, but without PPS / SPS, and each slice starts with a size instead of a sequence 00 00 00 01.

I want me to be able to extract raw appb format streams from as many files as possible that contain a valid h.264 stream. I know that I can add PPS / SPS and resize to 00 00 00 01. But is there any existing software?


Or can it be guaranteed that ffmpeg can always extract appb streams from a .m4v file, no matter what software is encoded in the file?

+5
extract ffmpeg video
source share
1 answer

What you are probably looking for is the h264_mp4toannexb bit stream filter called with the -bsf command line option:

ffmpeg -i {some file} -vcodec copy -bsf h264_mp4toannexb -an -f {rawvideo|h264|whatever} out.h264 

Keep in mind that if your version of FFmpeg is slightly outdated, you may need to use -vbsf instead of -bsf (this option was recently renamed).

+11
source share

All Articles