有没有什么简单的方法来提取h.264原始流的附件格式? [英] Is there any easy way to extract h.264 raw stream in annexb format?
问题描述
当我使用ffmpeg使用命令行提取视频流时:
ffmpeg -i {some file} -vcodec copy -an -f {rawvideo | h264 | whatever一些媒体文件由Adobe Media Encoder生产,只有.m4v(编码为h.264蓝光)文件可以产生一些可用的结果。
/ p>
其他一些格式(如.f4v)可以产生h.264流,但没有PPS / SPS,每个片段以大小而不是00 00 00 01序列开始。 / p>
我希望我可以从包含有效的h.264流的尽可能多的文件中提取附件格式的原始流。我知道我可以添加PPS / SPS,并将大小更改为00 00 00 01自己。但是有没有现有的软件可以做到这一点?
或者可以保证ffmpeg总是能够以附件格式提取流来自.m4v文件,无论文件被编码什么软件?
你可能正在寻找的是h264_mp4toannexb比特流过滤器,使用-bsf命令行选项调用:
ffmpeg -i {some file} -vcodec copy -bsf h264_mp4toannexb -an -f {rawvideo | h264 | whatever} out.h264
请注意,如果您的FFmpeg版本是有点旧,你可能需要使用-vbsf而不是-bsf(该选项最近被重命名)。
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).
这篇关于有没有什么简单的方法来提取h.264原始流的附件格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!