具有以下视频 MediaInfo
General
Complete name : r.avi
Format : AVI
Format/Info : Audio Video Interleave
File size : 8.51 MiB
Duration : 1 min 0 s
Overall bit rate : 1 189 kb/s
Movie name : Ralph Breaks the Internet 4K
Writing application : Lavf57.71.100
Video
ID : 0
Format : AVC
Format/Info : Advanced Video Codec
Format profile : [email protected]
Format settings : CABAC / 4 Ref Frames
Format settings, CABAC : Yes
Format settings, ReFrames : 4 frames
Codec ID : H264
Duration : 59 s 977 ms
Bit rate : 1 010 kb/s
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate mode : Variable
Frame rate : 23.976 (24000/1001) FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.020
Stream size : 7.22 MiB (85%)
Title : @NAHOM
Writing library : x264 core 148 r2795 aaa9aa8
Encoding settings : cabac=1 / ref=4 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=8 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / 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=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=23 / scenecut=40 / intra_refresh=0 / rc_lookahead=50 / 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
ID : 1
Format : AAC LC
Format/Info : Advanced Audio Codec Low Complexity
Codec ID : FF-2
Duration : 1 min 0 s
Bit rate : 160 kb/s
Channel(s) : 2 channels
Channel layout : L R
Sampling rate : 48.0 kHz
Frame rate : 46.875 FPS (1024 SPF)
Compression mode : Lossy
Stream size : 1.18 MiB (14%)
Alignment : Split accross interleaves
Interleave, duration : 21 ms (0.51 video frame)
Interleave, preload duration : 750 ms
我正在尝试使用 ffmpeg 命令添加软字幕
ffmpeg -y -i test1/r.avi -c:v libx264 -map v:0 -map a:0 -map 1 r.avi
但我收到以下错误:
[avi @ 0x55d2e8c30d20] Subtitle streams other than DivX XSUB is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
Could not write header for output file #0 (incorrect codec parameters ?): Not yet implemented in FFmpeg, patches welcome
Error initializing output stream 0:0 --
[libmp3lame @ 0x55d2e8c394c0] 4 frames left in the queue on closing
知道我做错了什么吗
答案1
尝试将 SRT(subrip)字幕添加到 AVI 容器时也发现了同样的错误(未实现除 DivX XSUB 之外的字幕流...)。
1)无需重新编码,将 AVI 转换为 MKV 容器:
ffmpeg -fflags +genpts -i input.avi -c:v copy -c:a copy output.mkv
2) 将字幕添加到 mkv 容器(上一步中的“output.mkv”)。例如:
ffmpeg -i output.mkv -i input.srt -c copy -c:s srt "output-sub.eng.mkv"