Dobbelina
Dobbelina

Reputation: 186

ffmpeg pipe livestream to ffplay

I wonder if it is possible to pipe an internet livestream from ffmpeg to ffplay?

Examples to illustrate:

Livestream to test.mp4 works

ffmpeg -i "https://Some livestream" -c copy "C:\ffmpeg\test.mp4"

Recorded video to test.mp4 and pipe to ffplay works

ffmpeg -i "https://Some recorded video" -c copy "C:\ffmpeg\test.mp4" -f matroska - | ffplay -fs  -

Livestream to test.mp4 and pipe to ffplay don't work

ffmpeg -i "https://Some livestream" -c copy "C:\ffmpeg\test.mp4" -f matroska - | ffplay -fs  -

I get this error:

pipe:: Invalid data found when processing input

How do i get "Livestream to test.mp4 and pipe to ffplay" to work so i can watch the livestream while it is recording?

(If it's possible i mean)

Upvotes: 4

Views: 3753

Answers (2)

Victor
Victor

Reputation: 19

Following code lets ffplay listen to localhost port 7000. ffmpeg sends webcam views and microphone audio to that port. So you get a sort of monitor view of your webcam. Latency is now about one second. Any one knows a way to make it realtime?

I have dreamt of using these scripts for video calling.

start "%windowtitle%" /high ^
ffplay.exe -window_title "%windowtitle%" ^
-f rtsp ^
-rtsp_transport tcp ^
-rtsp_flags listen ^
-indexmem 250M ^
-rtbufsize 1G ^
-probesize 150k ^
-strict strict ^
-i rtsp://localhost:7000


start "%windowtitle%" /high /wait /b ^
ffmpeg.exe -y ^
-vsync vfr ^
-f dshow ^
-indexmem 300M ^
-rtbufsize 1G ^
-probesize 150k ^
-max_probe_packets 50k ^
-framerate 15 ^
-c:v mjpeg ^
-strict normal ^
-thread_queue_size 50k ^
-r 15 ^
-i "video=Trust Webcam" ^
-f dshow ^
-channel_layout stereo ^
-thread_queue_size 50k ^
-strict normal ^
-i "audio=Microfoon (Thronmax MDrill Dome)" ^
-map 0:v ^
-max_muxing_queue_size 50k ^
-f rtsp ^
-rtsp_transport tcp ^
-buffer_size 50M ^
-max_interleave_delta 0 ^
-c:v libx264 ^
-r 15 ^
-preset ultrafast ^
-tune zerolatency ^
-strict strict ^
-crf 28 ^
-pix_fmt yuv422p ^
-map 1:a ^
-max_muxing_queue_size 50k ^
-max_interleave_delta 0 ^
-c:a aac ^
-strict strict ^
-ac 2 ^
rtsp://localhost:7000

Upvotes: 0

Gyan
Gyan

Reputation: 93038

Use a streaming format like MPEG-TS

ffmpeg -i "https://Some livestream" -c copy "C:\ffmpeg\test.mp4" -c copy -f mpegts - | ffplay -fs -

Upvotes: 4

Related Questions