Opening dshow with avformat_open_input?

For the developers that use FFmpeg in Windows software.

Opening dshow with avformat_open_input?

Postby myle00 » Sat Nov 05, 2011 11:42 pm

Hi,

I'm trying to open a dshow device using avformat_open_input and I'm having trouble figuring out where to put what, avformat_open_input always returns error -5, EIO. The device works fine in ffplay.exe

Here's the example code:
Code: Select all
av_register_all();
   avdevice_register_all();
   AVInputFormat * a= av_find_input_format("dshow");
   AVDictionaryEntry *ad= new AVDictionaryEntry;
   AVDictionary *d= new AVDictionary;
   d->count= 1;
   d->elems= ad;
   ad->value= "Laptop Integrated Webcam";
   ad->key= "video";

   int r;
   // Open the video file
   if((r= avformat_open_input(&m_pFormatCtx, "video=\"Laptop Integrated Webcam\"", a, &d))!=0)


I have tried to make filename an empty string but that didn't help. And making the dictionary NULL didn't work either.

Thanks for any help,
M
myle00
 
Posts: 14
Joined: Wed Jun 08, 2011 7:41 am

Re: Opening dshow with avformat_open_input?

Postby myle00 » Sat Nov 05, 2011 11:47 pm

Agggghhhhh. Never mind, this worked:
Code: Select all
avformat_open_input(&m_pFormatCtx, "video=Laptop Integrated Webcam", a, NULL)


It was the double quotes.
myle00
 
Posts: 14
Joined: Wed Jun 08, 2011 7:41 am

Re: Opening dshow with avformat_open_input?

Postby streaming » Tue Oct 30, 2012 1:24 pm

Hi,

I tried your solution, but failed.
my example code is:
AVFormatContext *pFormatCtx;
av_register_all();
AVInputFormat * a= av_find_input_format("dshow");
avformat_open_input(&pFormatCtx, "video=Mercury USB2.0 Camera", a, NULL);

How can I fix it?
streaming
 
Posts: 7
Joined: Wed Oct 17, 2012 12:31 pm

Re: Opening dshow with avformat_open_input?

Postby rogerdpack » Tue Nov 13, 2012 6:44 pm

http://libav-users.943685.n4.nabble.com ... 46231.html may be useful, though I'm grasping at straws...or maybe https://gist.github.com/3210277
rogerdpack
 
Posts: 1292
Joined: Fri Aug 05, 2011 9:56 pm

Re: Opening dshow with avformat_open_input?

Postby rayyin » Tue Jul 09, 2013 7:24 pm

Hi~How can I capture video and audio at the same time? By passing "video=XXX:audio=XXX" in avformat_open_input()? Seems doesn't work for me...Thanks.
rayyin
 
Posts: 10
Joined: Sat May 04, 2013 2:59 pm


Return to Using FFmpeg In Windows Software

Who is online

Users browsing this forum: No registered users and 2 guests