Opened 6 years ago

Last modified 6 years ago

#7356 new enhancement

-map 0:s:m:language:eng - ERORR it does not extract eng sub. It always extract first sub Stream

Reported by: Danila Owned by:
Priority: wish Component: ffmpeg
Version: unspecified Keywords: map
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
How to reproduce:

% ffmpeg -i "input.mkv" -map 0:s:m:language:eng "output.srt"
ffmpeg version 4.0.2 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 7.3.1 (GCC) 20180722

Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.

Attachments (2)

ffmpeg-20180813-192403.log (14.8 KB ) - added by Danila 6 years ago.
log
ffmpeg-20180815-131022.log (25.3 KB ) - added by Danila 6 years ago.

Download all attachments as: .zip

Change History (6)

by Danila, 6 years ago

Attachment: ffmpeg-20180813-192403.log added

log

comment:1 by Gyan, 6 years ago

Priority: normalwish
Type: defectenhancement

Not a bug.

Selecting streams via metadata keys cannot be compounded with use of stream specifiers.

e.g. only -map 0:m:language:eng and not -map 0:s:m:language:eng

And mapping using stream specifiers may only be suffixed with a stream index.

e.g. -map 0:s:2 to select the third subtitle stream of input 0.

by Danila, 6 years ago

Attachment: ffmpeg-20180815-131022.log added

comment:2 by Danila, 6 years ago

Okay, but wait :)

About this "e.g. -map 0:s:2 to select the third subtitle stream of input 0."
I will show you a "strange code":

ffmpeg.exe -i input.mkv -map 0:s -map -0:m:language:rus "output_subtitles.srt"

If you have a input.mkv file with one russian and one english subtitles
It will return english subtitles file "output_subtitles.srt"

But if you use this code:

ffmpeg.exe -i input.mkv -map 0:s -map -0:m:language:eng "output_subtitles.srt"

It will return russian subtitles file "output_subtitles.srt"

Also it works with audio streams:
If you have a input.mkv file with:
one russian,
one ukrainian,
one english,
two japanese
audio streams.

ffmpeg.exe -i TEST_Input.mkv -map 0:a -map -0:m:language:rus -map -0:m:language:ukr -map -0:m:language:jpn -report "TEST_output.ac3"

This code delete rus, ukr and jpn streams. And return "TEST_output.ac3" - with eng audio stream.
I add new log https://trac.ffmpeg.org/attachment/ticket/7356/ffmpeg-20180815-131022.log

I know this is strange but it works :)

comment:3 by Gyan, 6 years ago

Not strange. Those command use negative mappings.

e.g. -map 0:s -map -0:m:language:rus maps all subtitle streams and then removes mapped streams whose language is Russian, so leaving only the English stream.

See https://ffmpeg.org/ffmpeg.html#Advanced-options

comment:4 by Danila, 6 years ago

Thanks :) I get it :) I get this logic :)

Now, I have code that returns only eng sub:

ffmpeg.exe -i TEST_Input.mkv -map 0:m:language:eng -map -0:a -map -0:v "TEST_output.srt"

But I believe that you will add this feature soon -map 0:s:m:language:eng :)

Thanks a lot :)

Note: See TracTickets for help on using tickets.