I am on a Macbook and I am trying to read video from a camera using the ffmpeg library. Camera - 10 meter USB underwater camera. I use the C API through a D binding called ffmpeg-d. However, trying to open the input, I get the following:
[avfoundation @ 0x7fe0d2800000] Selected framerate (29.970030) is not supported by the device [avfoundation @ 0x7fe0d2800000] Supported modes: [avfoundation @ 0x7fe0d2800000] 160x120@ [30.000030 30.000030]fps [avfoundation @ 0x7fe0d2800000] 176x144@ [30.000030 30.000030]fps [avfoundation @ 0x7fe0d2800000] 320x240@ [30.000030 30.000030]fps [avfoundation @ 0x7fe0d2800000] 352x288@ [30.000030 30.000030]fps [avfoundation @ 0x7fe0d2800000] 640x480@ [30.000030 30.000030]fps
So how can I avoid this problem? Will it set the frame rate manually? And if so, how can I do this?
Here is a very short program to replicate my problem.
import std.stdio; import ffmpeg.libavdevice.avdevice; import ffmpeg.libavcodec.avcodec; import ffmpeg.libavformat.avformat; import ffmpeg.libavfilter.avfilter; import ffmpeg.libavutil.avutil; import ffmpeg.libavutil.mem; import ffmpeg.libavutil.pixfmt; import ffmpeg.libswscale.swscale; import std.string; void main() { av_register_all(); avdevice_register_all(); string cameraSource = "USB"; AVCodecContext* cameraCodecContext = null; AVFormatContext* cameraFormatContext = avformat_alloc_context(); AVCodec* cameraCodec = null; AVInputFormat* cameraFormat = av_find_input_format("avfoundation"); AVFrame* rawFrame = null, convertedFrame = null; if (avformat_open_input(&cameraFormatContext, cameraSource.toStringz, cameraFormat, null) != 0) return; }
source share