<div dir="ltr"><div>I'm trying to capture a webcam stream using the FFMPEG C API in windows. I can do what I want using the following command line options: </div><div><br></div><div>    "ffmpeg -f dshow -vcodec mjpeg -s 1280x720 -framerate 30 -i video=HX-A1:audio="Microphone (HX-A1)" outputFile.mpg"</div><div><br></div><div><br></div><div>I've started out with the transcoding.c example and got it working for recording another dshow device like screen-capture-recorder. However, I need to set the encoder options for my real webcam as done above in the command line because it defaults to 160x120 and raw video. I've tried using an AVDictionary when I open the input format context but it does not appear to be doing anything.</div><div><br></div><div>    AVDictionary *opt = NULL;</div><div><span class="" style="white-space:pre"> </span>av_dict_set(&opt, "vcodec", "mjpeg", 0);</div><div><span class="" style="white-space:pre">   </span>av_dict_set(&opt, "s", "1280x720", 0);</div><div>        av_dict_set(&opt , "framerate", "30", 0);<br></div><div><span class="" style="white-space:pre">      </span>if ((ret = avformat_open_input(&ifmt_ctx, filename, inputFormat, &opt)) < 0) {</div><div><span class="" style="white-space:pre">          </span>av_log(NULL, AV_LOG_ERROR, "Cannot open input file\n");</div><div><span class="" style="white-space:pre">          </span>return ret;</div><div><span class="" style="white-space:pre">        </span>}</div><div><br></div><div>How should I be telling the camera what codec to use as done in my command line example? </div><div><br></div><div><br></div><div>Casey Price</div></div>