ytdl-org / youtube-dl

Command-line program to download videos from YouTube.com and other video sites
http://ytdl-org.github.io/youtube-dl/
The Unlicense
131.37k stars 9.96k forks source link

FFmpegPostProcessorError: Cannot allocate memory #13247

Closed effleurager closed 7 years ago

effleurager commented 7 years ago

Before submitting an issue make sure you have:

What is the purpose of your issue?


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 xZW70zEasOk -v
[debug] System config: []
[debug] User config: [u'--youtube-skip-dash-manifest', u'--add-metadata', u'-o', u'%(upload_date)s - %(title)s.%(ext)s', u'-c', u'-f', u'bestvideo[ext=mp4][width<=1920]+bestaudio[ext=m4a]/best', u'--embed-thumbnail', u'--embed-subs']
[debug] Custom config: []
[debug] Command-line args: [u'xZW70zEasOk', u'-v']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2017.05.29
[debug] Python version 2.7.12 - Linux-4.4.0-43-Microsoft-x86_64-with-Ubuntu-16.04-xenial
[debug] exe versions: avconv 2.8.11-0ubuntu0.16.04.1, avprobe 2.8.11-0ubuntu0.16.04.1, ffmpeg 2.8.11-0ubuntu0.16.04.1, ffprobe 2.8.11-0ubuntu0.16.04.1
[debug] Proxy map: {}
[youtube] xZW70zEasOk: Downloading webpage
[youtube] xZW70zEasOk: Extracting video information
[youtube] xZW70zEasOk: Downloading thumbnail ...
[youtube] xZW70zEasOk: Writing thumbnail to: 20160412 - ♥ Sp4zie IRL - MY HAIR.jpg
[debug] Invoking downloader on u'https://r2---sn-uxoxu-j2ue.googlevideo.com/videoplayback?mime=video%2Fmp4&signature=5624FFBDA90F70EDDDEE3C7E917309A83586AAD7.52103608B7A73025C7C423AFC224174C8DD3B14D&key=yt6&gir=yes&clen=91323607&keepalive=yes&ei=RYIvWcjRGNa7c63EgPAM&ms=au&mt=1496285670&mv=m&source=youtube&ip=192.96.15.31&itag=137&id=o-AI7pLo-jEp_hbWmqnL2oaUfN8IQEalJ3Xa53tsD3uHOU&requiressl=yes&dur=282.960&mm=31&mn=sn-uxoxu-j2ue&pl=24&ipbits=0&expire=1496307365&sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Crequiressl%2Csource%2Cexpire&initcwndbps=6306250&lmt=1460630623735646&ratebypass=yes'
[download] Destination: 20160412 - ♥ Sp4zie IRL - MY HAIR.f137.mp4
[download] 100% of 87.09MiB in 00:37
[debug] Invoking downloader on u'https://r2---sn-uxoxu-j2ue.googlevideo.com/videoplayback?mime=audio%2Fmp4&signature=3D4C19BA62D7F3C45CBC912D7F99F39C6331019E.67607483E6CB67D750329227293549EB0AFA90A8&key=yt6&gir=yes&clen=4497288&keepalive=yes&ei=RYIvWcjRGNa7c63EgPAM&ms=au&mt=1496285670&mv=m&source=youtube&ip=192.96.15.31&itag=140&id=o-AI7pLo-jEp_hbWmqnL2oaUfN8IQEalJ3Xa53tsD3uHOU&requiressl=yes&dur=283.097&mm=31&mn=sn-uxoxu-j2ue&pl=24&ipbits=0&expire=1496307365&sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Crequiressl%2Csource%2Cexpire&initcwndbps=6306250&lmt=1460630108186155&ratebypass=yes'
[download] Destination: 20160412 - ♥ Sp4zie IRL - MY HAIR.f140.m4a
[download] 100% of 4.29MiB in 00:01
[ffmpeg] Merging formats into "20160412 - ♥ Sp4zie IRL - MY HAIR.mp4"
[debug] ffmpeg command line: avconv -y -i 'file:20160412 - ♥ Sp4zie IRL - MY HAIR.f137.mp4' -i 'file:20160412 - ♥ Sp4zie IRL - MY HAIR.f140.m4a' -c copy -map 0:v:0 -map 1:a:0 'file:20160412 - ♥ Sp4zie IRL - MY HAIR.temp.mp4'
Deleting original file 20160412 - ♥ Sp4zie IRL - MY HAIR.f137.mp4 (pass -k to keep)
Deleting original file 20160412 - ♥ Sp4zie IRL - MY HAIR.f140.m4a (pass -k to keep)
[ffmpeg] Adding metadata to '20160412 - ♥ Sp4zie IRL - MY HAIR.mp4'
[debug] ffmpeg command line: avconv -y -i 'file:20160412 - ♥ Sp4zie IRL - MY HAIR.mp4' -i 'file:20160412 - ♥ Sp4zie IRL - MY HAIR.meta' -c copy -metadata 'comment=► Subscribe here: http://bit.ly/1sfkQt6
----------------------------------------­­-----
● LCS Spring finals: Saturday and Sunday from 13:30 outside the venue!
● PAX East: Fri, Sat & Sun - more info in tomorrows video on the main channel! http://riot.com/1Vlztfi
----------------------------------------­­-----
Send me stuff and get featured in the next vlog:
SP4ZIE
Box 4184
102 64
Stockholm Sweden
----------------------------------------­­-----
Follow me here:
♥ MAIN Channel: http://bit.ly/YUn5Ht
♥ LiveStream: http://www.twitch.tv/sp4zie
♥ Facebook: http://www.facebook.com/sp4zie
♥ Twitter: https://twitter.com/#!/sp4zie
♥ Instagram: http://www.instagram.com/sp4zie
----------------------------------------­­-----
● T-Shirts & MERCH: http://bit.ly/1XwgAV3
● FAQ: http://www.sp4zie.com
----------------------------------------­­-----' -metadata 'description=► Subscribe here: http://bit.ly/1sfkQt6
----------------------------------------­­-----
● LCS Spring finals: Saturday and Sunday from 13:30 outside the venue!
● PAX East: Fri, Sat & Sun - more info in tomorrows video on the main channel! http://riot.com/1Vlztfi
----------------------------------------­­-----
Send me stuff and get featured in the next vlog:
SP4ZIE
Box 4184
102 64
Stockholm Sweden
----------------------------------------­­-----
Follow me here:
♥ MAIN Channel: http://bit.ly/YUn5Ht
♥ LiveStream: http://www.twitch.tv/sp4zie
♥ Facebook: http://www.facebook.com/sp4zie
♥ Twitter: https://twitter.com/#!/sp4zie
♥ Instagram: http://www.instagram.com/sp4zie
----------------------------------------­­-----
● T-Shirts & MERCH: http://bit.ly/1XwgAV3
● FAQ: http://www.sp4zie.com
----------------------------------------­­-----' -metadata 'artist=Sp4zie IRL' -metadata 'title=♥ Sp4zie IRL - MY HAIR' -metadata date=20160412 -metadata 'purl=https://www.youtube.com/watch?v=xZW70zEasOk' -map_metadata 1 'file:20160412 - ♥ Sp4zie IRL - MY HAIR.temp.mp4'
ERROR: file:20160412 - ♥ Sp4zie IRL - MY HAIR.meta: Cannot allocate memory
Traceback (most recent call last):
  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 204, in run_ffmpeg_multiple_files
    raise FFmpegPostProcessorError(msg)
FFmpegPostProcessorError: file:20160412 - \u2665 Sp4zie IRL - MY HAIR.meta: Cannot allocate memory

Description of your issue, suggested solution and other information

youtube-dl outputs a malformed metadata file, which avconv responds to with: [ffmetadata @ 0xf796a0] Chapter end time 283000 before start 810000

Metadata file

;FFMETADATA1
[CHAPTER]
TIMEBASE=1/1000
START=810000
END=283000
title=● LCS Spring finals: Saturday and Sunday from outside the venue!

From the youtube extractor, only 1 time_point is extracted: 13:30, or 810 seconds. ● LCS Spring finals: Saturday and Sunday from 13:30 outside the venue! This is beyond the duration of the video, 283 seconds. A validation test should be added, which makes sure that start_time < end_time, before adding an object to the chapters list.

arantius commented 3 years ago

I've run into this and it's bad input. If I run youtube-dl -v it tells me:

...
[download] 100% of 2.41GiB
[ffmpeg] Adding metadata to 'Pilot-705e9452-4156-4f98-8cea-21372097ad05.mp4'
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i file:Pilot-705e9452-4156-4f98-8cea-21372097ad05.mp4 -i file:Pilot-705e9452-4156-4f98-8cea-21372097ad05.meta -c copy -metadata title=Pilot -metadata date=20210408 -metadata 'description=A quarter-life crisis causes a young Chinese American woman, Nicky Shen, to drop out of college and go on a life-changing journey to an isolated monastery in China.' -metadata 'comment=A quarter-life crisis causes a young Chinese American woman, Nicky Shen, to drop out of college and go on a life-changing journey to an isolated monastery in China.' -metadata 'purl=https://www.cwtv.com/shows/kung-fu/pilot/?play=705e9452-4156-4f98-8cea-21372097ad05' -metadata artist=CWTV -metadata 'show=Kung Fu' -metadata season_number=1 -metadata 'episode_id=Episode 1' -metadata episode_sort=1 -map_metadata 1 file:Pilot-705e9452-4156-4f98-8cea-21372097ad05.temp.mp4
ERROR: file:Pilot-705e9452-4156-4f98-8cea-21372097ad05.meta: Cannot allocate memory

Running that command myself gives:

...
[ffmetadata @ 0x55e583d5cea0] Chapter end time 0 before start 2204000
file:Pilot-705e9452-4156-4f98-8cea-21372097ad05.meta: Cannot allocate memory

The error isn't super useful/accurate but the message before it is.

$ tail -n 4 Pilot-705e9452-4156-4f98-8cea-21372097ad05.meta
[CHAPTER]
TIMEBASE=1/1000
START=2204000
END=0

The chapter metadata should be validated/cleaned before passing it to ffmpeg.