我正在尝试分割 mp4 视频文件以进行 HLS 播放,但出现以下错误:
"无法为输出文件 #0 写入标头(编解码器参数不正确) ?):未找到 Muxer"
有谁知道我做错了什么?
输入命令:
sudo ffmpeg -y -i adwd.mp4 -vcodec copy -acodec copy -force_key_frames 30 -map 0 -f segment segment_list adwd.m3u8 -segment_time 10 -segment_format mpeg_ts -segment_list_type m3u8 segment%d.ts
ffmpeg version 2.8.5 Copyright (c) 2000-2016 the FFmpeg developers
built with Apple LLVM version 7.0.2 (clang-700.1.81)
configuration: --prefix=/usr/local/Cellar/ffmpeg/2.8.5 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-vda
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
视频信息:
General / Container Stream #1
Total Video Streams for this File.................1
Total Audio Streams for this File.................1
Video Codecs Used.................................AVC
Audio Codecs Used.................................AAC LC
File Format.......................................MPEG-4
Play Time.........................................9h 1mn
Total File Size...................................588 MiB
Total Stream BitRate..............................152 Kbps
Encoded with......................................Lavf56.40.101
Video Stream #1
Codec (Human Name)................................AVC
Codec (FourCC)....................................avc1
Codec Profile.....................................High@L2.1
Frame Width.......................................426 pixels
Frame Height......................................240 pixels
Frame Rate........................................29.970 fps
Total Frames......................................973039
Display Aspect Ratio..............................16:9
Scan Type.........................................Progressive
Color Space.......................................YUV
Codec Settings (Summary)..........................CABAC / 4 Ref Frames
QF (like Gordian Knot)............................0.005
Codec Settings (CABAC)............................Yes
Codec Settings (Reference Frames).................4
Video Stream Length...............................9h 1mn 7s 68ms
Video Stream BitRate..............................15.2 Kbps
Video Stream BitRate Mode.........................VBR
Bit Depth.........................................8 bits
Video Stream Size.................................58.9 MiB (10%)
Video Encoder.....................................x264 - core 148 r2601 a0cd7d3
Video Encoder (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=3 / lookahead_threads=1 / 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
Audio Stream #1
Codec.............................................AAC
Codec (FourCC)....................................40
Audio Stream Length...............................9h 1mn 7s 104ms
Audio Stream BitRate..............................128 Kbps
Audio Stream BitRate Mode.........................CBR
Number of Audio Channels..........................2
Audio Channel's Positions.........................Front: L R
Sampling Rate.....................................44.1 KHz
Audio Stream Size.................................495 MiB (84%)
我通过删除强制关键帧(原始编码中剩余的命令并设置 -flags -global_header 参数解决了这个编码问题。
这是我使用的最后一个命令:
sudo ffmpeg -i adwd.mp4 -bsf:v h264_mp4toannexb -c copy -map 0 -flags -global_header -f segment -segment_time 10 -segment_list adwd.m3u8 -segment_format mpegts adwd%d.ts
错误消息似乎指示它找不到段复用器。您可以使用以下命令检查它是否已启用:
ffmpeg -formats | grep segment
它应该输出如下内容:
E segment segment
E stream_segment,ssegment streaming segment muxer