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

AssertionError + stacktrace downloading audio file #13182

Closed
kevinburke opened this issue May 21, 2017 · 4 comments
Closed

AssertionError + stacktrace downloading audio file #13182

kevinburke opened this issue May 21, 2017 · 4 comments

Comments

@kevinburke
Copy link

@kevinburke kevinburke commented May 21, 2017

Please follow the guide below

Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2017.05.18.1. 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 2017.05.18.1

Before submitting an issue make sure you have:

  • At least skimmed through README and most notably FAQ and BUGS sections
  • Searched the bugtracker for similar issues including closed ones: searched for 'compat_str AssertionError' and got no relevant results

What is the purpose of your issue?

  • Bug report (encountered problems with youtube-dl)

If the purpose of this issue is a bug report, site support request or you are not completely sure provide the full verbose output as follows:

Add -v flag to your command line you run youtube-dl with, copy the whole output and insert it here. It should look similar to one below (replace it with your log inserted between triple ```):

$ youtube-dl --verbose --add-metadata --format 140 https://www.youtube.com/watch\?v\=cMwTJ41lrs0
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'--verbose', u'--add-metadata', u'--format', u'140', u'https://www.youtube.com/watch?v=cMwTJ41lrs0']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2017.05.18.1
[debug] Python version 2.7.12 - Darwin-16.5.0-x86_64-i386-64bit
[debug] exe versions: ffmpeg 3.3.1, ffprobe 3.3.1
[debug] Proxy map: {}
[youtube] cMwTJ41lrs0: Downloading webpage
[youtube] cMwTJ41lrs0: Downloading video info webpage
[youtube] cMwTJ41lrs0: Extracting video information
[youtube] {22} signature length 43.40, html5 player vfl4Xq3l4
[youtube] {43} signature length 43.40, html5 player vfl4Xq3l4
[youtube] {18} signature length 43.40, html5 player vfl4Xq3l4
[youtube] {36} signature length 43.40, html5 player vfl4Xq3l4
[youtube] {17} signature length 43.40, html5 player vfl4Xq3l4
[youtube] {137} signature length 43.40, html5 player vfl4Xq3l4
[youtube] {248} signature length 43.40, html5 player vfl4Xq3l4
[youtube] {136} signature length 43.40, html5 player vfl4Xq3l4
[youtube] {247} signature length 43.38, html5 player vfl4Xq3l4
[youtube] {135} signature length 43.40, html5 player vfl4Xq3l4
[youtube] {244} signature length 43.40, html5 player vfl4Xq3l4
[youtube] {134} signature length 43.40, html5 player vfl4Xq3l4
[youtube] {243} signature length 43.40, html5 player vfl4Xq3l4
[youtube] {133} signature length 43.40, html5 player vfl4Xq3l4
[youtube] {242} signature length 43.40, html5 player vfl4Xq3l4
[youtube] {160} signature length 43.40, html5 player vfl4Xq3l4
[youtube] {278} signature length 43.40, html5 player vfl4Xq3l4
[youtube] {140} signature length 43.40, html5 player vfl4Xq3l4
[youtube] {171} signature length 43.40, html5 player vfl4Xq3l4
[youtube] {249} signature length 43.40, html5 player vfl4Xq3l4
[youtube] {250} signature length 43.40, html5 player vfl4Xq3l4
[youtube] {251} signature length 43.40, html5 player vfl4Xq3l4
[debug] Invoking downloader on u'https://r6---sn-n4v7sn7l.googlevideo.com/videoplayback?upn=xP_2L4YTky8&lmt=1488353256110102&clen=16174237&source=youtube&sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Crequiressl%2Csource%2Cupn%2Cexpire&keepalive=yes&id=o-AAMWdpPvN22L5ET-BxX8Dg3I9NmHwofy0cIQhgotpXJC&ip=24.5.181.200&key=yt6&mm=31&mn=sn-n4v7sn7l&ipbits=0&ms=au&mt=1495405880&gir=yes&initcwndbps=1697500&mv=m&requiressl=yes&pl=15&ei=lRUiWYzVNYet-wOttp-4BA&dur=1018.334&mime=audio%2Fmp4&itag=140&expire=1495427574&signature=CBD297EA2DA991BB1FAB4D1AFCA250003E232189.D70A840D7565F1FF852345DE3C54C68ED613D9A5&ratebypass=yes'
[download] Moonlight Soundtrack (2016) - Story of Little, Chiron & Black-cMwTJ41lrs0.m4a has already been downloaded
[download] 100% of 11.82MiB
[ffmpeg] Correcting container in "Moonlight Soundtrack (2016) - Story of Little, Chiron & Black-cMwTJ41lrs0.m4a"
[debug] ffmpeg command line: ffmpeg -y -i 'file:Moonlight Soundtrack (2016) - Story of Little, Chiron & Black-cMwTJ41lrs0.m4a' -c copy -f mp4 'file:Moonlight Soundtrack (2016) - Story of Little, Chiron & Black-cMwTJ41lrs0.temp.m4a'
[ffmpeg] Adding metadata to 'Moonlight Soundtrack (2016) - Story of Little, Chiron & Black-cMwTJ41lrs0.m4a'
Traceback (most recent call last):
  File "/Users/kevin/.pyenv/versions/pypy2-5.6.0/lib-python/2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/Users/kevin/.pyenv/versions/pypy2-5.6.0/lib-python/2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/local/bin/youtube-dl/__main__.py", line 19, in <module>
    youtube_dl.main()
  File "/usr/local/bin/youtube-dl/youtube_dl/__init__.py", line 465, in main
    _real_main(argv)
  File "/usr/local/bin/youtube-dl/youtube_dl/__init__.py", line 455, in _real_main
    retcode = ydl.download(all_urls)
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1896, in download
    url, force_generic_extractor=self.params.get('force_generic_extractor', False))
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 771, in extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 825, in process_ie_result
    return self.process_video_result(ie_result, download=download)
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1539, in process_video_result
    self.process_info(new_info)
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1877, in process_info
    self.post_process(filename, info_dict)
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1942, in post_process
    files_to_delete, info = pp.run(info)
  File "/usr/local/bin/youtube-dl/youtube_dl/postprocessor/ffmpeg.py", line 465, in run
    self.run_ffmpeg_multiple_files(in_filenames, temp_filename, options)
  File "/usr/local/bin/youtube-dl/youtube_dl/postprocessor/ffmpeg.py", line 182, in run_ffmpeg_multiple_files
    os.stat(encodeFilename(path)).st_mtime for path in input_paths)
  File "/usr/local/bin/youtube-dl/youtube_dl/postprocessor/ffmpeg.py", line 182, in <genexpr>
    os.stat(encodeFilename(path)).st_mtime for path in input_paths)
  File "/usr/local/bin/youtube-dl/youtube_dl/utils.py", line 615, in encodeFilename
    assert type(s) == compat_str
AssertionError
@kevinburke
Copy link
Author

@kevinburke kevinburke commented May 21, 2017

I can only reproduce the problem with that video - I tried several others, including other files with ampersands in the title, and did not get a stack trace.

@yan12125 yan12125 added the bug label May 22, 2017
@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented May 22, 2017

This fixes the issue for me:

diff --git a/youtube_dl/postprocessor/ffmpeg.py b/youtube_dl/postprocessor/ffmpeg.py
index c91ec8588..f021ea8fd 100644
--- a/youtube_dl/postprocessor/ffmpeg.py
+++ b/youtube_dl/postprocessor/ffmpeg.py
@@ -444,7 +444,7 @@ class FFmpegMetadataPP(FFmpegPostProcessor):
 
         chapters = info.get('chapters', [])
         if chapters:
-            metadata_filename = encodeFilename(replace_extension(filename, 'meta'))
+            metadata_filename = replace_extension(filename, 'meta')
             with io.open(metadata_filename, 'wt', encoding='utf-8') as f:
                 def ffmpeg_escape(text):
                     return re.sub(r'(=|;|#|\\|\n)', r'\\\1', text)

I'm not sure why encodeFilename is used here. ping @remitamine (fa2a36d)

@remitamine
Copy link
Collaborator

@remitamine remitamine commented May 22, 2017

I'm not sure why encodeFilename is used here.

as i saw most of the code in the project use encodeFilename whenever it deal with filenames, however in this case it's unnecessary as the function will be called again in run_ffmpeg_multiple_files(was'nt aware of that).

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented May 25, 2017

Got it. Fixed. Thanks all!

@yan12125 yan12125 closed this in 5192ee1 May 25, 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
3 participants
You can’t perform that action at this time.