[FFmpeg-user] -vcodec copy encodes nothing (empty output file) with h264 input

Paul paul at hivetool.org
Mon May 13 12:44:54 CEST 2013

I'm trying to stream from a Logitech C920 camera.  I want to put the camera 
into native h264 mode and use the -vcodec copy option to reduce the cpu load.   
That will work, right?  Ideally it will use a container that will embed in 
html and work with most clients (mp4? matroska? H.264?) but must handle a live 

When I use the -vcodec copy option with -vcodec h264 on the input, I get the 
Output file is empty, nothing was encoded message.

Doesn't work. No data to output file:

ffmpeg -f video4linux2 -vcodec h264 -s 640x480 -r 15 -i /dev/video0 -vcodec 
copy output.mkv

Works but cpu load is about 48%:

ffmpeg -f video4linux2 -vcodec h264 -s 640x480 -r 15 -i /dev/video0 -vcodec 
h264 output.mkv 

Works and cpu load is about 2%! BUT input stream is rawvideo (YUY2) yuyv422. 
(Setting the camera mode with v4l2-ctl to h264 doesn't help as ffmpeg changes 
the mode.):

ffmpeg -f video4linux2 -s 640x480 -r 15 -i /dev/video0 -vcodec copy output.mkv 

I've tried different output containers (mp4, swf) with the same result. I'm 
really trying to stream to ffserver but the above examples give the same 

What stupid thing am I doing wrong?  I see others have the same problem but 
can't find any solutions.

(Not that it matters, but we are trying to monitor bee hives with a Pi: 
hivetool.org and click on the SWF link to see a live feed running on a PC with 
99% cpu utilization...)


More information about the ffmpeg-user mailing list