yt-dlp: Videos downloaded from coub don't loop until the end of the audio track

Checklist

Region

Canada

Description

Coub is sort of like vine except the audio track can run for longer than the video. The video simply loops for the duration of the audio track. When downloading a coub url, the video only plays for the first time and freezes on the last frame for the duration of the audio track, when it should repeat.

Verbose log

[debug] Command-line config: ['-Uv', 'https://coub.com/view/2ynnnr']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, err utf-8, pref UTF-8
[debug] yt-dlp version 2021.12.01 [91f071af6]
[debug] Python version 3.9.6 (CPython 64bit) - Linux-5.14.21-x86_64-with-glibc2.33
[debug] exe versions: ffmpeg 4.4.1 (setts), ffprobe 4.4.1, rtmpdump 2.4
[debug] Optional libraries: Cryptodome, mutagen, sqlite, websockets
[debug] Proxy map: {}
Latest version: 2021.12.01, Current version: 2021.12.01
yt-dlp is up to date (2021.12.01)
[debug] [Coub] Extracting URL: https://coub.com/view/2ynnnr
[Coub] 2ynnnr: Downloading JSON metadata
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, hdr:12(7), vcodec:vp9.2(10), acodec, filesize, fs_approx, tbr, vbr, abr, asr, proto, vext, aext, hasaud, source, id
[debug] Default format spec: bestvideo*+bestaudio/best
[info] 2ynnnr: Downloading 1 format(s): html5-video-higher+html5-audio-high
[debug] Invoking downloader on "https://coub-anubis-a.akamaized.net/coub_storage/coub/simple/cw_file/4eab6d68b57/02303c8620867fa30760b/muted_mp4_huge_size_1638911654_muted_huge.mp4"
[download] Destination: @candy_balll [2ynnnr].fhtml5-video-higher.mp4
[download] 100% of 2.03MiB in 00:00                                     
[debug] Invoking downloader on "https://coub-anubis-a.akamaized.net/coub_storage/coub/simple/cw_looped_audio_high/ff30f22a4de/1329259b65f42fd114c43/1638911657_mp3-high.mp3"
[download] Destination: @candy_balll [2ynnnr].fhtml5-audio-high.mp3
[download] 100% of 1.07MiB in 00:00                                     
[Merger] Merging formats into "@candy_balll [2ynnnr].mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:@candy_balll [2ynnnr].fhtml5-video-higher.mp4' -i 'file:@candy_balll [2ynnnr].fhtml5-audio-high.mp3' -c copy -map 0:v:0 -map 1:a:0 'file:@candy_balll [2ynnnr].temp.mp4'
Deleting original file @candy_balll [2ynnnr].fhtml5-video-higher.mp4 (pass -k to keep)
Deleting original file @candy_balll [2ynnnr].fhtml5-audio-high.mp3 (pass -k to keep)

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Reactions: 5
  • Comments: 16 (2 by maintainers)

Most upvoted comments

It is possible to pass --postprocessor-args (--ppa) to yt-dlp to avoid using ffmpeg separately:

yt-dlp --ppa "Merger+ffmpeg_i1:-stream_loop -1" --ppa "Merger+ffmpeg_o1:-shortest" https://coub.com/view/3bqkg3

In ffmpeg v6, the argument -shortest_buf_duration 0 should also be passed along with -shortest, otherwise the last ~10 seconds may end up as a “static frame” (example):

yt-dlp --ppa "Merger+ffmpeg_i1:-stream_loop -1" --ppa "Merger+ffmpeg_o1:-shortest -shortest_buf_duration 0" https://coub.com/view/3bqkg3

I use this ffmpeg command:

ffmpeg -stream_loop -1 -i input.mp4 -i input.mp4 -shortest -map 0:v:0 -map 1:a:0 -c copy output.mp4