[AfreecaTV] Single videos should be merged into a single file, instead of being downloaded as a "playlist" of segments
See original GitHub issueChecklist
- I’m reporting a broken site support
- I’ve verified that I’m running youtube-dl version 2021.03.03
- I’ve checked that all provided URLs are alive and playable in a browser
- I’ve checked that all URLs and arguments with special characters are properly quoted or escaped
- I’ve searched the bugtracker for similar issues including closed ones
Verbose log
$ youtube-dl -v "https://vod.afreecatv.com/PLAYER/STATION/46171437"
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v', 'https://vod.afreecatv.com/PLAYER/STATION/46171437']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2021.03.03
[debug] Python version 3.9.2 (CPython) - macOS-10.14.6-x86_64-i386-64bit
[debug] exe versions: ffmpeg 4.3.2, ffprobe 4.3.2, rtmpdump 2.4
[debug] Proxy map: {}
[afreecatv] 46171437: Downloading webpage
[afreecatv] 46171437: Downloading video info XML
[afreecatv] 46171437: Downloading part 1 m3u8 information
[afreecatv] 46171437: Downloading part 2 m3u8 information
[afreecatv] 46171437: Downloading part 3 m3u8 information
[afreecatv] 46171437: Downloading part 4 m3u8 information
[afreecatv] 46171437: Downloading part 5 m3u8 information
[download] Downloading playlist: [생]ASL S8 Ro.16 Group A
[afreecatv] playlist [생]ASL S8 Ro.16 Group A: Collected 5 video ids (downloading 5 of them)
[download] Downloading video 1 of 5
[debug] Default format spec: bestvideo+bestaudio/best
[debug] Invoking downloader on 'http://vod-archive-global-cdn-z01.afreecatv.com/v1/mapped-vod/20190721/596/92E749C3_215850596_1.php/live/0/index-f1-v1-a1.m3u8'
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 1200
[download] Destination: [생]ASL S8 Ro.16 Group A (part 1)-20190721_92E749C3_215850596_1.mp4
[download] 100% of 3.49GiB in 04:15
[debug] ffmpeg command line: ffprobe -show_streams 'file:[생]ASL S8 Ro.16 Group A (part 1)-20190721_92E749C3_215850596_1.mp4'
[ffmpeg] Fixing malformed AAC bitstream in "[생]ASL S8 Ro.16 Group A (part 1)-20190721_92E749C3_215850596_1.mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:[생]ASL S8 Ro.16 Group A (part 1)-20190721_92E749C3_215850596_1.mp4' -c copy -f mp4 -bsf:a aac_adtstoasc 'file:[생]ASL S8 Ro.16 Group A (part 1)-20190721_92E749C3_215850596_1.temp.mp4'
[download] Downloading video 2 of 5
[debug] Default format spec: bestvideo+bestaudio/best
[debug] Invoking downloader on 'http://vod-archive-global-cdn-z01.afreecatv.com/v1/mapped-vod/20190721/596/E4421B70_215850596_2.php/live/0/index-f1-v1-a1.m3u8'
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 1200
[download] Destination: [생]ASL S8 Ro.16 Group A (part 2)-20190721_E4421B70_215850596_2.mp4
[download] 100% of 3.51GiB in 04:34
[debug] ffmpeg command line: ffprobe -show_streams 'file:[생]ASL S8 Ro.16 Group A (part 2)-20190721_E4421B70_215850596_2.mp4'
[ffmpeg] Fixing malformed AAC bitstream in "[생]ASL S8 Ro.16 Group A (part 2)-20190721_E4421B70_215850596_2.mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:[생]ASL S8 Ro.16 Group A (part 2)-20190721_E4421B70_215850596_2.mp4' -c copy -f mp4 -bsf:a aac_adtstoasc 'file:[생]ASL S8 Ro.16 Group A (part 2)-20190721_E4421B70_215850596_2.temp.mp4'
[download] Downloading video 3 of 5
[debug] Default format spec: bestvideo+bestaudio/best
[debug] Invoking downloader on 'http://vod-archive-global-cdn-z01.afreecatv.com/v1/mapped-vod/20190721/596/E23747A5_215850596_3.php/live/0/index-f1-v1-a1.m3u8'
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 1200
[download] Destination: [생]ASL S8 Ro.16 Group A (part 3)-20190721_E23747A5_215850596_3.mp4
[download] 100% of 3.50GiB in 04:35
[debug] ffmpeg command line: ffprobe -show_streams 'file:[생]ASL S8 Ro.16 Group A (part 3)-20190721_E23747A5_215850596_3.mp4'
[ffmpeg] Fixing malformed AAC bitstream in "[생]ASL S8 Ro.16 Group A (part 3)-20190721_E23747A5_215850596_3.mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:[생]ASL S8 Ro.16 Group A (part 3)-20190721_E23747A5_215850596_3.mp4' -c copy -f mp4 -bsf:a aac_adtstoasc 'file:[생]ASL S8 Ro.16 Group A (part 3)-20190721_E23747A5_215850596_3.temp.mp4'
[download] Downloading video 4 of 5
[debug] Default format spec: bestvideo+bestaudio/best
[debug] Invoking downloader on 'http://vod-archive-global-cdn-z01.afreecatv.com/v1/mapped-vod/20190721/596/744219C0_215850596_4.php/live/0/index-f1-v1-a1.m3u8'
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 1200
[download] Destination: [생]ASL S8 Ro.16 Group A (part 4)-20190721_744219C0_215850596_4.mp4
[download] 100% of 3.51GiB in 06:25
[debug] ffmpeg command line: ffprobe -show_streams 'file:[생]ASL S8 Ro.16 Group A (part 4)-20190721_744219C0_215850596_4.mp4'
[ffmpeg] Fixing malformed AAC bitstream in "[생]ASL S8 Ro.16 Group A (part 4)-20190721_744219C0_215850596_4.mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:[생]ASL S8 Ro.16 Group A (part 4)-20190721_744219C0_215850596_4.mp4' -c copy -f mp4 -bsf:a aac_adtstoasc 'file:[생]ASL S8 Ro.16 Group A (part 4)-20190721_744219C0_215850596_4.temp.mp4'
[download] Downloading video 5 of 5
[debug] Default format spec: bestvideo+bestaudio/best
[debug] Invoking downloader on 'http://vod-archive-global-cdn-z01.afreecatv.com/v1/mapped-vod/20190721/596/92374B95_215850596_5.php/live/0/index-f1-v1-a1.m3u8'
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 165
[download] Destination: [생]ASL S8 Ro.16 Group A (part 5)-20190721_92374B95_215850596_5.mp4
[download] 100% of 490.30MiB in 00:36
[debug] ffmpeg command line: ffprobe -show_streams 'file:[생]ASL S8 Ro.16 Group A (part 5)-20190721_92374B95_215850596_5.mp4'
[ffmpeg] Fixing malformed AAC bitstream in "[생]ASL S8 Ro.16 Group A (part 5)-20190721_92374B95_215850596_5.mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:[생]ASL S8 Ro.16 Group A (part 5)-20190721_92374B95_215850596_5.mp4' -c copy -f mp4 -bsf:a aac_adtstoasc 'file:[생]ASL S8 Ro.16 Group A (part 5)-20190721_92374B95_215850596_5.temp.mp4'
[download] Finished downloading playlist: [생]ASL S8 Ro.16 Group A
Resulting files:
./[생]ASL S8 Ro.16 Group A (part 1)-20190721_92E749C3_215850596_1.mp4
./[생]ASL S8 Ro.16 Group A (part 2)-20190721_E4421B70_215850596_2.mp4
./[생]ASL S8 Ro.16 Group A (part 3)-20190721_E23747A5_215850596_3.mp4
./[생]ASL S8 Ro.16 Group A (part 4)-20190721_744219C0_215850596_4.mp4
./[생]ASL S8 Ro.16 Group A (part 5)-20190721_92374B95_215850596_5.mp4
Description
When downloading videos from AfreecaTV, they end up as multiple hour-long segments instead of being merged into a single video as they should. The handler seems to believe a video is a “playlist”, and then proceeds to download the segments as separate files, without merging them in the end. The way they’re implemented on Afreeca is each video is divided into segments of an hour long, and each one of those segments is divided up into many small pieces. Youtube-dl correctly merges the smaller pieces, but not the larger segments.
For example, downloading this 4:08:14 long video results in five separate files, with the first four being 1 hour long and the last one being 8 minutes long.
The expected result is that the result of the operation is a single >4 hour long video.
Note: this is related to my earlier question: #28396.
Thanks for your attention.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (2 by maintainers)
Top GitHub Comments
I recall that a release in late 2021 or early 2022 added a
--concat-playlist
option to stitch together video files like this. I don’t personally want that for my use case, so I remember turning it off when I noticed - but that implies it’s on by default and works for Afreeca.Does this option work for you?
@afterdelight there’s no one-size-fits-all command for it, but you can do it in two steps:
First of all, you need to add
playlist_index
to your output format when runningyt-dlp
. For example:This will ensure that all playlist entries get
_1
,_2
,_3
, etc. numbers in the filename, and I’m also making sure the extension is always .mp4 so I can easily find the files.Now you need to merge those using ffmpeg’s concat filter.
The first command creates a merge file with entries for each segment, and then it uses that merge file to generate a single master file.
You’ll want to replace the “my_filename” portion with whatever your title ends up being. In my case I could easily script this because I always knew the output title in advance. If you don’t, you could probably also just select all files ending in
_[number].mp4
as long as you always start downloading inside a clean directory.