2017-12-28

HOWTO: grab online video stream with FFmpeg

Usually, it's quite easy to save some free online (live) video streams with FFmpeg.

Example: grabbing some HLS stream with MPEG-4 (H.264) video and AAC (or MP3) audio.
$ ffmpeg -i "http://some.streaming.server/favorite_stream.m3u8" -codec copy -f mpegts stream01.ts
(Generally, the output format can be guessed by extension automatically, so we can shorten the command line).
$ ffmpeg -i "http://some.streaming.server/favorite_stream.m3u8" -codec copy stream02.ts
The TS file is usually playable during download.
Usually, you can stop the grabbing operation at any time by pressing the <q> key.
After the stream dumping is finished, you can convert (remux) your video to a more familiar MP4 container format.
$ ffmpeg -i stream01.ts -codec copy stream01.mp4
(Usually, you'd prefer a playback-optimized output file).
$ ffmpeg -i stream02.ts -codec copy -movflags faststart stream02.mp4

Reference:

No comments:

Post a Comment