[Libav-user] Set Webcam Encoder C API
cprice1317 at gmail.com
Wed Oct 21 19:44:19 CEST 2015
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:
"ffmpeg -f dshow -vcodec mjpeg -s 1280x720 -framerate 30 -i
video=HX-A1:audio="Microphone (HX-A1)" outputFile.mpg"
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.
AVDictionary *opt = NULL;
av_dict_set(&opt, "vcodec", "mjpeg", 0);
av_dict_set(&opt, "s", "1280x720", 0);
av_dict_set(&opt , "framerate", "30", 0);
if ((ret = avformat_open_input(&ifmt_ctx, filename, inputFormat, &opt)) <
av_log(NULL, AV_LOG_ERROR, "Cannot open input file\n");
How should I be telling the camera what codec to use as done in my command
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Libav-user