User Tools

Site Tools


docu:csheet:sysadm:files:share_ffmpeg_stream

Share an ffmpeg stream over tcp with netcat


Sharing an ffmpeg stream over the network can be a very interesting thing to do. From sharing movies at home or your PC monitor, or recording a gameplay remotely.

# Snippets

# Process a video on the server and play it on the client
## Server:
ffmpeg -i "a_video_file.mp4" -f avi pipe:1 | nc -l -p 1234
## Client
nc SERVERIP 1234 | ffplay -fs -i pipe:0

# Share your monitor
# If the server has ffmpeg:
## Server:
ffmpeg -f fbdev -i /dev/fb0 -f avi pipe:1 | nc -l -p 1234
## Client (viewer):
nc SERVERIP 1234 | ffplay -fs -i pipe:0
# If the server doesn't have ffmpeg:
## Server:
sudo cat /dev/fb0 | nc -l -p 1234
## Client (replace 1920x1080 with the server's resolution):
nc SERVERIP 1234 | ffplay -f rawvideo -vcodec rawvideo -pixel_format bgra -video_size 1920x1080 -i pipe:0

Source: https://gist.github.com/cbarraco/f6cb40e3f5eb1f2733b5

docu/csheet/sysadm/files/share_ffmpeg_stream.txt · Last modified: 2023/04/15 19:48 by admin