ffmpeg overwrite v4l2-ctl configuration -> how to do real raw device to network copy?

369 Views Asked by At

I need to do a real device to a tcp socket copy like :

cat /dev/video0 | /bin/nc 127.0.0.1 8000 -w 1

This very basic command line work for my case. I want to do the same, but with the ffmpeg process. The aim is to standardize the streaming process, this case, a basic raw copy from a device to network, and advanced transcoding from any source to network, always with the same ffmpeg process.

I use v4l2-ctl before ffmpeg to make a lot of configuration that I want to keep.

I tried :

ffmpeg -loglevel debug -i /dev/video0 -f rawvideo tcp://127.0.0.1:8000

ffmpeg -loglevel debug -f v4l2 -i /dev/video0 -f rawvideo tcp://127.0.0.1:8000

The probleme here ffmpeg kill my v4l2 configuration, and I don't want to setup it twice (v4l2-ctl interface + ffmpeg interface) in my code.

I also tried :

ffmpeg -loglevel debug -f rawvideo -i /dev/video0 tcp://127.0.0.1:8000

ffmpeg -loglevel debug -f rawvideo -i /dev/video0 -f rawvideo tcp://127.0.0.1:8000

I always get this stderr + exit :

[IMGUTILS @ 0x7ec1d5f0] Picture size 0x0 is invalid
[AVIOContext @ 0x1e8bb40] Statistics: 26 bytes read, 0 seeks
/dev/video0: Invalid argument

I also tried the

-c:v copy

parameter for all combination above without success:(

How to do a raw binary copy (like "cat" or "dd" with NetCat) from a device to socket with ffmpeg (without killing v4l2 configuration) ?

Pascal

0

There are 0 best solutions below