adding metadata only works with (correct) file extension #9435

Closed
opened 2026-02-21 05:04:56 -05:00 by deekerman · 1 comment
Owner

Originally created by @sneaker2 on GitHub (Dec 21, 2016).

Make sure you are using the latest version: run youtube-dl --version and ensure your version is

  • I've verified and I assure that I'm running youtube-dl 2016.12.20

Before submitting an issue make sure you have:

  • At least skimmed through README and most notably FAQ and BUGS sections
  • Searched the bugtracker for similar issues including closed ones

What is the purpose of your issue?

  • Bug report (encountered problems with youtube-dl)
  • Site support request (request for adding support for a new site)
  • Feature request (request for a new functionality)
  • Question
  • Other

If the purpose of this issue is a bug report, site support request or you are not completely sure provide the full verbose output as follows:

[debug] System config: []
[debug] User config: []
[debug] Command-line args: ['-v', '--add-metadata', '-f', '140', '-o', 'test', 'bNCzbzypWXY']
[debug] Encodings: locale cp1252, fs mbcs, out cp1252, pref cp1252
[debug] youtube-dl version 2016.12.20
[debug] Python version 3.4.4 - Windows-7-6.1.7601-SP1
[debug] exe versions: ffmpeg N-82721-g89092fa, ffprobe N-82721-g89092fa, rtmpdump 2.4
[debug] Proxy map: {}
[youtube] bNCzbzypWXY: Downloading webpage
[youtube] bNCzbzypWXY: Downloading video info webpage
[youtube] bNCzbzypWXY: Extracting video information
[youtube] bNCzbzypWXY: Downloading MPD manifest
[debug] Invoking downloader on 'https://r3---sn-4g5edne7.googlevideo.com/videoplayback?id=6cd0b36f3ca95976&itag=140&source=youtube&requiressl=yes&ms=au&mv=m&mm=31&mn=sn-4g5edne7&initcwndbps=1251250&pl=13&nh=IgpwcjA0LmZyYTE2KgkxMjcuMC4wLjE&ratebypass=yes&mime=audio/mp4&gir=yes&clen=4613682&lmt=1405902640344580&dur=287.346&key=dg_yt0&signature=37409C3319BF6BFD3B9D4D71BAAAC261087F06C2.92F70FA5EB86563F4DFE1952DFD30D1E8650BCEA&mt=1482334049&upn=K_vAXxoURQA&ip=94.221.115.183&ipbits=0&expire=1482356005&sparams=ip,ipbits,expire,id,itag,source,requiressl,ms,mv,mm,mn,initcwndbps,pl,nh,ratebypass,mime,gir,clen,lmt,dur'
[download] Destination: test
[download]   0.0% of 4.40MiB at 33.03KiB/s ETA 02:16
[download]   0.1% of 4.40MiB at 99.10KiB/s ETA 00:45
[download]   0.2% of 4.40MiB at 231.22KiB/s ETA 00:19
[download]   0.3% of 4.40MiB at 480.00KiB/s ETA 00:09
[download]   0.7% of 4.40MiB at 881.78KiB/s ETA 00:05
[download]   1.4% of 4.40MiB at 921.59KiB/s ETA 00:04
[download]   2.8% of 4.40MiB at  1.23MiB/s ETA 00:03 
[download]   5.7% of 4.40MiB at  1.70MiB/s ETA 00:02 
[download]  11.3% of 4.40MiB at  2.18MiB/s ETA 00:01 
[download]  22.7% of 4.40MiB at  2.72MiB/s ETA 00:01 
[download]  45.4% of 4.40MiB at  3.17MiB/s ETA 00:00 
[download]  90.9% of 4.40MiB at  3.72MiB/s ETA 00:00 
[download] 100.0% of 4.40MiB at  3.78MiB/s ETA 00:00 
[download] 100% of 4.40MiB in 00:01                  
[ffmpeg] Correcting container in "test"
[debug] ffmpeg command line: ffmpeg -y -i file:test -c copy -f mp4 file:test.temp
[ffmpeg] Adding metadata to 'test'
[debug] ffmpeg command line: ffmpeg -y -i file:test -vn -acodec copy -metadata 'purl=https://www.youtube.com/watch?v=bNCzbzypWXY' -metadata 'description=A video to test the color and displaying quality of your TV/monitor.' -metadata 'comment=A video to test the color and displaying quality of your TV/monitor.' -metadata artist=wvvwwwvvvv -metadata date=20120921 -metadata 'title=Screen/Color test video [1080p]' file:test.temp
ERROR: file:test.temp: Invalid argument
Traceback (most recent call last):
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmph8curlv3\build\youtube_dl\YoutubeDL.py", line 1837, in post_process
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmph8curlv3\build\youtube_dl\postprocessor\ffmpeg.py", line 432, in run
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmph8curlv3\build\youtube_dl\postprocessor\ffmpeg.py", line 196, in run_ffmpeg
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmph8curlv3\build\youtube_dl\postprocessor\ffmpeg.py", line 192, in run_ffmpeg_multiple_files
youtube_dl.postprocessor.ffmpeg.FFmpegPostProcessorError: file:test.temp: Invalid argument

Description of your issue, suggested solution and other information

When using an output file name without any file extension (like simply "test") adding metadata does not work. This is because ffmpeg is called without specifying the output format (e.g. "-f mp4") and only relying on the file extension, e.g. "working.m4a" gets output to "working.temp.m4a" and ffmpeg auto-guesses the mp4 format from the "m4a" extension. However, without an extension youtube-dl tries to output to "test.temp" and ffmpeg fails with an error because it cannot auto-guess ".temp" extension.

The solution would be to force the appropriate format via e,g, "-f mp4" like it does for "Correcting container". Of course, ideally it would combine the two ffmpeg calls into a single one to save time and do less disk accesses (increasing HDD life and decreasing fragmentation and conversion time).

Originally created by @sneaker2 on GitHub (Dec 21, 2016). ### Make sure you are using the *latest* version: run `youtube-dl --version` and ensure your version is - [x] I've **verified** and **I assure** that I'm running youtube-dl **2016.12.20** ### Before submitting an *issue* make sure you have: - [x] At least skimmed through [README](https://github.com/rg3/youtube-dl/blob/master/README.md) and **most notably** [FAQ](https://github.com/rg3/youtube-dl#faq) and [BUGS](https://github.com/rg3/youtube-dl#bugs) sections - [x] [Searched](https://github.com/rg3/youtube-dl/search?type=Issues) the bugtracker for similar issues including closed ones ### What is the purpose of your *issue*? - [x] Bug report (encountered problems with youtube-dl) - [ ] Site support request (request for adding support for a new site) - [ ] Feature request (request for a new functionality) - [ ] Question - [ ] Other --- ### If the purpose of this *issue* is a *bug report*, *site support request* or you are not completely sure provide the full verbose output as follows: ``` [debug] System config: [] [debug] User config: [] [debug] Command-line args: ['-v', '--add-metadata', '-f', '140', '-o', 'test', 'bNCzbzypWXY'] [debug] Encodings: locale cp1252, fs mbcs, out cp1252, pref cp1252 [debug] youtube-dl version 2016.12.20 [debug] Python version 3.4.4 - Windows-7-6.1.7601-SP1 [debug] exe versions: ffmpeg N-82721-g89092fa, ffprobe N-82721-g89092fa, rtmpdump 2.4 [debug] Proxy map: {} [youtube] bNCzbzypWXY: Downloading webpage [youtube] bNCzbzypWXY: Downloading video info webpage [youtube] bNCzbzypWXY: Extracting video information [youtube] bNCzbzypWXY: Downloading MPD manifest [debug] Invoking downloader on 'https://r3---sn-4g5edne7.googlevideo.com/videoplayback?id=6cd0b36f3ca95976&itag=140&source=youtube&requiressl=yes&ms=au&mv=m&mm=31&mn=sn-4g5edne7&initcwndbps=1251250&pl=13&nh=IgpwcjA0LmZyYTE2KgkxMjcuMC4wLjE&ratebypass=yes&mime=audio/mp4&gir=yes&clen=4613682&lmt=1405902640344580&dur=287.346&key=dg_yt0&signature=37409C3319BF6BFD3B9D4D71BAAAC261087F06C2.92F70FA5EB86563F4DFE1952DFD30D1E8650BCEA&mt=1482334049&upn=K_vAXxoURQA&ip=94.221.115.183&ipbits=0&expire=1482356005&sparams=ip,ipbits,expire,id,itag,source,requiressl,ms,mv,mm,mn,initcwndbps,pl,nh,ratebypass,mime,gir,clen,lmt,dur' [download] Destination: test [download] 0.0% of 4.40MiB at 33.03KiB/s ETA 02:16 [download] 0.1% of 4.40MiB at 99.10KiB/s ETA 00:45 [download] 0.2% of 4.40MiB at 231.22KiB/s ETA 00:19 [download] 0.3% of 4.40MiB at 480.00KiB/s ETA 00:09 [download] 0.7% of 4.40MiB at 881.78KiB/s ETA 00:05 [download] 1.4% of 4.40MiB at 921.59KiB/s ETA 00:04 [download] 2.8% of 4.40MiB at 1.23MiB/s ETA 00:03 [download] 5.7% of 4.40MiB at 1.70MiB/s ETA 00:02 [download] 11.3% of 4.40MiB at 2.18MiB/s ETA 00:01 [download] 22.7% of 4.40MiB at 2.72MiB/s ETA 00:01 [download] 45.4% of 4.40MiB at 3.17MiB/s ETA 00:00 [download] 90.9% of 4.40MiB at 3.72MiB/s ETA 00:00 [download] 100.0% of 4.40MiB at 3.78MiB/s ETA 00:00 [download] 100% of 4.40MiB in 00:01 [ffmpeg] Correcting container in "test" [debug] ffmpeg command line: ffmpeg -y -i file:test -c copy -f mp4 file:test.temp [ffmpeg] Adding metadata to 'test' [debug] ffmpeg command line: ffmpeg -y -i file:test -vn -acodec copy -metadata 'purl=https://www.youtube.com/watch?v=bNCzbzypWXY' -metadata 'description=A video to test the color and displaying quality of your TV/monitor.' -metadata 'comment=A video to test the color and displaying quality of your TV/monitor.' -metadata artist=wvvwwwvvvv -metadata date=20120921 -metadata 'title=Screen/Color test video [1080p]' file:test.temp ERROR: file:test.temp: Invalid argument Traceback (most recent call last): File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmph8curlv3\build\youtube_dl\YoutubeDL.py", line 1837, in post_process File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmph8curlv3\build\youtube_dl\postprocessor\ffmpeg.py", line 432, in run File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmph8curlv3\build\youtube_dl\postprocessor\ffmpeg.py", line 196, in run_ffmpeg File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmph8curlv3\build\youtube_dl\postprocessor\ffmpeg.py", line 192, in run_ffmpeg_multiple_files youtube_dl.postprocessor.ffmpeg.FFmpegPostProcessorError: file:test.temp: Invalid argument ``` --- ### Description of your *issue*, suggested solution and other information When using an output file name without any file extension (like simply "test") adding metadata does not work. This is because ffmpeg is called without specifying the output format (e.g. "-f mp4") and only relying on the file extension, e.g. "working.m4a" gets output to "working.temp.m4a" and ffmpeg auto-guesses the mp4 format from the "m4a" extension. However, without an extension youtube-dl tries to output to "test.temp" and ffmpeg fails with an error because it cannot auto-guess ".temp" extension. The solution would be to force the appropriate format via e,g, "-f mp4" like it does for "Correcting container". Of course, ideally it would combine the two ffmpeg calls into a single one to save time and do less disk accesses (increasing HDD life and decreasing fragmentation and conversion time).
Author
Owner

@yan12125 commented on GitHub (Jan 7, 2017):

For "Correcting container" step, only mp4 is applicable, so youtube-dl knows it can use -f mp4. On the other hand, for --add-metadata, It's not feasible to enumerate all possible output formats in youtube-dl. Use -o test.%(ext)s instead.

Of course, ideally it would combine the two ffmpeg calls into a single one to save time and do less disk accesses (increasing HDD life and decreasing fragmentation and conversion time).

See #8476

@yan12125 commented on GitHub (Jan 7, 2017): For "Correcting container" step, only mp4 is applicable, so youtube-dl knows it can use ```-f mp4```. On the other hand, for --add-metadata, It's not feasible to enumerate all possible output formats in youtube-dl. Use ```-o test.%(ext)s``` instead. > Of course, ideally it would combine the two ffmpeg calls into a single one to save time and do less disk accesses (increasing HDD life and decreasing fragmentation and conversion time). See #8476
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/youtube-dl-ytdl-org#9435
No description provided.