我目前正在尝试扩展以下示例:
https://chcunningham-samples.netlify.app/ffmpeg-wasm-demuxer/wasm_demuxer_demo.html
我想使用 FFmpeg 将视频容器与音频和视频流分离。但不幸的是我遇到了一些问题:
对只有音频流的文件进行多路分解工作正常,但是当我尝试对包含视频流的文件进行多路分解时,我遇到了一些错误:
首先我收到以下警告:
然后当我尝试使用 av_read_frame 方法读取帧时,出现以下错误:
ffmpeg错误str:处理输入时发现无效数据
我是否必须扩展示例的构建过程以也允许解复用视频流?特别是 h264 编解码器或导致错误的原因是什么?
提前致谢! :)
我已经检查过我的文件是否已损坏,但事实并非如此。我还尝试使用以下 cli 参数“-enable-parser=h264”实现 h264 解析器,不幸的是没有任何改变。
如果您想了解有关我尝试解复用的文件的更多信息,请在此处:
General
Complete name: test.mp4
Format: MPEG-4
Format profile: Base Media
Codec ID: isom (isom/iso2/avc1/mp41)
File size: 17.5 MiB
Duration: 1 min 1 s
Overall bit rate: 2 400 kb/s
Frame rate: 30.000 FPS
Writing application: Lavf59.17.101
Video
ID: 1
Format: AVC
Format/Info: Advanced Video Codec
Format profile: [email protected]
Format settings: CABAC / 4 Ref Frames
Format settings, CABAC: Yes
Format settings, Reference frames: 4 frames
Codec ID: avc1
Codec ID/Info: Advanced Video Coding
Duration: 1 min 1 s
Bit rate: 2 322 kb/s
Width: 1 280 pixels
Height: 720 pixels
Display aspect ratio: 16:9
Frame rate mode: Constant
Frame rate: 30.000 FPS
Color space: YUV
Chroma subsampling: 4:2:0
Bit depth: 8 bits
Scan type: Progressive
Bits/(Pixel*Frame): 0.084
Stream size: 16.9 MiB (97%)
Writing library: x264 core 163 r3060M 5db6aa6
Encoding settings: cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=18 / lookahead_threads=3 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=23.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Codec configuration box: avcC
Audio
ID: 2
Format: AAC LC
Format/Info: Advanced Audio Codec Low Complexity
Codec ID: 2 / 40 / mp4a-40-2
Duration: 1 min 1 s
Source duration: 1 min 1 s
Bit rate mode: Constant
Bit rate: 69.8 kb/s
Channel(s): 1 channel
Channel layout: M
Sampling rate: 48.0 kHz
Frame rate: 46.875 FPS (1024 SPF)
Compression mode: Lossy
Stream size: 521 KiB (3%)
Source stream size: 521 KiB (3%)
Default: Yes
Alternate group: 1