question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

multiple values 'map'

See original GitHub issue

Hey,

is there any way to have multi values options like map?

ffmpeg.output(streams_input, path_movie_mp4, **ffmpeg_kwargs).global_args('-map', '0').global_args('-map', '0:m:language:eng').run()

or

ffmpeg.output(streams_input, map=0, map='0:m:language:eng', path_movie_mp4, **ffmpeg_kwargs).run()

I`ll create a python script that will run on a directory within a lot of mkv files. I want to convert every mkv file to mp4. But i do not want any audio language only eng and dutch.

TypeError: output() got multiple values for keyword argument 'map'

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

3reactions
sophiefitzpatrickcommented, Aug 10, 2021

I solved multiple map values with:

# The raw command I'm recreating in python using ffmpeg-python library: 
# ffmpeg -i example.webm -i example.ogg -map 0:v -map 1:a -shortest output.mp4

# handles multiple input
video = ffmpeg.input(in_path_video)
audio = ffmpeg.input(in_path_audio)

# handles multiple -map flags
output_video = video['v']
output_audio = audio['a']

ffmpeg
      .filter([video, audio], 'overlay', 10, 10)
      .output(
           output_video,
           output_audio,
           out_path,
           shortest=1,
       )
       .run(
           capture_stdout=True,
           capture_stderr=True,
       )

# for debugging - what do my args look like?       
command_args = ffmpeg.output(output_video, output_audio, out_path, shortest=1)
print(ffmpeg.get_args(command_args))

# printed args - as you can see everything I specified in my bash command is there
[u'-i', 'example.webm', u'-i', 'example.ogg', u'-map', u'0:v', u'-map', u'1:a', u'-shortest', u'1', 'output.mp4']
1reaction
BramFrcommented, Sep 30, 2020

Mapping is handled by ffmpeg-python. You can see this by running ffmpeg.output().compile(). The API Reference documentation shows you how to specify which streams you want to have mapped to your output. Here’s an example of how I’ve used ffmpeg-python to select streams for batch conversion:

outputVid = inputFile['v:0'].filter_('subtitles', subfile, si=subIndex)
outputAud = inputFile['a:0']

ffmpegRun = ffmpeg.output(outputVid, outputAud, outFilename, **ffmpegFlags).run()

You can see here I’ve specified the first video stream and the first audio stream. Input nodes expose their streams through a dict, and you can specify them using FFMPEG’s stream identifiers.

I understand. But sometimes i have 3 outputAud and the other time just only one. it’s not a dict that i can use same as **ffmpegFlags

Read more comments on GitHub >

github_iconTop Results From Across the Web

HashMap with multiple values under the same key
A collection similar to a Map, but which may associate multiple values with a single key. If you call put(K, V) twice, with...
Read more >
How to make multiple values per key in a Java map possible ...
How to add multiple values per key to a Java HashMap · Stick with the standard APIs and add a collection class like...
Read more >
Create HashMap with Multiple Values Associated with the ...
In Java, HashMap is used to store the data in Key – Value pairs. One key object is associated with one value object....
Read more >
HashMap – Single Key and Multiple Values Example - DZone
HashMap can be used to store key-value pairs. But sometimes you may want to store multiple values for the same key. For example:....
Read more >
How to implement Map that holds multiple values under same ...
The Map interface stores the elements as key-value pairs. It does not allow duplicate keys but allows duplicate values. HashMap and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found