When I extract video stream with ffmpeg using command-line:
ffmpeg -i {some file} -vcodec copy -an -f {rawvideo|h264|whatever} out.h264
with some media files produced by Adobe Media Encoder, only .m4v (encoded as h.264 blu-ray) files can produce some usable results.
Some other format(like .f4v) can produce h.264 stream, but without PPS/SPS, and each slice starts with size instead of 00 00 00 01 sequence.
I wish I can extract annexb format raw streams from as many as possible files that contains valid h.264 stream. I know I can add PPS/SPS and change size into 00 00 00 01 myself. But is there any existing software can do this?
Or can it be guaranteed that ffmpeg can always extract streams in annexb format from .m4v file, no matter with what software the file is encoded?
What you are probably looking for is the h264_mp4toannexb bitstream filter, invoked with the -bsf command line option:
ffmpeg -i {some file} -vcodec copy -bsf h264_mp4toannexb -an -f {rawvideo|h264|whatever} out.h264
Be advised that if your version of FFmpeg is a bit old, you may need to use -vbsf instead of -bsf (the option was renamed recently).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With