我正在尝试使用 ffmpeg 处理一些 mkv 文件。最终目标是将一堆 H264 文件转换为 H265 以节省空间。但是,我目前正在尝试的解决方案的一部分是从输出中删除非英语流,目前我的命令如下所示
ffmpeg -i test.mkv -t 2 -map 0:v -map 0:m:language:eng -map_chapters 0 -c copy test-2.mkv
忽略-t 2
,那只是在测试时。
我遇到的问题是章节没有被复制。test.mkv
它们看起来像这样
Menu
00:00:00.000 : en:Chapter 01
00:02:24.519 : en:Chapter 02
00:09:08.089 : en:Chapter 03
00:11:00.618 : en:Chapter 04
00:16:27.069 : en:Chapter 05
...
但在输出中test-2.mkv
我得到的只是
Menu
00:00:00.000 : :Chapter 01
所以我的问题是,我哪里做错了?我尝试了各种方法,包括-map_metadata
但都无法理解这些章节。
PS. 以下是ffprobe
对输入文件的看法
ffprobe test.mkv
ffprobe version 5.1 Copyright (c) 2007-2022 the FFmpeg developers
built with Apple clang version 13.1.6 (clang-1316.0.21.2.5)
configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/5.1 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-neon
libavutil 57. 28.100 / 57. 28.100
libavcodec 59. 37.100 / 59. 37.100
libavformat 59. 27.100 / 59. 27.100
libavdevice 59. 7.100 / 59. 7.100
libavfilter 8. 44.100 / 8. 44.100
libswscale 6. 7.100 / 6. 7.100
libswresample 4. 7.100 / 4. 7.100
libpostproc 56. 6.100 / 56. 6.100
[matroska,webm @ 0x141704960] Could not find codec parameters for stream 4 (Subtitle: hdmv_pgs_subtitle (pgssub)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[matroska,webm @ 0x141704960] Could not find codec parameters for stream 5 (Subtitle: hdmv_pgs_subtitle (pgssub)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, matroska,webm, from 'test.mkv':
Metadata:
encoder : libebml v1.3.0 + libmatroska v1.4.1
creation_time : 2020-11-01T07:51:03.000000Z
Duration: 02:12:33.60, start: 0.000000, bitrate: 29792 kb/s
Chapters:
Chapter #0:0: start 0.000000, end 144.519000
Metadata:
title : Chapter 01
Chapter #0:1: start 144.519000, end 548.089000
Metadata:
title : Chapter 02
Chapter #0:2: start 548.089000, end 660.618000
...