[FFmpeg-devel] libavformat and video4linux2 acquire problems

Luca Abeni lucabe72
Tue May 8 13:28:20 CEST 2007

Hi Sandro,

Sandro Cavazzoni wrote:
> Hi to all,
> In this days i started to develop an application based on libavformat  
> and libavcodec, but i run into problems.
> Is this the right mailing list about development with libavformat and  
> libavcodec?
If you found a bug, I think it is ;-)

> i'm trying to acquire a video from an acquisition board with a FUSION  
> 878A chip.
> I open the device with the next code:
> 	AVFormatParameters	formatParameters;
> 	formatParameters.device = inputDevice; 			// /dev/video0
> 	formatParameters.channel = 0;						// It's video composite input on  
> my board
> 	formatParameters.standard = "pal";
> 	formatParameters.width = 768;						// 768 - 384
This looks a strange width. Most of the capture cards I have tried work 
well with width=720, but may behave strangely with width=768...

> 	formatParameters.height = 576;					// 576 - 288
> 	formatParameters.time_base = (AVRational){1,25};
> 	inputFormat = av_find_input_format("video4linux2");
> 	if(av_open_input_file(&inputFormatContext,"", inputFormat, 0,  
> &formatParameters)!=0) {
> 		perror(inputDevice);
> 		return false;
> 	}
> Now i have the next problem: http://develop2.whiteocean.net/test.png
Can you reproduce the problem by using the ffmpeg program?
Something like
./ffmpeg -s 720x576 -f video4linux2 -i /dev/video0 /tmp/out.y4m
If yes, add something like "-v 10" to the command line, and post the 
full output.

> If I try to open the device with VLC before run my application, then  
> my application work correctly
Ah, ok... It seems that the v4l2 input format is not setting something 
on your capture card. Are you using the latest version of libavformat 
from svn? If not, try to upgrade.

> (but v4l2 reduce always my resolution in 640x576 - the strange resolution :)
I think your v4l2 drivers are forcing the resolution to 640x576...

> And why this strage resolution? (640x576 instead the classic 768x576).
I suspect this is a good question for the author of the drivers you are 
using (I have never seen anything similar with bttv, but some other 
drivers force strange resolutions like this). To be sure, try ffmpeg 
with the "-v 10" option, and see if some "The V4L2 driver changed the 
video from ... to ..." message appears.


More information about the ffmpeg-devel mailing list