0

I use this command to stream a live video from a Raspberry camera:

raspivid -n -ih -t 0 -rot 0 -w 1280 -h 720 -fps 15 -b 1000000 -o - | nc -lkv4 5001

I need a way to stream a H.264 file through netcat like the example above. It must be received in the same way than my Raspberry camera.

Raphael Medaer
  • 2,324
  • 8
  • 16
roye1233
  • 100
  • 12

1 Answers1

1

If your input file is h264, I guess you can simply pipe the file in netcat:

For instance:

cat <yourfile> | nc -lkv4 5001

If you need to do some transcoding you can use ffmpeg. For instance from a MP4/FLV file (see original answer here):

ffmpeg -i <your file>.flv -vcodec copy -an -bsf:v h264_mp4toannexb | nc -lkv4 5001
Raphael Medaer
  • 2,324
  • 8
  • 16
  • It's working, thank you! But, the fps are bad... is there any way I can lower the fps so it will stream without any glitz? thanks again – roye1233 May 07 '20 at 09:08
  • @roye1233 you can also use ffmpeg to reduce the number of FPS, see the following question: https://stackoverflow.com/questions/45462731/using-ffmpeg-to-change-framerate/45465730 – Raphael Medaer May 07 '20 at 10:17