Hi, with the attached patch, ffmpeg avfoundation device input is able to find my canopus dv firewire adapter. I only have 1 format 'muxed' and it's not possible to set resolution or framerate via 'setValue'.
I've looked at the code in the AVRecorder sample: https://developer.apple.com/library/mac/samplecode/AVRecorder/Introduction/Intro.html it's able to correctly record (audio and video) from dv adapter using almost same api calls of ffmpeg. with my patch ffmpeg is able to record too (video only) but looks like there is a problem with video resolution. http://oss.netfarm.it/mplayer/upload/with-avrecorder.png http://oss.netfarm.it/mplayer/upload/with-ffmpeg.png and videos: http://oss.netfarm.it/mplayer/upload/with-avrecorder.mov http://oss.netfarm.it/mplayer/upload/with-ffmpeg.mp4 I known the patch can be improved, but I should at least solve the resolution problem. Any help would be appreciated Regards -- Gianluigi Tiesi <sher...@netfarm.it> EDP Project Leader Netfarm S.r.l. - http://www.netfarm.it/ Free Software: http://oss.netfarm.it/
diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m index 763e675..d4904a4 100644 --- a/libavdevice/avfoundation.m +++ b/libavdevice/avfoundation.m @@ -320,18 +320,16 @@ static int configure_video_device(AVFormatContext *s, AVCaptureDevice *video_dev goto unsupported_format; } - if (!selected_range) { - av_log(s, AV_LOG_ERROR, "Selected framerate (%f) is not supported by the device\n", - framerate); - goto unsupported_format; - } - if ([video_device lockForConfiguration:NULL] == YES) { - NSValue *min_frame_duration = [selected_range valueForKey:@"minFrameDuration"]; - [video_device setValue:selected_format forKey:@"activeFormat"]; - [video_device setValue:min_frame_duration forKey:@"activeVideoMinFrameDuration"]; - [video_device setValue:min_frame_duration forKey:@"activeVideoMaxFrameDuration"]; + + if (selected_range) { + NSValue *min_frame_duration = [selected_range valueForKey:@"minFrameDuration"]; + [video_device setValue:min_frame_duration forKey:@"activeVideoMinFrameDuration"]; + [video_device setValue:min_frame_duration forKey:@"activeVideoMaxFrameDuration"]; + } + else + av_log(s, AV_LOG_WARNING, "Selected framerate (%f) is not supported by the device\n", framerate); } else { av_log(s, AV_LOG_ERROR, "Could not lock device for configuration"); return AVERROR(EINVAL); @@ -668,7 +666,7 @@ static int avf_read_header(AVFormatContext *s) AVCaptureDevice *video_device = nil; AVCaptureDevice *audio_device = nil; // Find capture device - NSArray *devices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo]; + NSArray *devices = [[AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo] arrayByAddingObjectsFromArray:[AVCaptureDevice devicesWithMediaType:AVMediaTypeMuxed]]; ctx->num_video_devices = [devices count]; ctx->first_pts = av_gettime();
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel