Ffmpeg-python: There is no possibility to set the same command line argument more than one time

Created on 22 Dec 2018  路  1Comment  路  Source: kkroening/ffmpeg-python

For example I couldn't call ffmpeg this way:
ffmpeg -i INPUT -map_channel 0.0.1 -map_channel 0.0.0 OUTPUT
As the result there is no way to configure _map_channel_.

Most helpful comment

Yeah there is, but it's hacky.

class DuplicateString(str):
    def __hash__(self):
        return hash(str(id(self)))

ffmpeg.input(INPUT).output(OUTPUT, **{
    DuplicateString('map_channel'): '0.0.1',
    DuplicateString('map_channel'): '0.0.0',
})

I agree there should be a better way, but python has workarounds for everything.

>All comments

Yeah there is, but it's hacky.

class DuplicateString(str):
    def __hash__(self):
        return hash(str(id(self)))

ffmpeg.input(INPUT).output(OUTPUT, **{
    DuplicateString('map_channel'): '0.0.1',
    DuplicateString('map_channel'): '0.0.0',
})

I agree there should be a better way, but python has workarounds for everything.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

monokal picture monokal  路  3Comments

Matttman picture Matttman  路  6Comments

roman-ku picture roman-ku  路  4Comments

Baa14453 picture Baa14453  路  5Comments

laurentalacoque picture laurentalacoque  路  4Comments