[FFmpeg-devel] No detecting device v4l!!!

María Díaz maria201181
Thu Jul 5 18:14:50 CEST 2007


Hello to all!

I need to detect webcam using the libraries libav, I to codify the video
stream, for that I use the following code:

#include <ffmpeg/avcodec.h>#include <ffmpeg/avformat.h>
**int main(){


 AVInputFormat*      pInputFormat;
 AVFormatParameters  formatParams;
 AVFormatContext*    pFormatCtx;
 AVCodecContext  *   pCodecCtx;

 av_register_all();

 formatParams.device = "/dev/video0";
 formatParams.channel = 0;
 formatParams.standard = "ntsc";
 formatParams.width = 320;
 formatParams.height = 240;
 formatParams.time_base= (AVRational){1,10};

 pInputFormat = av_find_input_format("video4linux");

 *if* ( av_open_input_file(&pFormatCtx,"", pInputFormat, 0, &formatParams)!=
0 )
   printf("Failed opning video device!");
}



But does not open the device, the function "av_open_input_file" returns like
error -12,  Wthat can be? What it will need to the code?

 I have used the following commando:

linux:~ # ffmpeg -s 320*240 -f video4linux -i /dev/video0 Maria.wmv

All good, but I need to handle webcam from libraries...

Thank a lot !!!

Mar?a...




More information about the ffmpeg-devel mailing list