[Libav-user] Error when open a camera on Android
craig04reg at 21cn.com
craig04reg at 21cn.com
Fri Sep 27 04:36:30 CEST 2013
Hi to all,
I am trying develop an video chat app on android and have ported ffmpeg 2.0.1 to android successfully. The code to open camera is very simple:
AVFormatContext *fmt_ctx = NULL;
AVInputFormat *input_fmt;
input_fmt = av_find_input_format("video4linux2");
if (input_fmt == NULL)
return -1;
char f_name[] = "/dev/video0";
if ((ret = avformat_open_input(&fmt_ctx, f_name, input_fmt, NULL)) < 0) // stuck here
{
LOG_D("can not open camera, ret = %d", ret);
return ret;
}
the strange thing is the ret value is always negative with the following logcat output by av_log:
09-26 15:27:48.901: E/Codec-FFMpeg(17716): ioctl(VIDIOC_G_PARM): Invalid argument
Do i forget anything before calling avformat_open_input()? Thank you!
Regards,
craig
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130927/50f8d628/attachment.html>
More information about the Libav-user
mailing list