How to live stream a local video using FFmpeg [closed]
Asked Answered
I

4

12

I have been trying to stream local video on VLC using the FFmpeg library like this:

$ ffmpeg -i sample.mp4 -v 0 -vcodec mpeg4 -f mpegts udp://127.0.0.1:23000

I have not been able to stream the file on VLC.

Idaline answered 7/5, 2017 at 0:31 Comment(0)
M
9

My guess is that you are trying to play in VLC using the URL udp://127.0.0.1:23000 as you have it in the FFmpeg command. In VLC, try using udp://@:23000 instead.

Marigolde answered 7/5, 2017 at 9:53 Comment(0)
V
27

In the first terminal:

$ ffmpeg -i sample.mp4 -v 0 -vcodec mpeg4 -f mpegts udp://127.0.0.1:23000

Open a second terminal and use:

$ ffplay udp://127.0.0.1:23000
Veach answered 8/11, 2017 at 11:41 Comment(0)
M
9

My guess is that you are trying to play in VLC using the URL udp://127.0.0.1:23000 as you have it in the FFmpeg command. In VLC, try using udp://@:23000 instead.

Marigolde answered 7/5, 2017 at 9:53 Comment(0)
D
0

It works, but it's ugly on VLC.

On MacOS Catalina with:

ffmpeg -f avfoundation -framerate 30 -i "0" -f mpeg1video -b 200k -r 30 -vf scale=640:360 udp://127.0.0.1:5555

and it works well with:

ffplay -fflags nobuffer -flags low_delay -framedrop -strict experimental   udp://127.0.0.1:5555
Dru answered 7/3, 2022 at 16:45 Comment(0)
I
0

Along with @Omy's answer be sure to add -re before the input to ensure realtime (normal) livestreaming than sending too many UDP payloads at once. For instance,

ffmpeg -re -i sample.mp4 -v 0 -vcodec mpeg4 -f mpegts udp://127.0.0.1:23000
Inapprehensible answered 23/4, 2022 at 18:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.