Recording Live Streams on Linux with FFmpeg: Examples Included - Linux Tutorials - Learn Linux Configuration

Recording live stream music and videos is a highly sought-after capability for content creators, archivists, and enthusiasts. With the power of FFmpeg on Linux, capturing these live streams directly from the command line becomes not only possible but also remarkably efficient. FFmpeg, a leading multimedia framework, supports a wide array of protocols, codecs, and file formats, making it the go-to tool for such tasks. Whether you’re aiming to record a live concert, a webinar, or your favorite online TV show, FFmpeg can handle it all with ease.


This is a companion discussion topic for the original entry at https://linuxconfig.org/recording-live-streams-on-linux-with-ffmpeg-examples-included

Hi, thank you for well-covered guide!

Example 7: Cannot get this working, it ends up the error:

[out#0/tee @ 0x61e8b5d902c0] Output file does not contain any stream
Error opening output file video.mp4|f=mpegts -.
Error opening output files: Invalid argument

Any idea how to fix?

Hello,

Thank you for reporting this issue. Try the following instead:
For MP4 stream:
ffmpeg -i https://example.com/live/stream.mp4 -c copy -f mp4 pipe:1 | tee output.mp4 | vlc -
For mp3 stream:
ffmpeg -i https://example.com/live/stream.mp3 -c copy -f mpegts pipe:1 | tee output.ts | vlc -

let me know…

Hope this helps

Lubos

No, it does not work. Seems that this is not so straightforward. I googled a little bit and found following. This is not very natty but it seems to work:

ffmpeg -i {URL} -codec:a aac -b:a 192k -codec:v copy -f mpegts - | tee >(ffplay -f mpegts -i -) | ffmpeg -y -f mpegts -i - -c copy output_$(date +%Y%m%d%H%M%S).mp4

Seems that you have to complete your guide.

1 Like