From: Helge Norberg Date: Tue, 4 Oct 2016 10:49:10 +0000 (+0200) Subject: [ffmpeg] Recompiled FFmpeg on Linux with --enable-libv4l2 and allow it to be used... X-Git-Tag: 2.1.0_Beta1~39 X-Git-Url: https://git.sesse.net/?p=casparcg;a=commitdiff_plain;h=c4e32e6af54000d4ef22b74e4c29529151f695e1 [ffmpeg] Recompiled FFmpeg on Linux with --enable-libv4l2 and allow it to be used just as with dshow in Windows with for example v4l2:///dev/video0 --- diff --git a/dependencies64/ffmpeg/bin/linux/libavcodec.so.56.41.100 b/dependencies64/ffmpeg/bin/linux/libavcodec.so.56.41.100 index 958a7d5bc..7deae83ec 100755 Binary files a/dependencies64/ffmpeg/bin/linux/libavcodec.so.56.41.100 and b/dependencies64/ffmpeg/bin/linux/libavcodec.so.56.41.100 differ diff --git a/dependencies64/ffmpeg/bin/linux/libavdevice.so.56.4.100 b/dependencies64/ffmpeg/bin/linux/libavdevice.so.56.4.100 index ce0f4f3c9..e6d2edabd 100755 Binary files a/dependencies64/ffmpeg/bin/linux/libavdevice.so.56.4.100 and b/dependencies64/ffmpeg/bin/linux/libavdevice.so.56.4.100 differ diff --git a/dependencies64/ffmpeg/bin/linux/libavfilter.so.5.16.101 b/dependencies64/ffmpeg/bin/linux/libavfilter.so.5.16.101 index 68e0d5437..2ff28ca7c 100755 Binary files a/dependencies64/ffmpeg/bin/linux/libavfilter.so.5.16.101 and b/dependencies64/ffmpeg/bin/linux/libavfilter.so.5.16.101 differ diff --git a/dependencies64/ffmpeg/bin/linux/libavformat.so.56.36.100 b/dependencies64/ffmpeg/bin/linux/libavformat.so.56.36.100 index 9c6eca110..058ff926a 100755 Binary files a/dependencies64/ffmpeg/bin/linux/libavformat.so.56.36.100 and b/dependencies64/ffmpeg/bin/linux/libavformat.so.56.36.100 differ diff --git a/dependencies64/ffmpeg/bin/linux/libavutil.so.54.27.100 b/dependencies64/ffmpeg/bin/linux/libavutil.so.54.27.100 index 6b63bb149..fad830991 100755 Binary files a/dependencies64/ffmpeg/bin/linux/libavutil.so.54.27.100 and b/dependencies64/ffmpeg/bin/linux/libavutil.so.54.27.100 differ diff --git a/dependencies64/ffmpeg/bin/linux/libpostproc.so.53.3.100 b/dependencies64/ffmpeg/bin/linux/libpostproc.so.53.3.100 index 2a183634c..47ab16f03 100755 Binary files a/dependencies64/ffmpeg/bin/linux/libpostproc.so.53.3.100 and b/dependencies64/ffmpeg/bin/linux/libpostproc.so.53.3.100 differ diff --git a/dependencies64/ffmpeg/bin/linux/libswresample.so.1.2.100 b/dependencies64/ffmpeg/bin/linux/libswresample.so.1.2.100 index 5aa68b334..14e55c7ba 100755 Binary files a/dependencies64/ffmpeg/bin/linux/libswresample.so.1.2.100 and b/dependencies64/ffmpeg/bin/linux/libswresample.so.1.2.100 differ diff --git a/dependencies64/ffmpeg/bin/linux/libswscale.so.3.1.101 b/dependencies64/ffmpeg/bin/linux/libswscale.so.3.1.101 index d094ab771..8fc4a85b3 100755 Binary files a/dependencies64/ffmpeg/bin/linux/libswscale.so.3.1.101 and b/dependencies64/ffmpeg/bin/linux/libswscale.so.3.1.101 differ diff --git a/modules/ffmpeg/producer/ffmpeg_producer.cpp b/modules/ffmpeg/producer/ffmpeg_producer.cpp index 79b68d9f4..8c098e267 100644 --- a/modules/ffmpeg/producer/ffmpeg_producer.cpp +++ b/modules/ffmpeg/producer/ffmpeg_producer.cpp @@ -565,7 +565,7 @@ void describe_producer(core::help_sink& sink, const core::help_repository& repo) ->text(L"H.264, FLV, WMV and several audio codecs as well as uncompressed audio."); sink.definitions() ->item(L"clip", L"The file without the file extension to play. It should reside under the media folder.") - ->item(L"url", L"If clip contains :// it is instead treated as the URL parameter. The URL can either be any streaming protocol supported by FFmpeg or dshow://video={webcam_name}.") + ->item(L"url", L"If clip contains :// it is instead treated as the URL parameter. The URL can either be any streaming protocol supported by FFmpeg, dshow://video={webcam_name} or v4l2://{video device}.") ->item(L"loop", L"Will cause the media file to loop between start and start + length") ->item(L"start", L"Optionally sets the start frame. 0 by default. If loop is specified this will be the frame where it starts over again.") ->item(L"length", L"Optionally sets the length of the clip. If not specified the clip will be played to the end. If loop is specified the file will jump to start position once this number of frames has been played.") @@ -583,7 +583,8 @@ void describe_producer(core::help_sink& sink, const core::help_repository& repo) sink.example(L">> PLAY 1-10 folder/clip CHANNEL_LAYOUT film", L"given the defaults in casparcg.config this will specifies that the clip has 6 audio channels of the type 5.1 and that they are in the order FL FC FR BL BR LFE regardless of what ffmpeg says."); sink.example(L">> PLAY 1-10 folder/clip CHANNEL_LAYOUT \"5.1:LFE FL FC FR BL BR\"", L"specifies that the clip has 6 audio channels of the type 5.1 and that they are in the specified order regardless of what ffmpeg says."); sink.example(L">> PLAY 1-10 rtmp://example.com/live/stream", L"to play an RTMP stream."); - sink.example(L">> PLAY 1-10 \"dshow://video=Live! Cam Chat HD VF0790\"", L"to use a web camera as video input."); + sink.example(L">> PLAY 1-10 \"dshow://video=Live! Cam Chat HD VF0790\"", L"to use a web camera as video input on Windows."); + sink.example(L">> PLAY 1-10 v4l2:///dev/video0", L"to use a web camera as video input on Linux."); sink.para()->text(L"The FFmpeg producer also supports changing some of the settings via ")->code(L"CALL")->text(L":"); sink.example(L">> CALL 1-10 LOOP 1"); sink.example(L">> CALL 1-10 START 10"); diff --git a/modules/ffmpeg/producer/input/input.cpp b/modules/ffmpeg/producer/input/input.cpp index 72648037d..445306f21 100644 --- a/modules/ffmpeg/producer/input/input.cpp +++ b/modules/ffmpeg/producer/input/input.cpp @@ -252,17 +252,21 @@ struct input::implementation : boost::noncopyable auto resource_name = std::wstring(); auto parts = caspar::protocol_split(url_or_file); + auto protocol = parts.at(0); + auto path = parts.at(1); AVInputFormat* input_format = nullptr; - if (parts.at(0).empty()) - resource_name = parts.at(1); - else if (parts.at(0) == L"dshow") + static const std::set PROTOCOLS_TREATED_AS_FORMATS = { L"dshow", L"v4l2" }; + + if (protocol.empty()) + resource_name = path; + else if (PROTOCOLS_TREATED_AS_FORMATS.find(protocol) != PROTOCOLS_TREATED_AS_FORMATS.end()) { - input_format = av_find_input_format("dshow"); - resource_name = parts.at(1); + input_format = av_find_input_format(u8(protocol).c_str()); + resource_name = path; } else - resource_name = parts.at(0) + L"://" + parts.at(1); + resource_name = protocol + L"://" + path; AVFormatContext* weak_context = nullptr; THROW_ON_ERROR2(avformat_open_input(&weak_context, u8(resource_name).c_str(), input_format, &format_options), resource_name);