[FFmpeg-devel] libavformat and video4linux2 acquire problems

Sandro Cavazzoni s.cavazzoni
Tue May 8 16:14:09 CEST 2007


Hi Luca,

On 08/mag/07, at 13:28, Luca Abeni wrote:

> 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...

Hmm... the original windows software for this board work with 768x576

this is my board string in lspci
02:00.0 Multimedia video controller: Brooktree Corporation Bt878  
Video Capture (rev 11)
02:00.1 Multimedia controller: Brooktree Corporation Bt878 Audio  
Capture (rev 11)


>
>> 	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.
>
yes... i did the next tests:

ffmpeg -s 720x576 -f video4linux2 -vd /dev/video3 out-720x576.mpg
http://develop2.whiteocean.net/out-720x576.mpg

ffmpeg -s 640x576 -f video4linux2 -vd /dev/video3 out-640x576.mpg
http://develop2.whiteocean.net/out-640x576.mpg

ffmpeg -s 768x576 -f video4linux2 -vd /dev/video3 out-768x576.mpg
http://develop2.whiteocean.net/out-768x576.mpg

I attach the log with -v 10 parameter
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ffmpeg-log.txt
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070508/cdcd9d5a/attachment.txt>
-------------- next part --------------

So I started VLC, i saw my camera and i closed it.
Then i did the next command
ffmpeg -v 10 -s 720x576 -f video4linux2 -vd /dev/video3 out-after- 
vlc.mpg

------------ LOG
FFmpeg version SVN-rUNKNOWN, Copyright (c) 2000-2004 Fabrice Bellard
   configuration:  --enable-gpl --enable-pp --enable-pthreads -- 
enable-vorbis --enable-libogg --enable-a52 --enable-dts --enable- 
libgsm --enable-dc1394 --disable-debug --enable-shared --prefix=/usr
   libavutil version: 0d.49.0.0
   libavcodec version: 0d.51.11.0
   libavformat version: 0d.50.5.0
   built on Mar 26 2007 15:50:40, gcc: 4.1.2 20061115 (prerelease)  
(Debian 4.1.1-21)
[video4linux2 @ 0xb7f40af0][4]Capabilities: 5010015
The V4L2 driver changed the video from 720x576 to 640x576
Input #0, video4linux2, from '':
   Duration: N/A, bitrate: N/A
   Stream #0.0, 1/1000000: Video: rawvideo, yuv420p, 640x576, 1/25,  
110592 kb/s, 25.00 fps(r)
Input #1, audio_device, from '':
   Duration: N/A, bitrate: N/A
   Stream #1.0, 1/1000000: Audio: pcm_s16le, 44100 Hz, mono, 705 kb/s
Output #0, mpeg, to 'out-after-vlc.mpg':
   Stream #0.0, 1/90000: Video: mpeg1video, yuv420p, 720x576, 1/25,  
q=2-31, 200 kb/s, 25.00 fps(c)
   Stream #0.1, 1/90000: Audio: mp2, 44100 Hz, mono, 64 kb/s
Stream mapping:
   Stream #0.0 -> #0.0
   Stream #1.0 -> #0.1
Press [q] to stop encoding
timestamp discontinuity 1178637900662907, new offset= -1178637900662907
timestamp discontinuity 1178637900689696, new offset= -1178637900689696
frame=   83 q=9.5 Lsize=     302kB time=3.3 bitrate= 754.3kbits/s  
dup=0 drop=0
video:274kB audio:26kB global headers:0kB muxing overhead 0.837026%
-------------------

IT WORK!
http://develop2.whiteocean.net/out-after-vlc.mpg
(it's a very cheap camera but it work)


(I used the mpeg format because if I use y4m format i obtain an empty  
file)

> [...]
>> 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.
>
I'm using the version in debian repository. I can't update libraries  
on this linux installation... tomorrow I install a new linux  
distribution so i try to use the last svn snapshot
   libavutil version: 0d.49.0.0
   libavcodec version: 0d.51.11.0
   libavformat version: 0d.50.5.0

>> (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.

The V4L2 driver changed the video from 720x576 to 640x576

Yes, it's true...  but this message appear only after I used my board  
with vlc

Thanks

Sandro



More information about the ffmpeg-devel mailing list