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

option "--extract-audio" causes 'Malformed AAC bitstream detected" error on ted.com #15374

Closed
bitinerant opened this issue Jan 20, 2018 · 5 comments
Closed
Labels

Comments

@bitinerant
Copy link

@bitinerant bitinerant commented Jan 20, 2018

Please follow the guide below

  • You will be asked some questions and requested to provide some information, please read them carefully and answer honestly
  • Put an x into all the boxes [ ] relevant to your issue (like this: [x])
  • Use the Preview tab to see what your issue will actually look like

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

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

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

$ youtube-dl -v --extract-audio https://www.ted.com/talks/glenn_greenwald_why_privacy_matters
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'-v', u'--extract-audio', u'https://www.ted.com/talks/glenn_greenwald_why_privacy_matters']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2018.01.18
[debug] Python version 2.7.12 (CPython) - Linux-4.4.0-109-generic-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, rtmpdump 2.4
[debug] Proxy map: {}
[ted] glenn_greenwald_why_privacy_matters: Downloading webpage
[ted] glenn_greenwald_why_privacy_matters: Downloading m3u8 information
[debug] Invoking downloader on u'https://hls.ted.com/videos/GlennGreenwald_2014G/audio/600k.m3u8?uniqueId=91d38f34'
[download] Destination: Why privacy matters-2106.mp4
[debug] avconv command line: avconv -y -loglevel verbose -headers 'Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20150101 Firefox/47.0 (Chrome)
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Cookie: _abby=JQREWGqaRnGrNkO
' -i 'https://hls.ted.com/videos/GlennGreenwald_2014G/audio/600k.m3u8?uniqueId=91d38f34' -c copy -f mp4 'file:Why privacy matters-2106.mp4.part'
ffmpeg version 2.8.11-0ubuntu0.16.04.1 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
  configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
[hls,applehttp @ 0x1dd25e0] HLS request for url 'https://pb.tedcdn.com/bumpers/hls/audio/in/Thousands-600k.aac', offset 0, playlist 0
Input #0, hls,applehttp, from 'https://hls.ted.com/videos/GlennGreenwald_2014G/audio/600k.m3u8?uniqueId=91d38f34':
  Duration: 00:20:37.93, start: 9.952111, bitrate: 0 kb/s
  Program 0 
    Metadata:
      variant_bitrate : 0
    Stream #0:0: Audio: aac (LC), 44100 Hz, mono, fltp, 67 kb/s
[mp4 @ 0x21e34e0] Codec for stream 0 does not use global headers but container format requires global headers
Output #0, mp4, to 'file:Why privacy matters-2106.mp4.part':
  Metadata:
    encoder         : Lavf56.40.101
    Stream #0:0: Audio: aac ([64][0][0][0] / 0x0040), 44100 Hz, mono, 67 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[mp4 @ 0x21e34e0] Malformed AAC bitstream detected: use the audio bitstream filter 'aac_adtstoasc' to fix it ('-bsf:a aac_adtstoasc' option with ffmpeg)
av_interleaved_write_frame(): Operation not permitted
No more output streams to write to, finishing.
size=       0kB time=00:00:00.02 bitrate=  88.9kbits/s    
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 473.333344%
Input file #0 (https://hls.ted.com/videos/GlennGreenwald_2014G/audio/600k.m3u8?uniqueId=91d38f34):
  Input stream #0:0 (audio): 1 packets read (45 bytes); 
  Total: 1 packets (45 bytes) demuxed
Output file #0 (file:Why privacy matters-2106.mp4.part):
  Output stream #0:0 (audio): 1 packets muxed (45 bytes); 
  Total: 1 packets (45 bytes) muxed
Conversion failed!


ERROR: ffmpeg exited with code 1
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/cor/docs/util/bin/youtube-dl/__main__.py", line 19, in <module>
    youtube_dl.main()
  File "/home/cor/docs/util/bin/youtube-dl/youtube_dl/__init__.py", line 465, in main
    _real_main(argv)
  File "/home/cor/docs/util/bin/youtube-dl/youtube_dl/__init__.py", line 455, in _real_main
    retcode = ydl.download(all_urls)
  File "/home/cor/docs/util/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1988, in download
    url, force_generic_extractor=self.params.get('force_generic_extractor', False))
  File "/home/cor/docs/util/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 795, in extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "/home/cor/docs/util/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 849, in process_ie_result
    return self.process_video_result(ie_result, download=download)
  File "/home/cor/docs/util/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1622, in process_video_result
    self.process_info(new_info)
  File "/home/cor/docs/util/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1895, in process_info
    success = dl(filename, info_dict)
  File "/home/cor/docs/util/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1834, in dl
    return fd.download(name, info)
  File "/home/cor/docs/util/bin/youtube-dl/youtube_dl/downloader/common.py", line 361, in download
    return self.real_download(filename, info_dict)
  File "/home/cor/docs/util/bin/youtube-dl/youtube_dl/downloader/external.py", line 57, in real_download
    self.get_basename(), retval))
  File "/home/cor/docs/util/bin/youtube-dl/youtube_dl/downloader/common.py", line 163, in report_error
    self.ydl.report_error(*args, **kargs)
  File "/home/cor/docs/util/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 612, in report_error
    self.trouble(error_message, tb)
  File "/home/cor/docs/util/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 574, in trouble
    tb_data = traceback.format_list(traceback.extract_stack())
...
<end of log>

Description of your issue, suggested solution and other information

Using youtube-dl to download a full video of this same URL works as expected. What's more, after the full download, the --extract-audio option for same URL properly strips the video and leaves a good .m4a file.

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Jan 20, 2018

Outdated ffmpeg.

@dstftw dstftw closed this Jan 20, 2018
@dstftw dstftw added the invalid label Jan 20, 2018
@bitinerant
Copy link
Author

@bitinerant bitinerant commented Jan 20, 2018

The point of an Ubuntu LTS release is to not have to update pieces.

@kn00tcn
Copy link

@kn00tcn kn00tcn commented Jan 23, 2018

yes, this is what happens with obsolete software, the logic of LTS is faulty & most definitely inconsistent when certain things need constant updates (usually security)

some sort of hybrid approach is better, i'm not saying automatic latest versions, but at the very least they could make packages called ffmpeg1, ffmpeg2, ffmpeg3 or something even if you cant install more than one at the same time (like if they use the same executable names for compatibility with software calling the binary)

now according to launchpad, there is ffmpeg 2.8.13 from september, yet you are on 2.8.11 from february?

does TED work without ffmpeg? i remember how youtube uses the old up to 720p30 h264 non-dash format when ffmpeg is not installed

@bitinerant
Copy link
Author

@bitinerant bitinerant commented Jan 23, 2018

@kn00tcn - I really appreciate your response.

The logic of LTS has served me very well for about 8 years. Ubuntu LTS releases receive security updates for 5 years. I've had occasional issues with hardware incompatibility, especially 18-24 months after the LTS release (i.e. just before the next LTS release). Ubuntu 18.04 is scheduled for April.

Ubuntu snap packages will hopefully solve certain issues such as this ffmpeg one where updates are needed more frequently. Unfortunately, the ffmpeg snap is still a "classic" snap therefore brings certain risks that normal snap packages don't have.

Yes, TED works without ffmpeg, but only if you download the video and audio together. I want just audio.

@kn00tcn
Copy link

@kn00tcn kn00tcn commented Jan 24, 2018

i havent tried checking what formats appear from ted until now

/talks/elizabeth_loftus_the_fiction_of_memory -F
[ted] elizabeth_loftus_the_fiction_of_memory: Downloading webpage
[ted] elizabeth_loftus_the_fiction_of_memory: Downloading m3u8 information
[info] Available formats for 1826:
format code     extension  resolution note
hls-600k-Audio  mp4        audio only [en] 
hls-67          mp4        audio only   67k , mp4a.40.2@  0k
low             mp4        320x180    
medium          mp4        512x288    
high            mp4        854x480    
hls-153         mp4        320x180     153k , avc1.42c00c, mp4a.40.2
http-153        mp4        320x180     153k , avc1.42c00c, mp4a.40.2
h264-320k       mp4        unknown     320k 
hls-387         mp4        512x288     387k , avc1.42c015, mp4a.40.2
http-387        mp4        512x288     387k , avc1.42c015, mp4a.40.2
hls-686         mp4        512x288     686k , avc1.42c015, mp4a.40.2
http-686        mp4        512x288     686k , avc1.42c015, mp4a.40.2
hls-952         mp4        512x288     952k , avc1.42c015, mp4a.40.2
http-952        mp4        512x288     952k , avc1.42c015, mp4a.40.2
hls-1248        mp4        640x360    1248k , avc1.42c01e, mp4a.40.2
http-1248       mp4        640x360    1248k , avc1.42c01e, mp4a.40.2
hls-2541        mp4        853x480    2541k , avc1.4d401f, mp4a.40.2
http-2541       mp4        853x480    2541k , avc1.4d401f, mp4a.40.2
hls-4895        mp4        1280x720   4895k , avc1.640028, mp4a.40.2
http-4895       mp4        1280x720   4895k , avc1.640028, mp4a.40.2 (best)

so i guess audio is hls only, requiring an hls capable downloader/streamer, was also thinking maybe you could find the same talk on YT, but those audio streams say dash rather than simple http

it's more work, but since it at least is able to grab a file, you could just demux out the audio after downloading one of the http formats

i am also wondering... maybe you can use ffmpeg to load one of the streams directly as an input instead of ytdl, then copy the audio stream as the output? (your log showed some 'malformed aac' error with a suggested ffmpeg option to use)

edit: i just tried h264-320k, this is actually an aac audio only stream that i dont think used ffmpeg, but the length in players/mediainfo is wrong at 20sec yet 40mb

............

hardware compatibility yes, another thing i've noticed is debian's ytdl is almost a year old, this makes zero sense since it's specifically an app that doesnt change much, but always requires new fixes, at least debian's testing repos contain newer versions around once a month

i used to browse mate's issue tracker, on multiple occasions they have to work around mint's lagging behind since mint was staying on gtk2 while mate was migrating most things to gtk3 & dropping support for gtk2 (or at the very least having trouble solving some of the bugs of gtk2)

i read about great new features of various packages or environments or the major changes for amd gpu drivers, then get disappointed to hear LTS distros wont get the updates for months if not years, they also have to manage to backport security updates years later when upstream would have moved on (it's probably not even possible to backport everything, i heard some of the recent spectre/meltdown fixes dont work as well for kernels before 4.14)

meanwhile something like fedora gets great reviews from phoronix michael about how it's straightforward when running the dist-upgrade, i think linus uses it as well, they're not rolling release, but sometimes mesa gets an update, kernel updated of course, some other libs like node or gcc wait until major fedora versions to change, which would be after half a year

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.