Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid conversion between lossy audio codecs when target codec is available #16746

Closed
alex3kov opened this issue Jun 16, 2018 · 4 comments
Closed

Avoid conversion between lossy audio codecs when target codec is available #16746

alex3kov opened this issue Jun 16, 2018 · 4 comments

Comments

@alex3kov
Copy link

@alex3kov alex3kov commented Jun 16, 2018

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

Before submitting an issue make sure you have:

  • At least skimmed through the README, most notably the FAQ and BUGS sections
  • Searched the bugtracker for similar issues including closed ones
  • Checked that provided video/audio/playlist URLs (if any) are alive and playable in a browser

What is the purpose of your issue?

  • Bug report (encountered problems with youtube-dl)
  • Question

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:

Add the -v flag to your command line you run youtube-dl with (youtube-dl -v <your command line>), copy the whole output and insert it here. It should look similar to one below (replace it with your log inserted between triple ```):

youtube-dl -v -F "https://www.youtube.com/watch?v=epXN2H1SenI"
[debug] System config: []
[debug] User config: ['--no-playlist', '--output', '~/REMOVABLE_MEDIA/usb_ntfs/tmp_HDD/%(title)s.%(ext)s', '--ignore-errors']
[debug] Custom config: []
[debug] Command-line args: ['-v', '-F', 'https://www.youtube.com/watch?v=epXN2H1SenI']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2018.06.14
[debug] Python version 3.6.5 (CPython) - Linux-4.16.13-2-zen-x86_64-with-arch-Arch-Linux
[debug] exe versions: ffmpeg 4.0, ffprobe 4.0, rtmpdump 2.4
[debug] Proxy map: {}
[youtube] epXN2H1SenI: Downloading webpage
[youtube] epXN2H1SenI: Downloading video info webpage
[info] Available formats for epXN2H1SenI:
format code  extension  resolution note
140          m4a        audio only DASH audio  131k , m4a_dash container, mp4a.40.2@128k, 41.57MiB
160          mp4        256x144    144p  120k , avc1.4d400c, 12fps, video only, 35.38MiB
133          mp4        426x240    240p  254k , avc1.4d4015, 24fps, video only, 79.16MiB
134          mp4        640x360    360p  261k , avc1.4d401e, 24fps, video only, 73.49MiB
135          mp4        854x480    480p  560k , avc1.4d401e, 24fps, video only, 155.34MiB
136          mp4        1280x720   720p 1105k , avc1.4d401f, 24fps, video only, 338.97MiB
17           3gp        176x144    small , mp4v.20.3, mp4a.40.2@ 24k, 24.21MiB
36           3gp        320x180    small , mp4v.20.3, mp4a.40.2, 73.05MiB
43           webm       640x360    medium , vp8.0, vorbis@128k, 115.51MiB
18           mp4        640x360    medium , avc1.42001E, mp4a.40.2@ 96k, 116.44MiB
22           mp4        1280x720   hd720 , avc1.64001F, mp4a.40.2@192k (best)
youtube-dl -v -x --audio-format vorbis "https://www.youtube.com/watch?v=epXN2H1SenI"
[debug] System config: []
[debug] User config: ['--no-playlist', '--output', '~/REMOVABLE_MEDIA/usb_ntfs/tmp_HDD/%(title)s.%(ext)s', '--ignore-errors']
[debug] Custom config: []
[debug] Command-line args: ['-v', '-x', '--audio-format', 'vorbis', 'https://www.youtube.com/watch?v=epXN2H1SenI']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2018.06.14
[debug] Python version 3.6.5 (CPython) - Linux-4.16.13-2-zen-x86_64-with-arch-Arch-Linux
[debug] exe versions: ffmpeg 4.0, ffprobe 4.0, rtmpdump 2.4
[debug] Proxy map: {}
[youtube] epXN2H1SenI: Downloading webpage
[youtube] epXN2H1SenI: Downloading video info webpage
[debug] Invoking downloader on 'https://r1---sn-gpoxu-n8vl.googlevideo.com/videoplayback?key=yt6&dur=2714.853&source=youtube&lmt=1412221181141796&nh=%2CIgpwcjAyLnN2bzA1KgkxMjcuMC4wLjE&c=WEB&id=o-ANneR67N2tdv2h6CsuQPLe4zZVFouF8YvcsRgm0Mb7Dy&requiressl=yes&ip=188.126.61.7&signature=8F6A3F8FFF07C9BB9D48A094EC83D5B0F8225443.91BF4F38B0BE8E3089B99A180527A839B905D273&gir=yes&fvip=17&sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cnh%2Cpl%2Crequiressl%2Csource%2Cexpire&mv=m&mt=1529130174&ms=au%2Crdu&itag=140&ei=eK0kW53UIsnQ7gTy8Yj4Cg&ipbits=0&mn=sn-gpoxu-n8vl%2Csn-n8v7zns7&mm=31%2C29&initcwndbps=1390000&keepalive=yes&expire=1529151960&clen=43584581&pl=22&mime=audio%2Fmp4&ratebypass=yes'
[download] Destination: /home/username/REMOVABLE_MEDIA/usb_ntfs/tmp_HDD/Dhammapada Verse 50 - Oversee Yourself.m4a
[download] 100% of 41.57MiB in 00:11
[ffmpeg] Correcting container in "/home/username/REMOVABLE_MEDIA/usb_ntfs/tmp_HDD/Dhammapada Verse 50 - Oversee Yourself.m4a"
[debug] ffmpeg command line: ffmpeg -y -i 'file:/home/username/REMOVABLE_MEDIA/usb_ntfs/tmp_HDD/Dhammapada Verse 50 - Oversee Yourself.m4a' -c copy -f mp4 'file:/home/username/REMOVABLE_MEDIA/usb_ntfs/tmp_HDD/Dhammapada Verse 50 - Oversee Yourself.temp.m4a'
[debug] ffmpeg command line: ffprobe -show_streams 'file:/home/username/REMOVABLE_MEDIA/usb_ntfs/tmp_HDD/Dhammapada Verse 50 - Oversee Yourself.m4a'
[ffmpeg] Destination: /home/username/REMOVABLE_MEDIA/usb_ntfs/tmp_HDD/Dhammapada Verse 50 - Oversee Yourself.ogg
[debug] ffmpeg command line: ffmpeg -y -i 'file:/home/username/REMOVABLE_MEDIA/usb_ntfs/tmp_HDD/Dhammapada Verse 50 - Oversee Yourself.m4a' -vn -acodec libvorbis -q:a 5 'file:/home/username/REMOVABLE_MEDIA/usb_ntfs/tmp_HDD/Dhammapada Verse 50 - Oversee Yourself.ogg'
Deleting original file /home/username/REMOVABLE_MEDIA/usb_ntfs/tmp_HDD/Dhammapada Verse 50 - Oversee Yourself.m4a (pass -k to keep)

Description of your issue, suggested solution and other information

The goal is to get an Ogg/Vorbis audio file. In the example above one of the formats (43) already contains Vorbis audio, so I expect youtube-dl -x --audio-format vorbis to use that format and extract Vorbis audio track out of it. Instead youtube-dl downloads m4a/AAC audio and converts it to Ogg/Vorbis with ffmpeg. Conversions between lossy audio formats could lead to a loss of quality and are much longer than audio track extraction from video file.
Expected behavior:

  1. youtube-dl downloads format 43 because it contains requested Vorbis format
  2. youtube-dl invokes ffmpeg -i track.webm -c:a copy -vn track.ogg and removes track.webm.

Please tell me if I missed some setting to achieve this.

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Jun 16, 2018

43 is video+audio format. Downloading video for an audio extraction request is an overkill. Instead youtube-dl downloads audio-only format. If there is a vorbis audio-only format it will be download with no conversion. In this case there is no vorbis audio-only format thus a conversion happens.

@dstftw dstftw closed this Jun 16, 2018
@alex3kov
Copy link
Author

@alex3kov alex3kov commented Jun 17, 2018

43 is video+audio format. Downloading video for an audio extraction request is an overkill.

How is it any more of an overkill than converting between lossy audio formats? The latter certainly takes more time and much more CPU cycles.

In this case there is no vorbis audio-only format thus a conversion happens.

... with the loss of audio quality.
There's no problem with doing it manually of course, it's just becomes a nuisance with large playlists.

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Jun 17, 2018

Cause it will download video part that is useless in such scenario.
You don't need to do this manually: specify -f to prefer best format with acodec=vorbis.

@alex3kov
Copy link
Author

@alex3kov alex3kov commented Jun 17, 2018

OK, youtube-dl -x -f"best[acodec=vorbis]" works, thanks a lot.
Conversion was taking forever on a SoC server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.