Is there any easy way to extract h.264 raw stream in annexb format?

萝らか妹 提交于 2019-12-06 02:31:31

问题


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?


回答1:


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).



来源:https://stackoverflow.com/questions/10380045/is-there-any-easy-way-to-extract-h-264-raw-stream-in-annexb-format

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!