0

Ffmpeg Command to get video with only English audio or only one language audio

I tried running 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

But the output file I got is 0 byte. So can anyone tell me the write command.

I want to get video with only one language audio, I specify with code like eng, hin etc. With subtitles removed and x264 and .mp4 format! I tried getting .mkv which seem to be successful I don't know whats problem in getting .mp4

Edit: I tried running cmd using different file hevc codec the output I got is below:-

*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.

As you can see it have eng stream audio but still showing error.

1
  • Please show the entire command line output from ffmpeg.
    – slhck
    May 23, 2023 at 6:06

1 Answer 1

0

I think you missed the an m: in your map and language:eng is what worked for me:

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .