Skip to content

youtube-dl adds file extension to provided output file #4

@drn05r

Description

@drn05r

as Perl's File::Temp->new by default does not provide a file extension, this is passed to -o flag of the youtube-dl command. Below it can bee seen that although the output file is specified the file produced has an .mp4 extension added to it. Even if an extenstion is provided if it does not match up with the type of file downloaded (typically MP4) a further extenstion is added. E.g. /tmp/video4.bin -> /tmp/video4.bin.mp4

/usr/bin/youtube-dl -o /tmp/video4 https://vimeo.com/763404429
[vimeo] 763404429: Downloading webpage
[vimeo] 763404429: Downloading JSON metadata
WARNING: Unable to download JSON metadata: HTTP Error 403: Forbidden
[vimeo] 763404429: Downloading akfire_interconnect_quic m3u8 information
[vimeo] 763404429: Downloading fastly_skyfire m3u8 information
[vimeo] 763404429: Downloading akfire_interconnect_quic MPD information
[vimeo] 763404429: Downloading fastly_skyfire MPD information
[dashsegments] Total fragments: 59
[download] Destination: /tmp/video4.fdash-fastly_skyfire_sep-video-ae4858b4
[download] 100% of 184.64MiB in 00:06
[dashsegments] Total fragments: 60
[download] Destination: /tmp/video4.fdash-fastly_skyfire_sep-audio-91eb8dae
[download] 100% of 7.96MiB in 00:00
[ffmpeg] Merging formats into "/tmp/video4.mp4"
Deleting original file /tmp/video4.fdash-fastly_skyfire_sep-video-ae4858b4 (pass -k to keep)
Deleting original file /tmp/video4.fdash-fastly_skyfire_sep-audio-91eb8dae (pass -k to keep)

To solve this it would be a good idea to extract the file extenstion from the filename retrieved in the youtube-filename invocation and use this. Possibly with .mp4 as a default if not file extension can be extracted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions