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

--exec fails on Windows if the video title has a special character #13407

Closed
richardg867 opened this issue Jun 16, 2017 · 0 comments
Closed

--exec fails on Windows if the video title has a special character #13407

richardg867 opened this issue Jun 16, 2017 · 0 comments

Comments

@richardg867
Copy link

@richardg867 richardg867 commented Jun 16, 2017

  • I've verified and I assure that I'm running youtube-dl 2017.06.12
  • 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)

> youtube-dl -v --exec "ffplay -i {}" http://www.youtube.com/watch?v=9fL5iWgWwno
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'--exec', u'ffplay -i {}', u'http://www.youtube.com/watch?v=9fL5iWgWwno']
[debug] Encodings: locale cp1252, fs mbcs, out cp850, pref cp1252
[debug] youtube-dl version 2017.06.12
[debug] Python version 2.7.13 - Windows-7-6.1.7601-SP1
[debug] exe versions: ffmpeg N-82889-g54931fd, ffprobe N-82889-g54931fd
[debug] Proxy map: {}
[youtube] 9fL5iWgWwno: Downloading webpage
[youtube] 9fL5iWgWwno: Downloading video info webpage
[youtube] 9fL5iWgWwno: Extracting video information
[youtube] {22} signature length 42.43, html5 player vflLxaaub
[youtube] {43} signature length 42.43, html5 player vflLxaaub
[youtube] {18} signature length 42.43, html5 player vflLxaaub
[youtube] {36} signature length 42.43, html5 player vflLxaaub
[youtube] {17} signature length 42.43, html5 player vflLxaaub
[youtube] {137} signature length 42.43, html5 player vflLxaaub
[youtube] {248} signature length 42.43, html5 player vflLxaaub
[youtube] {136} signature length 42.43, html5 player vflLxaaub
[youtube] {247} signature length 42.43, html5 player vflLxaaub
[youtube] {135} signature length 42.43, html5 player vflLxaaub
[youtube] {244} signature length 42.43, html5 player vflLxaaub
[youtube] {134} signature length 42.43, html5 player vflLxaaub
[youtube] {243} signature length 42.43, html5 player vflLxaaub
[youtube] {133} signature length 42.43, html5 player vflLxaaub
[youtube] {242} signature length 42.43, html5 player vflLxaaub
[youtube] {160} signature length 42.43, html5 player vflLxaaub
[youtube] {278} signature length 42.43, html5 player vflLxaaub
[youtube] {140} signature length 42.43, html5 player vflLxaaub
[youtube] {171} signature length 42.43, html5 player vflLxaaub
[youtube] {249} signature length 42.43, html5 player vflLxaaub
[youtube] {250} signature length 42.43, html5 player vflLxaaub
[youtube] {251} signature length 42.43, html5 player vflLxaaub
[youtube] 9fL5iWgWwno: Downloading MPD manifest
WARNING: Requested formats are incompatible for merge and will be merged into mkv.
[debug] Invoking downloader on u'https://r3---sn-oxunxg8pjvn-bpbe.googlevideo.com/videoplayback?id=f5f2f9896816c27a&itag=137&source=youtube&requiressl=yes&initcwndbps=695000&ei=vxJEWY-uG5Ta-AWshqywDg&mv=m&mm=31&ms=au&pl=22&mn=sn-oxunxg8pjvn-bpbe&pcm2cms=yes&ratebypass=yes&mime=video/mp4&gir=yes&clen=97789658&lmt=1458191576575104&dur=188.960&signature=1A628A56E535DB40A69804E97970DA2D95633B72.502A17075C6D14E67FC5CAEACF7EE833DDCF53C6&mt=1497633364&key=dg_yt0&ip=201.37.254.10&ipbits=0&expire=1497655071&sparams=ip,ipbits,expire,id,itag,source,requiressl,initcwndbps,ei,mv,mm,ms,pl,mn,pcm2cms,ratebypass,mime,gir,clen,lmt,dur'
[download] Destination: David Guetta - What I Did For Love (Lyric Video) ft Emeli Sandé-9fL5iWgWwno.f137.mp4
[download] 100% of 93.26MiB in 00:50
[debug] Invoking downloader on u'https://r3---sn-oxunxg8pjvn-bpbe.googlevideo.com/videoplayback?gir=yes&clen=3145355&ms=au&ei=vhJEWa_EMIb2-AXuv6c4&pl=22&mv=m&mt=1497633364&mn=sn-oxunxg8pjvn-bpbe&mm=31&key=yt6&dur=189.009&pcm2cms=yes&source=youtube&id=o-AKYv5fnzuXlB9XGqrge3F0OxpCN51SfotZcmbtNGVyw4&requiressl=yes&lmt=1449649982728386&itag=171&keepalive=yes&ip=201.37.254.10&expire=1497655070&ipbits=0&initcwndbps=695000&sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpcm2cms%2Cpl%2Crequiressl%2Csource%2Cexpire&mime=audio%2Fwebm&signature=DFDA2550667AAFC71BBE95697A16F1EC1E926466.34796726692E7F75E4DCE0EE4132B3A90F3F2525&ratebypass=yes'
[download] Destination: David Guetta - What I Did For Love (Lyric Video) ft Emeli Sandé-9fL5iWgWwno.f171.webm
[download] 100% of 3.00MiB in 00:01
[ffmpeg] Merging formats into "David Guetta - What I Did For Love (Lyric Video) ft Emeli Sandé-9fL5iWgWwno.mkv"
[debug] ffmpeg command line: ffmpeg -y -i 'file:David Guetta - What I Did For Love (Lyric Video) ft Emeli Sandé-9fL5iWgWwno.f137.mp4' -i 'file:David Guetta - What I Did For Love (Lyric Video) ft Emeli Sandé-9fL5iWgWwno.f171.webm' -c copy -map 0:v:0 -map 1:a:0 'file:David Guetta - What I Did For Love (Lyric Video) ft Emeli Sandé-9fL5iWgWwno.temp.mkv'
Deleting original file David Guetta - What I Did For Love (Lyric Video) ft Emeli Sandé-9fL5iWgWwno.f137.mp4 (pass -k to keep)
Deleting original file David Guetta - What I Did For Love (Lyric Video) ft Emeli Sandé-9fL5iWgWwno.f171.webm (pass -k to keep)
[exec] Executing command: ffplay -i 'David Guetta - What I Did For Love (Lyric Video) ft Emeli Sandé-9fL5iWgWwno.mkv'
Traceback (most recent call last):
  File "c:\python27\lib\runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "c:\python27\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "C:\Python27\Scripts\youtube-dl.exe\__main__.py", line 9, in <module>
  File "c:\python27\lib\site-packages\youtube_dl\__init__.py", line 465, in main
    _real_main(argv)
  File "c:\python27\lib\site-packages\youtube_dl\__init__.py", line 455, in _real_main
    retcode = ydl.download(all_urls)
  File "c:\python27\lib\site-packages\youtube_dl\YoutubeDL.py", line 1919, in download
    url, force_generic_extractor=self.params.get('force_generic_extractor', False))
  File "c:\python27\lib\site-packages\youtube_dl\YoutubeDL.py", line 773, in extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "c:\python27\lib\site-packages\youtube_dl\YoutubeDL.py", line 827, in process_ie_result
    return self.process_video_result(ie_result, download=download)
  File "c:\python27\lib\site-packages\youtube_dl\YoutubeDL.py", line 1562, in process_video_result
    self.process_info(new_info)
  File "c:\python27\lib\site-packages\youtube_dl\YoutubeDL.py", line 1900, in process_info
    self.post_process(filename, info_dict)
  File "c:\python27\lib\site-packages\youtube_dl\YoutubeDL.py", line 1965, in post_process
    files_to_delete, info = pp.run(info)
  File "c:\python27\lib\site-packages\youtube_dl\postprocessor\execafterdownload.py", line 23, in run
    retCode = subprocess.call(cmd, shell=True)
  File "c:\python27\lib\subprocess.py", line 168, in call
    return Popen(*popenargs, **kwargs).wait()
  File "c:\python27\lib\subprocess.py", line 390, in __init__
    errread, errwrite)
  File "c:\python27\lib\subprocess.py", line 610, in _execute_child
    args = '{} /c "{}"'.format (comspec, args)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 73: ordinal not in range(128)

Description of your issue, suggested solution and other information

On Windows, the --exec option causes an encoding error if used on videos with special characters in the title (in this case, the offending character is é in David Guetta - What I Did For Love (Lyric Video) ft Emeli Sandé). Note that this issue is not the only blocker for --exec on Windows, see #5889, although a fix for #5889 is not required in order to reproduce this particular issue.

A suggested solution would be encoding the filename according to the detected filesystem encoding. My personal hack-workaround encodes the resulting command in the mbcs encoding which Windows uses, apart from also fixing the quoting issue from #5889.

@dstftw dstftw closed this in 8b6ac49 Jun 17, 2017
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
1 participant
You can’t perform that action at this time.