UnicodeDecodeError; downloads OK, can't mux #3558

Closed
opened 2026-02-20 23:25:59 -05:00 by deekerman · 4 comments
Owner

Originally created by @sdsucks on GitHub (Nov 30, 2014).

last working version is 2014.11.26

E:\>youtube-dl -v -w -c -i -f 266+141 -o "%(title)s by %(uploader)s.%(ext)s" https://www.youtube.com
/watch?v=D91Yb92L5Gk
[debug] System config: []
[debug] User config: []
[debug] Command-line args: ['-v', '-w', '-c', '-i', '-f', '266+141', '-o', '%(title)s by %(uploader)
s.%(ext)s', 'https://www.youtube.com/watch?v=D91Yb92L5Gk']
[debug] Encodings: locale cp949, fs mbcs, out cp949, pref cp949
[debug] youtube-dl version 2014.11.27
[debug] Python version 2.7.8 - Windows-7-6.1.7601-SP1
[debug] exe versions: ffmpeg N-68114-
[debug] Proxy map: {}
[youtube] Confirming age
[youtube] D91Yb92L5Gk: Downloading webpage
[youtube] D91Yb92L5Gk: Downloading video info webpage
[youtube] D91Yb92L5Gk: Extracting video information
[youtube] D91Yb92L5Gk: Downloading DASH manifest
[debug] Invoking downloader on 'https://r5---sn-3u-bh2l.googlevideo.com/videoplayback?id=0fdd586fdd8
be469&itag=266&source=youtube&requiressl=yes&mm=31&mv=m&ms=au&ratebypass=yes&mime=video/mp4&gir=yes&
clen=161184315&lmt=1417349445709006&dur=105.133&upn=v8d-WxvWnYE&signature=7DC3F8F1895E64E5A3B7086EA2
D770D9864CB828.086F5D0AC15EBFF9916D6BF2A49769EDF24400DA&fexp=907259,922247,927622,931355,932404,9410
03,941004,943909,947209,948124,948703,952302,952605,952901,953912,957103,957105,957201&sver=3&key=dg
_yt0&mt=1417352047&ip=xxx.xxx.xxx.xxx&ipbits=0&expire=1417373664&sparams=ip,ipbits,expire,id,itag,sou
rce,requiressl,mm,mv,ms,ratebypass,mime,gir,clen,lmt,dur'
[download] [직캠] 141130 롯데자이언츠 치어리더 김수현 공연 3of3 Lotte Giants Cheer Performance [롯데
월드] by drighk by drighk.f266.mp4 has already been downloaded
[debug] Invoking downloader on 'https://r5---sn-3u-bh2l.googlevideo.com/videoplayback?id=0fdd586fdd8
be469&itag=141&source=youtube&requiressl=yes&mm=31&mv=m&ms=au&ratebypass=yes&mime=audio/mp4&gir=yes&
clen=3354647&lmt=1417349181143518&dur=105.186&upn=v8d-WxvWnYE&signature=27849E50F209754A0EC1E49E6E6C
34C3975F0423.8A3D7738501921A02F3A5BB6C7AAB85AA958FE63&fexp=907259,922247,927622,931355,932404,941003
,941004,943909,947209,948124,948703,952302,952605,952901,953912,957103,957105,957201&sver=3&key=dg_y
t0&mt=1417352047&ip=xxx.xxx.xxx.xxx&ipbits=0&expire=1417373664&sparams=ip,ipbits,expire,id,itag,sourc
e,requiressl,mm,mv,ms,ratebypass,mime,gir,clen,lmt,dur'
[download] [직캠] 141130 롯데자이언츠 치어리더 김수현 공연 3of3 Lotte Giants Cheer Performance [롯데
월드] by drighk by drighk.f141.m4a has already been downloaded
[ffmpeg] Merging formats into "[직캠] 141130 롯데자이언츠 치어리더 김수현 공연 3of3 Lotte Giants Che
er Performance [롯데월드] by drighk by drighk.mp4"
[debug] ffmpeg command line: ffmpeg -y -i '[직캠] 141130 롯데자이언츠 치어리더 김수현 공연 3of3 Lott
e Giants Cheer Performance [롯데월드] by drighk by drighk.f266.mp4' -i '[직캠] 141130 롯데자이언츠
치어리더 김수현 공연 3of3 Lotte Giants Cheer Performance [롯데월드] by drighk by drighk.f141.m4a' -c
 copy -map 0:v:0 -map 1:a:0 -shortest '[직캠] 141130 롯데자이언츠 치어리더 김수현 공연 3of3 Lotte Gi
ants Cheer Performance [롯데월드] by drighk by drighk.mp4'
ERROR: 'ascii' codec can't decode byte 0xc1 in position 0: ordinal not in range(128)
Traceback (most recent call last):
  File "youtube_dl\YoutubeDL.pyo", line 564, in extract_info
  File "youtube_dl\YoutubeDL.pyo", line 610, in process_ie_result
  File "youtube_dl\YoutubeDL.pyo", line 893, in process_video_result
  File "youtube_dl\YoutubeDL.pyo", line 1099, in process_info
  File "youtube_dl\YoutubeDL.pyo", line 1154, in post_process
  File "youtube_dl\postprocessor\ffmpeg.pyo", line 525, in run
  File "youtube_dl\postprocessor\ffmpeg.pyo", line 90, in run_ffmpeg_multiple_files
  File "subprocess.pyo", line 710, in __init__
  File "subprocess.pyo", line 913, in _execute_child
  File "subprocess.pyo", line 644, in list2cmdline
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc1 in position 0: ordinal not in range(128)
Originally created by @sdsucks on GitHub (Nov 30, 2014). last working version is 2014.11.26 ``` E:\>youtube-dl -v -w -c -i -f 266+141 -o "%(title)s by %(uploader)s.%(ext)s" https://www.youtube.com /watch?v=D91Yb92L5Gk [debug] System config: [] [debug] User config: [] [debug] Command-line args: ['-v', '-w', '-c', '-i', '-f', '266+141', '-o', '%(title)s by %(uploader) s.%(ext)s', 'https://www.youtube.com/watch?v=D91Yb92L5Gk'] [debug] Encodings: locale cp949, fs mbcs, out cp949, pref cp949 [debug] youtube-dl version 2014.11.27 [debug] Python version 2.7.8 - Windows-7-6.1.7601-SP1 [debug] exe versions: ffmpeg N-68114- [debug] Proxy map: {} [youtube] Confirming age [youtube] D91Yb92L5Gk: Downloading webpage [youtube] D91Yb92L5Gk: Downloading video info webpage [youtube] D91Yb92L5Gk: Extracting video information [youtube] D91Yb92L5Gk: Downloading DASH manifest [debug] Invoking downloader on 'https://r5---sn-3u-bh2l.googlevideo.com/videoplayback?id=0fdd586fdd8 be469&itag=266&source=youtube&requiressl=yes&mm=31&mv=m&ms=au&ratebypass=yes&mime=video/mp4&gir=yes& clen=161184315&lmt=1417349445709006&dur=105.133&upn=v8d-WxvWnYE&signature=7DC3F8F1895E64E5A3B7086EA2 D770D9864CB828.086F5D0AC15EBFF9916D6BF2A49769EDF24400DA&fexp=907259,922247,927622,931355,932404,9410 03,941004,943909,947209,948124,948703,952302,952605,952901,953912,957103,957105,957201&sver=3&key=dg _yt0&mt=1417352047&ip=xxx.xxx.xxx.xxx&ipbits=0&expire=1417373664&sparams=ip,ipbits,expire,id,itag,sou rce,requiressl,mm,mv,ms,ratebypass,mime,gir,clen,lmt,dur' [download] [직캠] 141130 롯데자이언츠 치어리더 김수현 공연 3of3 Lotte Giants Cheer Performance [롯데 월드] by drighk by drighk.f266.mp4 has already been downloaded [debug] Invoking downloader on 'https://r5---sn-3u-bh2l.googlevideo.com/videoplayback?id=0fdd586fdd8 be469&itag=141&source=youtube&requiressl=yes&mm=31&mv=m&ms=au&ratebypass=yes&mime=audio/mp4&gir=yes& clen=3354647&lmt=1417349181143518&dur=105.186&upn=v8d-WxvWnYE&signature=27849E50F209754A0EC1E49E6E6C 34C3975F0423.8A3D7738501921A02F3A5BB6C7AAB85AA958FE63&fexp=907259,922247,927622,931355,932404,941003 ,941004,943909,947209,948124,948703,952302,952605,952901,953912,957103,957105,957201&sver=3&key=dg_y t0&mt=1417352047&ip=xxx.xxx.xxx.xxx&ipbits=0&expire=1417373664&sparams=ip,ipbits,expire,id,itag,sourc e,requiressl,mm,mv,ms,ratebypass,mime,gir,clen,lmt,dur' [download] [직캠] 141130 롯데자이언츠 치어리더 김수현 공연 3of3 Lotte Giants Cheer Performance [롯데 월드] by drighk by drighk.f141.m4a has already been downloaded [ffmpeg] Merging formats into "[직캠] 141130 롯데자이언츠 치어리더 김수현 공연 3of3 Lotte Giants Che er Performance [롯데월드] by drighk by drighk.mp4" [debug] ffmpeg command line: ffmpeg -y -i '[직캠] 141130 롯데자이언츠 치어리더 김수현 공연 3of3 Lott e Giants Cheer Performance [롯데월드] by drighk by drighk.f266.mp4' -i '[직캠] 141130 롯데자이언츠 치어리더 김수현 공연 3of3 Lotte Giants Cheer Performance [롯데월드] by drighk by drighk.f141.m4a' -c copy -map 0:v:0 -map 1:a:0 -shortest '[직캠] 141130 롯데자이언츠 치어리더 김수현 공연 3of3 Lotte Gi ants Cheer Performance [롯데월드] by drighk by drighk.mp4' ERROR: 'ascii' codec can't decode byte 0xc1 in position 0: ordinal not in range(128) Traceback (most recent call last): File "youtube_dl\YoutubeDL.pyo", line 564, in extract_info File "youtube_dl\YoutubeDL.pyo", line 610, in process_ie_result File "youtube_dl\YoutubeDL.pyo", line 893, in process_video_result File "youtube_dl\YoutubeDL.pyo", line 1099, in process_info File "youtube_dl\YoutubeDL.pyo", line 1154, in post_process File "youtube_dl\postprocessor\ffmpeg.pyo", line 525, in run File "youtube_dl\postprocessor\ffmpeg.pyo", line 90, in run_ffmpeg_multiple_files File "subprocess.pyo", line 710, in __init__ File "subprocess.pyo", line 913, in _execute_child File "subprocess.pyo", line 644, in list2cmdline UnicodeDecodeError: 'ascii' codec can't decode byte 0xc1 in position 0: ordinal not in range(128) ```
Author
Owner

@arairait commented on GitHub (Dec 12, 2014):

I'm not familiar with python but I think it's because of mixed encoding in arguments passed to subprocess.Popen().
Then this quick dirty hack might work:

--- ffmpeg.py.old Sat Dec 13 10:09:45 2014
+++ ffmpeg.py.new Sat Dec 13 10:04:12 2014
@@ -80,8 +80,8 @@

         files_cmd = []
         for path in input_paths:
-            files_cmd.extend(['-i', encodeFilename(path, True)])
-        cmd = ([self._executable, '-y'] + files_cmd
+            files_cmd.extend([encodeArgument('-i'), encodeFilename(path, True)])
+        cmd = ([encodeArgument(self._executable), encodeArgument('-y')] + files_cmd
                + [encodeArgument(o) for o in opts] +
                [encodeFilename(self._ffmpeg_filename_argument(out_path), True)])

I know there should be more polite and simple way.

@arairait commented on GitHub (Dec 12, 2014): I'm not familiar with python but I think it's because of mixed encoding in arguments passed to subprocess.Popen(). Then this quick dirty hack might work: --- ffmpeg.py.old Sat Dec 13 10:09:45 2014 +++ ffmpeg.py.new Sat Dec 13 10:04:12 2014 @@ -80,8 +80,8 @@ ``` python files_cmd = [] for path in input_paths: - files_cmd.extend(['-i', encodeFilename(path, True)]) - cmd = ([self._executable, '-y'] + files_cmd + files_cmd.extend([encodeArgument('-i'), encodeFilename(path, True)]) + cmd = ([encodeArgument(self._executable), encodeArgument('-y')] + files_cmd + [encodeArgument(o) for o in opts] + [encodeFilename(self._ffmpeg_filename_argument(out_path), True)]) ``` I know there should be more polite and simple way.
Author
Owner

@imjacklai commented on GitHub (Jan 9, 2015):

I have the same error when download video with Chinese title, such as
https://www.youtube.com/watch?v=qX2GsMj7154
And the way that @arairait provided is not work.

C:\Users\user\Desktop>youtube-dl -x --audio-format mp3 --verbose https://www.youtube.com/watch?v=qX2GsMj7154
[debug] System config: []
[debug] User config: []
[debug] Command-line args: ['-x', '--audio-format', 'mp3', '--verbose', 'https://www.youtube.com/watch?v=qX2GsMj7154']
[debug] Encodings: locale cp950, fs mbcs, out cp950, pref cp950
[debug] youtube-dl version 2015.01.04
[debug] Python version 2.7.8 - Windows-8-6.2.9200
[debug] exe versions: ffmpeg N-68881-ga79ac73, ffprobe N-68881-ga79ac73
[debug] Proxy map: {}
[youtube] qX2GsMj7154: Downloading webpage
[youtube] qX2GsMj7154: Extracting video information
[youtube] qX2GsMj7154: Downloading DASH manifest
[debug] Invoking downloader on 'https://r1---sn-ipoxu-un5l.googlevideo.com/videoplayback?id=a97d86b0c8fbd79e&itag=141&source=youtube&requiressl=yes&ms=au&mv=m&mm=31&ratebypass=yes&mime=audio/mp4&gir=yes&clen=12277051&lmt=1385545912413196&dur=385.056&mt=1420811894&upn=jck_SAvYaRs&sver=3&key=dg_yt0&fexp=900718,922243,923348,924638,927622,932404,9405713,941004,943917,947209,947218,948124,952302,952605,952901,955301,957103,957105,957201,958600,959701,962701&signature=1F795CCD30D8617BE51913A27F51773DA104DD04.370A1D643C771ED0B077BE9EDDC007FC298577FC&ip=1.163.213.143&ipbits=0&expire=1420833526&sparams=ip,ipbits,expire,id,itag,source,requiressl,ms,mv,mm,ratebypass,mime,gir,clen,lmt,dur'
[download] Destination: Mayday五月天【乾杯Cheers】MV官方完整版-qX2GsMj7154.m4a
[download] 100% of 11.71MiB in 00:33
Traceback (most recent call last):
  File "__main__.py", line 19, in <module>
  File "youtube_dl\__init__.pyo", line 361, in main
  File "youtube_dl\__init__.pyo", line 351, in _real_main
  File "youtube_dl\YoutubeDL.pyo", line 1165, in download
  File "youtube_dl\YoutubeDL.pyo", line 603, in extract_info
  File "youtube_dl\YoutubeDL.pyo", line 649, in process_ie_result
  File "youtube_dl\YoutubeDL.pyo", line 938, in process_video_result
  File "youtube_dl\YoutubeDL.pyo", line 1148, in process_info
  File "youtube_dl\YoutubeDL.pyo", line 1202, in post_process
  File "youtube_dl\postprocessor\ffmpeg.pyo", line 156, in run
  File "youtube_dl\postprocessor\ffmpeg.pyo", line 128, in get_audio_codec
  File "subprocess.pyo", line 710, in __init__
  File "subprocess.pyo", line 913, in _execute_child
  File "subprocess.pyo", line 644, in list2cmdline
UnicodeDecodeError: 'ascii' codec can't decode byte 0xa4 in position 0: ordinal not in range(128)
@imjacklai commented on GitHub (Jan 9, 2015): I have the same error when download video with Chinese title, such as https://www.youtube.com/watch?v=qX2GsMj7154 And the way that @arairait provided is not work. ``` C:\Users\user\Desktop>youtube-dl -x --audio-format mp3 --verbose https://www.youtube.com/watch?v=qX2GsMj7154 [debug] System config: [] [debug] User config: [] [debug] Command-line args: ['-x', '--audio-format', 'mp3', '--verbose', 'https://www.youtube.com/watch?v=qX2GsMj7154'] [debug] Encodings: locale cp950, fs mbcs, out cp950, pref cp950 [debug] youtube-dl version 2015.01.04 [debug] Python version 2.7.8 - Windows-8-6.2.9200 [debug] exe versions: ffmpeg N-68881-ga79ac73, ffprobe N-68881-ga79ac73 [debug] Proxy map: {} [youtube] qX2GsMj7154: Downloading webpage [youtube] qX2GsMj7154: Extracting video information [youtube] qX2GsMj7154: Downloading DASH manifest [debug] Invoking downloader on 'https://r1---sn-ipoxu-un5l.googlevideo.com/videoplayback?id=a97d86b0c8fbd79e&itag=141&source=youtube&requiressl=yes&ms=au&mv=m&mm=31&ratebypass=yes&mime=audio/mp4&gir=yes&clen=12277051&lmt=1385545912413196&dur=385.056&mt=1420811894&upn=jck_SAvYaRs&sver=3&key=dg_yt0&fexp=900718,922243,923348,924638,927622,932404,9405713,941004,943917,947209,947218,948124,952302,952605,952901,955301,957103,957105,957201,958600,959701,962701&signature=1F795CCD30D8617BE51913A27F51773DA104DD04.370A1D643C771ED0B077BE9EDDC007FC298577FC&ip=1.163.213.143&ipbits=0&expire=1420833526&sparams=ip,ipbits,expire,id,itag,source,requiressl,ms,mv,mm,ratebypass,mime,gir,clen,lmt,dur' [download] Destination: Mayday五月天【乾杯Cheers】MV官方完整版-qX2GsMj7154.m4a [download] 100% of 11.71MiB in 00:33 Traceback (most recent call last): File "__main__.py", line 19, in <module> File "youtube_dl\__init__.pyo", line 361, in main File "youtube_dl\__init__.pyo", line 351, in _real_main File "youtube_dl\YoutubeDL.pyo", line 1165, in download File "youtube_dl\YoutubeDL.pyo", line 603, in extract_info File "youtube_dl\YoutubeDL.pyo", line 649, in process_ie_result File "youtube_dl\YoutubeDL.pyo", line 938, in process_video_result File "youtube_dl\YoutubeDL.pyo", line 1148, in process_info File "youtube_dl\YoutubeDL.pyo", line 1202, in post_process File "youtube_dl\postprocessor\ffmpeg.pyo", line 156, in run File "youtube_dl\postprocessor\ffmpeg.pyo", line 128, in get_audio_codec File "subprocess.pyo", line 710, in __init__ File "subprocess.pyo", line 913, in _execute_child File "subprocess.pyo", line 644, in list2cmdline UnicodeDecodeError: 'ascii' codec can't decode byte 0xa4 in position 0: ordinal not in range(128) ```
Author
Owner

@arairait commented on GitHub (Jan 9, 2015):

@imjacklai
There is another subprocess.Popen(). Try this.

diff --git a/youtube_dl/postprocessor/ffmpeg.py b/youtube_dl/postprocessor/ffmpeg.py
index 97db879..66dfab7 100644
--- a/youtube_dl/postprocessor/ffmpeg.py
+++ b/youtube_dl/postprocessor/ffmpeg.py
@@ -122,8 +122,8 @@ class FFmpegExtractAudioPP(FFmpegPostProcessor):

             raise PostProcessingError('ffprobe or avprobe not found. Please install one.')
         try:
             cmd = [
-                self._probe_executable,
-                '-show_streams',
+                encodeFilename(self._probe_executable, True),
+                encodeArgument('-show_streams'),
                 encodeFilename(self._ffmpeg_filename_argument(path), True)]
             handle = subprocess.Popen(cmd, stderr=compat_subprocess_get_DEVNULL(), stdout=subprocess.PIPE)
             output = handle.communicate()[0]
@arairait commented on GitHub (Jan 9, 2015): @imjacklai There is another subprocess.Popen(). Try this. diff --git a/youtube_dl/postprocessor/ffmpeg.py b/youtube_dl/postprocessor/ffmpeg.py index 97db879..66dfab7 100644 --- a/youtube_dl/postprocessor/ffmpeg.py +++ b/youtube_dl/postprocessor/ffmpeg.py @@ -122,8 +122,8 @@ class FFmpegExtractAudioPP(FFmpegPostProcessor): ``` python raise PostProcessingError('ffprobe or avprobe not found. Please install one.') try: cmd = [ - self._probe_executable, - '-show_streams', + encodeFilename(self._probe_executable, True), + encodeArgument('-show_streams'), encodeFilename(self._ffmpeg_filename_argument(path), True)] handle = subprocess.Popen(cmd, stderr=compat_subprocess_get_DEVNULL(), stdout=subprocess.PIPE) output = handle.communicate()[0] ```
Author
Owner

@phihag commented on GitHub (Jan 9, 2015):

Thank you for the report! I believe this issue to be fixed in youtube-dl 2015.01.09 and newer. See our FAQ if you need help updating.

@phihag commented on GitHub (Jan 9, 2015): Thank you for the report! I believe this issue to be fixed in youtube-dl 2015.01.09 and newer. See [our FAQ](https://yt-dl.org/update) if you need help updating.
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#3558
No description provided.