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

UnicodeEncodeError at the metadata writing step in youtube_dl/postprocessor/ffmpeg.py #15745

Closed
sebma opened this issue Mar 2, 2018 · 2 comments

Comments

@sebma
Copy link

@sebma sebma commented Mar 2, 2018

Please follow the guide below


Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2018.03.03. If it's not, read this FAQ entry and update. Issues with outdated version will be rejected.

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

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)
  • Site support request (request for adding support for a new site)
  • Feature request (request for a new functionality)
  • Question
  • Other

Hi,
This error occurs at the writing of the metadata (after the download is finished)
Here is the output of youtube-dl -v :

$ youtube-dl --ignore-config --restrict-filenames -v -f18 -o "%(title)s__%(format_id)s__%(id)s.%(ext)s" --prefer-ffmpeg --add-metadata https://www.youtube.com/watch?v=-eZxe8C6sao 
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['--ignore-config', '--restrict-filenames', '-v', '-f18', '-o', '%(title)s__%(format_id)s__%(id)s.%(ext)s', '--prefer-ffmpeg', '--add-metadata', 'https://www.youtube.com/watch?v=-eZxe8C6sao']
[debug] Encodings: locale ANSI_X3.4-1968, fs ascii, out ANSI_X3.4-1968, pref ANSI_X3.4-1968
[debug] youtube-dl version 2018.03.03
[debug] Python version 3.4.3 (CPython) - Linux-4.4.0-112-generic-x86_64-with-Ubuntu-14.04-trusty
[debug] exe versions: avconv 9.20-6, avprobe 9.20-6, ffmpeg 3.3.3, ffprobe 3.3.3, rtmpdump 2.4
[debug] Proxy map: {}
[youtube] -eZxe8C6sao: Downloading webpage
[youtube] -eZxe8C6sao: Downloading video info webpage
[youtube] -eZxe8C6sao: Extracting video information
[youtube] -eZxe8C6sao: Downloading MPD manifest
[youtube] -eZxe8C6sao: Downloading MPD manifest
[debug] Invoking downloader on 'https://r8---sn-oj-jqbe.googlevideo.com/videoplayback?expire=1520047465&ratebypass=yes&lmt=1519808650159516&requiressl=yes&gir=yes&mime=video%2Fmp4&fvip=2&ipbits=0&clen=444675776&source=youtube&signature=945ADBFE4E8371EFB1D5FC45062472E80BC7248E.A5D242ACB53B330F20D380164990BDADA1E0777C&c=WEB&key=yt6&ei=CcGZWoCPMYe2VPrpuYAE&sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cexpire&id=o-AApiVDtmv4DR04S7x8cKX1iNiZ1ZbpxDpDHTgEPdLY8W&mt=1520025764&mv=m&dur=6605.032&initcwndbps=1261250&itag=18&ms=au%2Crdu&ip=85.68.205.44&mm=31%2C29&mn=sn-oj-jqbe%2Csn-25ge7nld&pl=22'
[download] Joseph_Prince_2018_Are_You_Frustrating_The_Favor_Of_God__18__-eZxe8C6sao.mp4 has already been downloaded
[download] 100% of 424.08MiB
[ffmpeg] Adding metadata to 'Joseph_Prince_2018_Are_You_Frustrating_The_Favor_Of_God__18__-eZxe8C6sao.mp4'
[debug] ffmpeg command line: ffmpeg -y -i file:Joseph_Prince_2018_Are_You_Frustrating_The_Favor_Of_God__18__-eZxe8C6sao.mp4 -c copy -metadata date=20180228 -metadata artist=Benjamin -metadata 'comment=Joseph Prince 2018, Are You Frustrating The Favor Of God' -metadata 'purl=https://www.youtube.com/watch?v=-eZxe8C6sao' -metadata 'description=Joseph Prince 2018, Are You Frustrating The Favor Of God' -metadata 'title=Joseph Prince 2018, Are You Frustrating The Favor Of God' file:Joseph_Prince_2018_Are_You_Frustrating_The_Favor_Of_God__18__-eZxe8C6sao.temp.mp4
Traceback (most recent call last):
  File "/usr/local/bin/youtube-dl", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.4/dist-packages/youtube_dl/__init__.py", line 471, in main
    _real_main(argv)
  File "/usr/local/lib/python3.4/dist-packages/youtube_dl/__init__.py", line 461, in _real_main
    retcode = ydl.download(all_urls)
  File "/usr/local/lib/python3.4/dist-packages/youtube_dl/YoutubeDL.py", line 1989, in download
    url, force_generic_extractor=self.params.get('force_generic_extractor', False))
  File "/usr/local/lib/python3.4/dist-packages/youtube_dl/YoutubeDL.py", line 796, in extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "/usr/local/lib/python3.4/dist-packages/youtube_dl/YoutubeDL.py", line 850, in process_ie_result
    return self.process_video_result(ie_result, download=download)
  File "/usr/local/lib/python3.4/dist-packages/youtube_dl/YoutubeDL.py", line 1623, in process_video_result
    self.process_info(new_info)
  File "/usr/local/lib/python3.4/dist-packages/youtube_dl/YoutubeDL.py", line 1970, in process_info
    self.post_process(filename, info_dict)
  File "/usr/local/lib/python3.4/dist-packages/youtube_dl/YoutubeDL.py", line 2035, in post_process
    files_to_delete, info = pp.run(info)
  File "/usr/local/lib/python3.4/dist-packages/youtube_dl/postprocessor/ffmpeg.py", line 465, in run
    self.run_ffmpeg_multiple_files(in_filenames, temp_filename, options)
  File "/usr/local/lib/python3.4/dist-packages/youtube_dl/postprocessor/ffmpeg.py", line 199, in run_ffmpeg_multiple_files
    p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
  File "/usr/lib/python3.4/subprocess.py", line 859, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.4/subprocess.py", line 1395, in _execute_child
    restore_signals, start_new_session, preexec_fn)
UnicodeEncodeError: 'ascii' codec can't encode character '\u200b' in position 64: ordinal not in range(128)
$ echo $?
1

Can you help me ?

@sa7mon
Copy link
Contributor

@sa7mon sa7mon commented Mar 2, 2018

Worked just fine on my machine. I noticed in your output that your system encodings currently set to ANSI_X3.4-1968. Without going into how character encoding works, that's your problem. Set your system's default encoding to UTF-8 and run it again and it should work.

It looks like you're using Ubuntu so follow these instructions to switch to Unicode

@sebma
Copy link
Author

@sebma sebma commented Mar 4, 2018

@sa7mon I think you are right. It was a locale issue.

@sebma sebma closed this Mar 4, 2018
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
3 participants
You can’t perform that action at this time.