twitch-dl icon indicating copy to clipboard operation
twitch-dl copied to clipboard

-f / --format option doesn't appear to do anything

Open KryptonicDragon opened this issue 2 years ago • 4 comments

The download subcommand's help lists:

-f FORMAT, --format FORMAT
                        Video format to convert into, passed to ffmpeg as the target file extension (default: mkv)

However it seems that argument doesn't do anything. For example, if I download a vod via ./twitch-dl.pyz download [any vod id] -q source -f mp4 -o file.mp4.temp, it will fail at the start of the join process since ffmpeg isn't given the argument and fails with [NULL @ 0x5583371ba740] Unable to find a suitable output format for 'file:file.mp4.temp'

I took a glance at the code and don't see where the format is passed to ffmpeg: https://github.com/ihabunek/twitch-dl/blob/7ad574d103b058cffa96f17ae778d526f3f7295d/twitchdl/commands/download.py#L60-L70

KryptonicDragon avatar May 21 '22 20:05 KryptonicDragon

ffmpeg will make assumptions based on the file extension of the output filename. Perhaps passing to ffmpeg a -f {format} argument could be a more proper thing to do? Not sure.

garoto avatar May 21 '22 22:05 garoto

Hello.

I upgraded from 1.17 to the 1.21.0 version last week, and I get the same error message with each and every download I do. Is there any usecase for twitch-dl 1.21.0 when the call to ffmpeg works ? There seems to be an issue with how the ffmpeg command is constructed.

I hesitate to consider my experience (the fact that the ffmpeg encoding never works) as being universal, because if it were, there would be a lot more people complaining, but I can't think of a way to bypass this issue (using 1.21.0) at the moment.

The only 2 options I can think of is : using a previous version of twitch-dl OR running the ffmpeg command myself after the twitch-dl command.

Here is how I use twitch-dl, if it can be of any help (in a bash script) :

python3 /home/twitchdownload/scripts/twitch-dl.1.21.0.pyz download -q source $1 --output "{date}{time}{id}{title_slug}{channel_login}"

I tried using the -f option of twitch-dl but it didn't work.

mouarflenoob avatar Jun 11 '22 14:06 mouarflenoob

--output "{date}{time}{id}{title_slug}{channel_login}.{format}"

garoto avatar Jun 11 '22 16:06 garoto

However it seems that argument doesn't do anything. For example, if I download a vod via ./twitch-dl.pyz download [any vod id] -q source -f mp4 -o file.mp4.temp, it will fail at the start of the join process since ffmpeg isn't given the argument and fails with [NULL @ 0x5583371ba740] Unable to find a suitable output format for 'file:file.mp4.temp'

Yeah, the way --format works at the moment is that it replaces the {format} placeholder in the --output file template. If you specify --format mkv --output "bla.{format}", the resulting target file will be bla.mkv, and this will be passed to ffmpeg and it will create a mkv file based on that extension.

ffmpeg will make assumptions based on the file extension of the output filename. Perhaps passing to ffmpeg a -f {format} argument could be a more proper thing to do? Not sure.

This would probably be a better solution, but I need to test, I'm not very fluent in ffmpeg.

For now, the target file must end in the format you want ffmpeg to produce. I used mkv as default since it's a common container and can contain the audio and video from vods without reencoding them.

ihabunek avatar Jun 25 '22 07:06 ihabunek