4
votes

I want to stream webcam live with ffmpeg. My Logitech c920 webcam has an output stream of raw and compressed data. The command ffmpeg -f v4l2 -list_formats all -i /dev/video1 produces the following console output:

[video4linux2,v4l2 @ 0x26709e0] Raw       :   yuyv422 :     YUV 4:2:2 (YUYV) : 640x480 160x90 160x120 176x144 320x180 320x240 352x288 432x240 640x360 800x448 800x600 864x480 960x720 1024x576 1280x720 1600x896 1920x1080 2304x1296 2304x1536
[video4linux2,v4l2 @ 0x26709e0] Compressed:      h264 :                H.264 : 640x480 160x90 160x120 176x144 320x180 320x240 352x288 432x240 640x360 800x448 800x600 864x480 960x720 1024x576 1280x720 1600x896 1920x1080
[video4linux2,v4l2 @ 0x26709e0] Compressed:     mjpeg :                MJPEG : 640x480 160x90 160x120 176x144 320x180 320x240 352x288 432x240 640x360 800x448 800x600 864x480 960x720 1024x576 1280x720 1600x896 1920x1080

I would like to copy compressed h264 image and send it to ffserver.

When I use this command ffmpeg -r 25 -f v4l2 -i /dev/video0 -c:v libx264 -b:v 2500k http://localhost:8090/feed1.ffm program gets the raw data and transcode it with h264 codec.

When I change the -c:v libx264 to -c:v copy I get an error because ffmpeg tries to copy raw camera image.

How can I access h264 compressed image and send it to server?

1
i was wondering if i can ask? How did you post the captured video i mean the output to the server suppose i have a USB camera connected to my computer from that i want to go live.so i need to post the video to server then broadcast it live for users how did you managed to do that please help? - A Sahra
I did not need to go online with the stream. I needed functionality within the same wifi, hence the 'localhost' in the executed command. I used approach described in this answer . Please be advised that ffserver is going to be removed by the next release. I'd advise you to read the ffmpeg streaming guide - grzebyk

1 Answers

2
votes

FFmpeg has a input_format option to specify the format for the input device. Try adding -input_format h264 as an input option to your command.