I’m trying to download a clip of a video (including audio) in a streaming manner (i.e. with no temporary files) in a given format.
On Linux (for some reason, not Windows!) this works fine:
yt-dlp -o - "https://www.youtube.com/watch?v=a3ICNMQW7Ok" |
ffmpeg -i - -c copy -movflags frag_keyframe+empty_moov -f mp4 -y temp.mp4
But this fails (and the above also fails with the same error on Windows):
yt-dlp -o - "https://www.youtube.com/watch?v=a3ICNMQW7Ok" --download-sections "*0-30" |
ffmpeg -i - -c copy -movflags frag_keyframe+empty_moov -f mp4 -y temp.mp4
[mp4 @ 0x7fffb806f200]
Malformed AAC bitstream detected:
use the audio bitstream filteraac_adtstoasc
to fix it (-bsf:a aac_adtstoasc
option with ffmpeg)
I don’t understand how this can happen. What is going on and how do I fix it?
(And no, -bsf:a aac_adtstoasc
doesn’t solve the problem, because if I use it, there is no longer any audio when I play the downloaded video.)