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

UnicodeDecodeError; downloads OK, can't mux #4337

Closed
sdsucks opened this issue Nov 30, 2014 · 4 comments
Closed

UnicodeDecodeError; downloads OK, can't mux #4337

sdsucks opened this issue Nov 30, 2014 · 4 comments

Comments

@sdsucks
Copy link

@sdsucks sdsucks commented 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)
@arairait
Copy link

@arairait arairait commented Dec 13, 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.

@imjacklai
Copy link

@imjacklai imjacklai commented 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)
@arairait
Copy link

@arairait arairait commented 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]
@phihag phihag closed this in b0e87c3 Jan 9, 2015
@phihag
Copy link
Contributor

@phihag phihag commented 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 phihag reopened this Jan 9, 2015
@phihag phihag closed this Jan 9, 2015
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
4 participants
You can’t perform that action at this time.