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.69k stars 9.97k forks source link

[hlsnative] FFmpegFixupM3u8PP should be called before merging #9913

Open dstftw opened 8 years ago

dstftw commented 8 years ago

For audio-only and video-only media streams downloaded with --hls-prefer-native FFmpegFixupM3u8PP should be called before merging. Otherwise (currently) it results in a conversion error.


youtube-dl log (in order to reproduce entry_protocol for m3u8 formats in msn extractor should be changed to m3u8_native):

[debug] System config: []
[debug] User config: ['-o', '%(title)s-%(id)s-f%(format_id)s.%(ext)s']
[debug] Command-line args: ['http://www.msn.com/en-ae/foodanddrink/joinourtable/criminal-minds-shemar-moore-shares-a-touching-goodbye-message/vp-BBqQYNE', '-v']
[debug] Encodings: locale cp1251, fs mbcs, out cp866, pref cp1251
[debug] youtube-dl version 2016.06.25
[debug] Git HEAD: efa26c5
[debug] Python version 3.5.1 - Windows-10-10.0.10240-SP0
[debug] exe versions: ffmpeg 3.0, ffprobe 3.0, rtmpdump 2.4
[debug] Proxy map: {}
[MSN] criminal-minds-shemar-moore-shares-a-touching-goodbye-message: Downloading webpage
[MSN] criminal-minds-shemar-moore-shares-a-touching-goodbye-message: Downloading m3u8 information
[debug] Invoking downloader on 'http://wus.streaming.video.msn.com/806b30dc-9570-485a-b278-4b8111d4982b/a9a2473c-ff61-45d6-90b8-cac019422d6c.ism/QualityLevels(3457334)/Manifest(video,format=m3u8-aapl)'
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 11
[download] Destination: Criminal Minds - Shemar Moore Shares A Touching Goodbye Message-BBqQYNE-fhls-3647.fhls-3647.mp4
[download] 100% of 44.29MiB in 00:12
[debug] Invoking downloader on 'http://wus.streaming.video.msn.com/806b30dc-9570-485a-b278-4b8111d4982b/a9a2473c-ff61-45d6-90b8-cac019422d6c.ism/QualityLevels(96072)/Manifest(aac_UND_2_96,format=m3u8-aapl)'
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 11
[download] Destination: Criminal Minds - Shemar Moore Shares A Touching Goodbye Message-BBqQYNE-fhls-106.fhls-106.mp4
[download] 100% of 1.29MiB in 00:00
['Criminal Minds - Shemar Moore Shares A Touching Goodbye Message-BBqQYNE-fhls-3647.fhls-3647.mp4', 'Criminal Minds - Shemar Moore Shares A Touching Goodbye Message-BBqQYNE-fhls-106.fhls-106.mp4']
[ffmpeg] Merging formats into "Criminal Minds - Shemar Moore Shares A Touching Goodbye Message-BBqQYNE-fhls-3647+hls-106.mp4"
[debug] ffmpeg command line: ffmpeg -y -i 'file:Criminal Minds - Shemar Moore Shares A Touching Goodbye Message-BBqQYNE-fhls-3647.fhls-3647.mp4' -i 'file:Criminal Minds - Shemar Moore Shares A Touching Goodbye Message-BBqQYNE-fhls-106.fhls-106.mp4' -c copy -map 0:v:0 -map 1:a:0 'file:Criminal Minds - Shemar Moore Shares A Touching Goodbye Message-BBqQYNE-fhls-3647+hls-106.temp.mp4'
ERROR: Conversion failed!
Traceback (most recent call last):
  File "C:\dev\youtube-dl\master\youtube_dl\YoutubeDL.py", line 1786, in post_process
    files_to_delete, info = pp.run(info)
  File "C:\dev\youtube-dl\master\youtube_dl\postprocessor\ffmpeg.py", line 446, in run
    self.run_ffmpeg_multiple_files(info['__files_to_merge'], temp_filename, args)
  File "C:\dev\youtube-dl\master\youtube_dl\postprocessor\ffmpeg.py", line 168, in run_ffmpeg_multiple_files
    raise FFmpegPostProcessorError(msg)
youtube_dl.postprocessor.ffmpeg.FFmpegPostProcessorError: Conversion failed!

ffmpeg log:

PS C:\dev\youtube-dl\master> ffmpeg -y -i 'file:Criminal Minds - Shemar Moore Shares A Touching Goodbye Message-BBqQYNE-
fhls-3647.fhls-3647.mp4' -i 'file:Criminal Minds - Shemar Moore Shares A Touching Goodbye Message-BBqQYNE-fhls-106.fhls-
106.mp4' -c copy -map 0:v:0 -map 1:a:0 'file:Criminal Minds - Shemar Moore Shares A Touching Goodbye Message-BBqQYNE-fhl
s-3647+hls-106.temp.mp4'
ffmpeg version 3.0 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.3.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfi
g --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --
enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libm
p3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --en
able-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --ena
ble-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-lib
x265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 17.103 / 55. 17.103
  libavcodec     57. 24.102 / 57. 24.102
  libavformat    57. 25.100 / 57. 25.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 31.100 /  6. 31.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mpegts, from 'file:Criminal Minds - Shemar Moore Shares A Touching Goodbye Message-BBqQYNE-fhls-3647.fhls-3647
.mp4':
  Duration: 00:01:44.20, start: 0.066733, bitrate: 3565 kb/s
  Program 1
    Stream #0:0[0x12c]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 29.97 fps, 29
.97 tbr, 90k tbn, 59.94 tbc
Input #1, mpegts, from 'file:Criminal Minds - Shemar Moore Shares A Touching Goodbye Message-BBqQYNE-fhls-106.fhls-106.m
p4':
  Duration: 00:01:44.21, start: 0.000000, bitrate: 103 kb/s
  Program 1
    Stream #1:0[0x12d]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 101 kb/s
Output #0, mp4, to 'file:Criminal Minds - Shemar Moore Shares A Touching Goodbye Message-BBqQYNE-fhls-3647+hls-106.temp.
mp4':
  Metadata:
    encoder         : Lavf57.25.100
    Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 29.97 fps, 29.97 tb
r, 90k tbn, 90k tbc
    Stream #0:1: Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, 101 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #1:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mp4 @ 00000066986bd380] Malformed AAC bitstream detected: use the audio bitstream filter 'aac_adtstoasc' to fix it ('-b
sf:a aac_adtstoasc' option with ffmpeg)
av_interleaved_write_frame(): Operation not permitted
frame=    4 fps=0.0 q=-1.0 Lsize=      46kB time=00:00:00.03 bitrate=11352.9kbits/s speed=33.3x
video:45kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.269963%
Conversion failed!
yan12125 commented 8 years ago

As reported by @desbma at https://github.com/rg3/youtube-dl/issues/5298#issuecomment-250718304, merging mpegts and mp4 to mkv works. My question is: is it a good solution?

RossComputerGuy commented 4 years ago

Screenshot_20200624-004108_Termux Screenshot_20200624-005235_Termux Screenshot_20200624-005257_Termux @desbma's solution doesn't work on Termux