我正在尝试以视频流、音频流和字幕的形式重新排列视频流。我想我也可以将视频格式更改为mkv
更常见的格式mp4
,但无论我如何尝试,它仍然显示此错误消息:
Input #0, matroska,webm, from '/path/to/file.mkv':
Metadata:
encoder : libebml v1.3.6 + libmatroska v1.4.9
creation_time : 2019-06-17T20:41:37.000000Z
Duration: 01:03:10.17, start: 0.000000, bitrate: 1215 kb/s
Chapter #0:0: start 0.054000, end 3790.174000
Metadata:
title : Capitolo 01
Stream #0:0(ita): Subtitle: subrip (default)
Metadata:
BPS-eng : 4
DURATION-eng : 00:52:26.144000000
NUMBER_OF_FRAMES-eng: 37
NUMBER_OF_BYTES-eng: 1627
_STATISTICS_WRITING_APP-eng: mkvmerge v30.1.0 ('Forever And More') 64-bit
_STATISTICS_WRITING_DATE_UTC-eng: 2019-06-17 20:41:37
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream #0:1(ita): Audio: aac (LC), 48000 Hz, stereo, fltp (default)
Metadata:
BPS-eng : 113000
DURATION-eng : 01:03:10.165000000
NUMBER_OF_FRAMES-eng: 177664
NUMBER_OF_BYTES-eng: 53536337
_STATISTICS_WRITING_APP-eng: mkvmerge v30.1.0 ('Forever And More') 64-bit
_STATISTICS_WRITING_DATE_UTC-eng: 2019-06-17 20:41:37
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream #0:2: Video: h264 (High), yuv420p(progressive), 720x404 [SAR 1:1 DAR 180:101], 25 fps, 25 tbr, 1k tbn, 50 tbc (default)
Metadata:
BPS-eng : 1100698
DURATION-eng : 01:03:10.080000000
NUMBER_OF_FRAMES-eng: 94752
NUMBER_OF_BYTES-eng: 521466768
_STATISTICS_WRITING_APP-eng: mkvmerge v30.1.0 ('Forever And More') 64-bit
_STATISTICS_WRITING_DATE_UTC-eng: 2019-06-17 20:41:37
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Automatic encoder selection failed for output stream #0:2. Default encoder for format mp4 (codec none) is probably disabled. Please choose an encoder manually.
Error selecting an encoder for stream 0:2
这是我当前的命令:
ffmpeg -progress pipe:1 -hide_banner -i /path/to/file.mkv -map 0:2 -map 0:1 -map 0:0 -c:a aac -c:v copy /path/to/outfile.mp4
有谁知道如何使用 FFmpeg 仅通过一次传递就能做到这一点?
答案1
您尚未设置字幕编解码器模式,因此 ffmpeg 将尝试自动选择字幕编码器。但是,MP4 复用器尚未注册默认字幕编码器,因此命令失败。
使用
ffmpeg -progress pipe:1 -hide_banner -i /path/to/file.mkv -map 0:v -map 0:a -map 0:s -c:a aac -c:v copy -c:s mov_text /path/to/outfile.mp4
请注意,MP4 不正式支持 SRT,因此您必须重新编码它。