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

Custom config ` --config-location` not working as expected. #23613

Closed
byteshiva opened this issue Jan 3, 2020 · 6 comments
Closed

Custom config ` --config-location` not working as expected. #23613

byteshiva opened this issue Jan 3, 2020 · 6 comments

Comments

@byteshiva
Copy link

@byteshiva byteshiva commented Jan 3, 2020

Checklist

  • I'm asking a question
  • I've looked through the README and FAQ for similar questions
  • I've searched the bugtracker for similar questions including closed ones

Question

$ uname -a 
Linux desktop 5.3.0-26-generic #28-Ubuntu SMP x86_64 x86_64 x86_64 GNU/Linux

Here is the custom youtube-dl config I'm using to convert file to AVI

$ cat ~/.config/youtube-dl/config-video
# Do not copy the mtime
--no-mtime

# Save all videos under video directory in your home directory
-o ~/videos/%(title)s.%(ext)s

When I use custom config location it's not downloading the file to custom output directory but going in old default config path.

if I use --ignore-config and --config-location its downloading to current path.

$ youtube-dl --recode-video="avi" --ignore-config --config-location=~/.config/youtube-dl/config-video --verbose https://www.youtube.com/watch?v=GkH39-TZL8Q  --exec 'echo {}'

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'--recode-video=avi', u'--ignore-config', u'--config-location=~/.config/youtube-dl/config-video', u'--verbose', u'https://www.youtube.com/watch?v=GkH39-TZL8Q', u'--exec', u'echo {}']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2020.01.01
[debug] Python version 2.7.17 (CPython) - Linux-5.3.0-26-generic-x86_64-with-Ubuntu-19.10-eoan
[debug] exe versions: avconv 12.3, avprobe 12.3, ffmpeg 4.1.4-1build2, ffprobe 4.1.4-1build2, phantomjs 2.1.1, rtmpdump 2.4
[debug] Proxy map: {}
[youtube] GkH39-TZL8Q: Downloading webpage
[youtube] GkH39-TZL8Q: Downloading video info webpage
[debug] Default format spec: bestvideo+bestaudio/best
WARNING: Requested formats are incompatible for merge and will be merged into mkv.
[debug] Invoking downloader on u'https://r1---sn-ci5gup-h55z.googlevideo.com/videoplayback?expire=1578076529&ei=EDUPXqmiO6TG1Aaj1zc&ip=182.65.121.133&id=o-AKxlvVFPwpf1oP63MAMzY5JW498AioQmaGqaewqk6HKJ&itag=137&aitags=133%2C134%2C135%2C136%2C137%2C160%2C242%2C243%2C244%2C247%2C248%2C278%2C298%2C299%2C302%2C303%2C394%2C395%2C396%2C397%2C398%2C399&source=youtube&requiressl=yes&mm=31%2C26&mn=sn-ci5gup-h55z%2Csn-cvh76nek&ms=au%2Conr&mv=m&mvi=0&pl=19&initcwndbps=747500&mime=video%2Fmp4&gir=yes&clen=331180368&dur=343.143&lmt=1577935538401177&mt=1578054821&fvip=1&keepalive=yes&fexp=23842630%2C23860862&c=WEB&txp=6535432&sparams=expire%2Cei%2Cip%2Cid%2Caitags%2Csource%2Crequiressl%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&sig=ALgxI2wwRAIgPQmmgN8RDTb8DwRWgUJjbH5T_ovagitCiblsbEQefL8CIC4naNeG_sGC-J3Ac2zYI-cGMeM5XQ8pb74xvc1aq2Um&lsparams=mm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AHylml4wRgIhALcf8fgbMHZ_ebl0keSWLXdGwbKOeolWT1NmTagGJaEpAiEA_cy6qyLGUyNB-_XtqqWr9ThyOPuWwRKwbhGl25Z7MTM%3D&ratebypass=yes'
[download] Destination: Diana & Christmas presents for Princesses-GkH39-TZL8Q.f137.mp4
[download] 100% of 315.84MiB in 03:42
[debug] Invoking downloader on u'https://r1---sn-ci5gup-h55z.googlevideo.com/videoplayback?expire=1578076529&ei=EDUPXqmiO6TG1Aaj1zc&ip=182.65.121.133&id=o-AKxlvVFPwpf1oP63MAMzY5JW498AioQmaGqaewqk6HKJ&itag=251&source=youtube&requiressl=yes&mm=31%2C26&mn=sn-ci5gup-h55z%2Csn-cvh76nek&ms=au%2Conr&mv=m&mvi=0&pl=19&initcwndbps=747500&mime=audio%2Fwebm&gir=yes&clen=5705386&dur=343.181&lmt=1577934473323209&mt=1578054821&fvip=1&keepalive=yes&fexp=23842630%2C23860862&c=WEB&txp=6531432&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&sig=ALgxI2wwRQIhAO2mghmFz2fu8VxYB-H7_mjYU48J4c0r_IzpH7NxU5PGAiB5gK0DiVxKm3Fd7ueARNKu-nm9_x2TL0MSca2GN6Y6aA%3D%3D&lsparams=mm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AHylml4wRgIhALcf8fgbMHZ_ebl0keSWLXdGwbKOeolWT1NmTagGJaEpAiEA_cy6qyLGUyNB-_XtqqWr9ThyOPuWwRKwbhGl25Z7MTM%3D&ratebypass=yes'
[download] Destination: Diana & Christmas presents for Princesses-GkH39-TZL8Q.f251.webm
[download] 100% of 5.44MiB in 00:02
[ffmpeg] Merging formats into "Diana & Christmas presents for Princesses-GkH39-TZL8Q.mkv"
[debug] ffmpeg command line: ffmpeg -y -loglevel 'repeat+info' -i 'file:Diana & Christmas presents for Princesses-GkH39-TZL8Q.f137.mp4' -i 'file:Diana & Christmas presents for Princesses-GkH39-TZL8Q.f251.webm' -c copy -map '0:v:0' -map '1:a:0' 'file:Diana & Christmas presents for Princesses-GkH39-TZL8Q.temp.mkv'
Deleting original file Diana & Christmas presents for Princesses-GkH39-TZL8Q.f137.mp4 (pass -k to keep)
Deleting original file Diana & Christmas presents for Princesses-GkH39-TZL8Q.f251.webm (pass -k to keep)
[ffmpeg] Converting video from mkv to avi, Destination: Diana & Christmas presents for Princesses-GkH39-TZL8Q.avi
[debug] ffmpeg command line: ffmpeg -y -loglevel 'repeat+info' -i 'file:Diana & Christmas presents for Princesses-GkH39-TZL8Q.mkv' '-c:v' libxvid -vtag XVID 'file:Diana & Christmas presents for Princesses-GkH39-TZL8Q.avi'
Deleting original file Diana & Christmas presents for Princesses-GkH39-TZL8Q.mkv (pass -k to keep)
[exec] Executing command: echo 'Diana & Christmas presents for Princesses-GkH39-TZL8Q.avi'
Diana & Christmas presents for Princesses-GkH39-TZL8Q.avi

Execution with custom --config-location path downloads the file to youtube-dl default config path

$ youtube-dl --recode-video="avi" --config-location="~/.config/youtube-dl/config-video" https://www.youtube.com/watch?v=ZeU9W5WcGLk --verbose --exec 'echo {}'
[debug] System config: []
[debug] User config: [u'-x', u'--no-mtime', u'-o', u'~/audios/%(title)s.%(ext)s']
[debug] Custom config: []
[debug] Command-line args: [u'--recode-video=avi', u'--config-location=~/.config/youtube-dl/config-video', u'https://www.youtube.com/watch?v=ZeU9W5WcGLk', u'--verbose', u'--exec', u'echo {}']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2020.01.01
[debug] Python version 2.7.17 (CPython) - Linux-5.3.0-26-generic-x86_64-with-Ubuntu-19.10-eoan
[debug] exe versions: avconv 12.3, avprobe 12.3, ffmpeg 4.1.4-1build2, ffprobe 4.1.4-1build2, phantomjs 2.1.1, rtmpdump 2.4
[debug] Proxy map: {}
[youtube] ZeU9W5WcGLk: Downloading webpage
[youtube] ZeU9W5WcGLk: Downloading video info webpage
[debug] Invoking downloader on u'https://r7---sn-ci5gup-h55z.googlevideo.com/videoplayback?expire=1578078115&ei=QzsPXpW3GIzhigTUmbigBw&ip=182.65.121.133&id=o-AE9zUhUSG83Jnz7MemwNYKhs-QgjbGLDd8olF1H9iiCQ&itag=251&source=youtube&requiressl=yes&mm=31%2C26&mn=sn-ci5gup-h55z%2Csn-cvh7knes&ms=au%2Conr&mv=m&mvi=6&pl=19&initcwndbps=747500&mime=audio%2Fwebm&gir=yes&clen=1575140&dur=92.341&lmt=1535067134215528&mt=1578056384&fvip=6&keepalive=yes&fexp=23842630&c=WEB&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&sig=ALgxI2wwRAIgA6zUWssGgDtp5DC5JWeqPxc22x-2tX8y-XThLP5zgrQCIHpmO-HXS1RHiuxfELD6FUTsYAluALsXPlxr18goCS2h&lsparams=mm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AHylml4wRAIgMvp8IFsYE8eZv4IuJ0fv6OTUiD8XZ2ASkmanl0NPlKYCIDR17BvbRsPa-yvvPAmbnesq33MJs7bdBas5Z4kx0lXK&ratebypass=yes'
[download] Destination: /home/xyz/audios/Roma and Diana hid in the magical refrigerator.webm
[download] 100% of 1.50MiB in 00:01
[debug] ffmpeg command line: ffprobe -show_streams 'file:/home/xyz/audios/Roma and Diana hid in the magical refrigerator.webm'
[ffmpeg] Destination: /home/xyz/audios/Roma and Diana hid in the magical refrigerator.opus
[debug] ffmpeg command line: ffmpeg -y -loglevel 'repeat+info' -i 'file:/home/xyz/audios/Roma and Diana hid in the magical refrigerator.webm' -vn -acodec copy 'file:/home/xyz/audios/Roma and Diana hid in the magical refrigerator.opus'
Deleting original file /home/xyz/audios/Roma and Diana hid in the magical refrigerator.webm (pass -k to keep)
[ffmpeg] Converting video from opus to avi, Destination: /home/xyz/audios/Roma and Diana hid in the magical refrigerator.avi
[debug] ffmpeg command line: ffmpeg -y -loglevel 'repeat+info' -i 'file:/home/xyz/audios/Roma and Diana hid in the magical refrigerator.opus' '-c:v' libxvid -vtag XVID 'file:/home/xyz/audios/Roma and Diana hid in the magical refrigerator.avi'
Deleting original file /home/xyz/audios/Roma and Diana hid in the magical refrigerator.opus (pass -k to keep)
[exec] Executing command: echo '/home/xyz/audios/Roma and Diana hid in the magical refrigerator.avi'
/home/xyz/audios/Roma and Diana hid in the magical refrigerator.avi
@byteshiva byteshiva added the question label Jan 3, 2020
@byteshiva
Copy link
Author

@byteshiva byteshiva commented Jan 3, 2020

To make the download go in a different directory, I had to force configuration as arguments --ignore-config and specify -o "~/path/video path/"

My question is can I've multiple configuration files to execute youtube-dl.

Example

$ youtube-dl --recode-video="avi" --ignore-config -o "~/videos/%(title)s.%(ext)s" https://www.youtube.com/watch?v=ZeU9W5WcGLk --quiet --exec 'echo {}'
@dstftw
Copy link
Collaborator

@dstftw dstftw commented Jan 3, 2020

As clearly seen from the second log files are downloaded to ~/audios/%(title)s.%(ext)s that is clearly defined in your custom config meaning everything works as expected.

@dstftw dstftw closed this Jan 3, 2020
@dstftw dstftw added the invalid label Jan 3, 2020
@byteshiva
Copy link
Author

@byteshiva byteshiva commented Jan 3, 2020

As clearly seen from the second log files are downloaded to ~/audios/%(title)s.%(ext)s that is clearly defined in your custom config meaning everything works as expected.

Please note, In the second log, its not entertaining --config-location="~/.config/youtube-dl/config-video" configuration.

Also in a custom location, the output directory is -o ~/videos/%(title)s.%(ext)s but the log says its loading in audio's directory. But in reality, it's downloading the files in the current directory.

[exec] Executing command: echo '/home/xyz/audios/Roma and Diana hid in the magical refrigerator.avi'
/home/xyz/audios/Roma and Diana hid in the magical refrigerator.avi

If the default config is specified i.e, ~/.config/youtube-dl/config then it ignores output location -o "/location" that's in --config-location.

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Jan 3, 2020

But in reality, it's downloading the files in the current directory.

Wrong. It downloads to ~/audios/%(title)s.%(ext)s that is specified if ~/.config/youtube-dl/config-video.

If the default config is specified i.e, ~/.config/youtube-dl/config then it ignores output location -o "/location" that's in --config-location.

Wrong. It does not.

@byteshiva
Copy link
Author

@byteshiva byteshiva commented Jan 3, 2020

In the below configuration it clears says it needs to be downloaded in ~/videos, but as said earlier its picking up Default Config 2

Custom Config

$ cat ~/.config/youtube-dl/config-video
# Do not copy the mtime
--no-mtime

# Save all videos under video directory in your home directory
-o ~/videos/%(title)s.%(ext)s

Default Config 2

$ cat ~/.config/youtube-dl/config
# Lines starting with # are comments

# Always extract audio
-x

# Do not copy the mtime
--no-mtime

# Save all videos under Movies directory in your home directory
-o ~/audios/%(title)s.%(ext)s

But in reality, it's downloading the files in the current directory.

Wrong. It downloads to ~/audios/%(title)s.%(ext)s that is specified if ~/.config/youtube-dl/config-video.

If the default config is specified i.e, ~/.config/youtube-dl/config then it ignores output location -o "/location" that's in --config-location.

Wrong. It does not.

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Jan 3, 2020

Once again:

$ cat ~/.config/youtube-dl/config-video 
-o '~/video/%(title)s.%(ext)s'
$ cat ~/.config/youtube-dl/config
-o '~/default/%(title)s.%(ext)s'
$ youtube-dl -v --config-location '~/.config/youtube-dl/config-video' BaW_jenozKc
[debug] System config: []
[debug] User config: []
[debug] Custom config: ['-o', '~/video/%(title)s.%(ext)s']
[debug] Command-line args: ['-v', '--config-location', '~/.config/youtube-dl/config-video', 'BaW_jenozKc']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2020.01.01
[debug] Python version 3.6.5 (CPython) - Linux-4.16.3-1-ARCH-x86_64-with-arch
[debug] exe versions: ffmpeg 3.4.2, ffprobe 3.4.2, phantomjs 2.1.1, rtmpdump 2.4
[debug] Proxy map: {}
[youtube] BaW_jenozKc: Downloading webpage
[youtube] BaW_jenozKc: Downloading video info webpage
[debug] Default format spec: bestvideo+bestaudio/best
[debug] Invoking downloader on '...'
[download] Destination: /home/dst/video/youtube-dl test video ''_ä↭𝕐.f137.mp4
[download] 100% of 2.11MiB in 00:00
[debug] Invoking downloader on '...'
[download] Destination: /home/dst/video/youtube-dl test video ''_ä↭𝕐.f140.m4a
[download] 100% of 154.06KiB in 00:00
[ffmpeg] Merging formats into "/home/dst/video/youtube-dl test video ''_ä↭𝕐.mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:/home/dst/video/youtube-dl test video '"'"''"'"'_ä↭𝕐.f137.mp4' -i 'file:/home/dst/video/youtube-dl test 
video '"'"''"'"'_ä↭𝕐.f140.m4a' -c copy -map 0:v:0 -map 1:a:0 'file:/home/dst/video/youtube-dl test video '"'"''"'"'_ä↭𝕐.temp.mp4'
Deleting original file /home/dst/video/youtube-dl test video ''_ä↭𝕐.f137.mp4 (pass -k to keep)
Deleting original file /home/dst/video/youtube-dl test video ''_ä↭𝕐.f140.m4a (pass -k to keep)

Destination: /home/dst/video/

@ytdl-org ytdl-org locked and limited conversation to collaborators Jan 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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.