Ffmpeg 命令获取仅带有英语音频或仅带有一种语言音频的视频
我尝试跑步ffmpeg -i input_video.ext -map 0:v -map 0:a:language=eng -c:v copy -c:a copy -map_metadata -1 -sn output.mp4
但是我得到的输出文件是 0 字节。所以有人能告诉我写入命令吗?
我想要获取只包含一种语言音频的视频,我指定了 eng、hin 等代码。删除字幕并使用 x264 和 .mp4 格式!我尝试获取 .mkv,似乎成功了,但我不知道获取 .mp4 时有什么问题
编辑:我尝试使用不同的文件 hevc 编解码器运行 cmd,得到的输出如下:-
*Stderr*
ffmpeg version 4.2.7-0ubuntu0.1 Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
configuration: --prefix=/usr --extra-version=0ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, matroska,webm, from 'input.mkv':
Metadata:
title : MoviesHeist.Co.In | Greenland 2020 1080p 10Bit HEVC BluRay Hindi English ESubs - MoviesHeist.Co.In
encoder : libebml v1.3.10 + libmatroska v1.5.2
creation_time : 2022-04-15T06:26:40.000000Z
Duration: 01:59:27.45, start: 0.000000, bitrate: 2023 kb/s
Chapter #0:0: start 0.000000, end 875.800000
Metadata:
title : Chapter 1
Chapter #0:1: start 875.800000, end 1842.000000
Metadata:
title : Chapter 2
Chapter #0:2: start 1842.000000, end 2721.200000
Metadata:
title : Chapter 3
Chapter #0:3: start 2721.200000, end 3563.000000
Metadata:
title : Chapter 4
Chapter #0:4: start 3563.000000, end 4497.400000
Metadata:
title : Chapter 5
Chapter #0:5: start 4497.400000, end 5432.800000
Metadata:
title : Chapter 6
Chapter #0:6: start 5432.800000, end 6314.600000
Metadata:
title : Chapter 7
Chapter #0:7: start 6314.600000, end 7167.800000
Metadata:
title : Chapter 8
Stream #0:0: Video: hevc (Main 10), yuv420p10le(tv, bt709), 1920x808, SAR 1:1 DAR 240:101, 23.98 fps, 23.98 tbr, 1k tbn, 23.98 tbc (default)
Metadata:
title : MoviesHeist.Co.In
BPS-eng : 1594464
DURATION-eng : 01:59:27.452000000
NUMBER_OF_FRAMES-eng: 171847
NUMBER_OF_BYTES-eng: 1428531144
_STATISTICS_WRITING_APP-eng: mkvmerge v47.0.0 ('Black Flag') 64-bit
_STATISTICS_WRITING_DATE_UTC-eng: 2022-04-15 06:26:40
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream #0:1(hin): Audio: eac3, 44100 Hz, stereo, fltp (default)
Metadata:
title : MoviesHeist.Co.In
BPS-eng : 224000
DURATION-eng : 01:59:26.676000000
NUMBER_OF_FRAMES-eng: 205762
NUMBER_OF_BYTES-eng: 200666940
_STATISTICS_WRITING_APP-eng: mkvmerge v47.0.0 ('Black Flag') 64-bit
_STATISTICS_WRITING_DATE_UTC-eng: 2022-04-15 06:26:40
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream #0:2(eng): Audio: aac (HE-AAC), 48000 Hz, 5.1, fltp
Metadata:
title : MoviesHeist.Co.In
BPS-eng : 202667
DURATION-eng : 01:59:27.318000000
NUMBER_OF_FRAMES-eng: 167984
NUMBER_OF_BYTES-eng: 181572852
_STATISTICS_WRITING_APP-eng: mkvmerge v47.0.0 ('Black Flag') 64-bit
_STATISTICS_WRITING_DATE_UTC-eng: 2022-04-15 06:26:40
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream #0:3(eng): Subtitle: subrip (default)
Metadata:
title : MoviesHeist.Co.In
BPS-eng : 59
DURATION-eng : 01:52:20.817000000
NUMBER_OF_FRAMES-eng: 1496
NUMBER_OF_BYTES-eng: 49907
_STATISTICS_WRITING_APP-eng: mkvmerge v47.0.0 ('Black Flag') 64-bit
_STATISTICS_WRITING_DATE_UTC-eng: 2022-04-15 06:26:40
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream #0:4(eng): Subtitle: subrip
Metadata:
title : MoviesHeist.Co.In
BPS-eng : 68
DURATION-eng : 01:52:56.519000000
NUMBER_OF_FRAMES-eng: 1758
NUMBER_OF_BYTES-eng: 57982
_STATISTICS_WRITING_APP-eng: mkvmerge v47.0.0 ('Black Flag') 64-bit
_STATISTICS_WRITING_DATE_UTC-eng: 2022-04-15 06:26:40
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
[matroska,webm @ 0x5627a17c7380] Invalid stream specifier: a:language=eng.
Last message repeated 9 times
Stream map '0:a:language=eng' matches no streams.
To ignore this, add a trailing '?' to the map.
正如您所看到的,它有英语流音频,但仍然显示错误。
答案1
我认为您在地图中漏掉了 m:,而 language:eng 对我有用:
ffmpeg -i input_video.ext -map 0:v -map 0:a:m:language:eng -c:v copy -c:a copy -map_metadata -1 -sn output.mp4