View previous topic :: View next topic |
Author |
Message |
thender Tux's lil' helper
Joined: 26 Aug 2013 Posts: 125
|
Posted: Tue Aug 26, 2014 8:09 am Post subject: Recording two simultaneous video streams - possible? |
|
|
I want to buy two of this
http://www.telepresencegear.com/hdmi-to-usb-3-0-converter/
And use it to capture two cameras - one camcorder , and one microscope camera, to two separate video files. I want them to have the same start time, so it's not like i have two separate capture apps and hit record in both and then have to manually sync them up later. I'm looking for something that can start recording from both of these to separate files that start at the SAME TIME. The camcorder stream will have HDMI audio, the microscope stream will be video only, both will be 1080p60.
Does software in Linux exist that will do this? I asked about using zoneminder for this and offered a donation just to answer the question but never heard back from them. I figure it's an annoying question if no one will answer it even for $100.
Thanks! |
|
Back to top |
|
|
Ant P. Watchman
Joined: 18 Apr 2009 Posts: 6920
|
Posted: Tue Aug 26, 2014 12:26 pm Post subject: |
|
|
ffmpeg can do that without a problem using multiple -i and -map options, as long as they both show up as v4l devices. |
|
Back to top |
|
|
thender Tux's lil' helper
Joined: 26 Aug 2013 Posts: 125
|
Posted: Tue Aug 26, 2014 3:25 pm Post subject: |
|
|
Ant P. wrote: | ffmpeg can do that without a problem using multiple -i and -map options, as long as they both show up as v4l devices. |
Thank you for the suggestion.
I am reading this manual here. https://www.ffmpeg.org/ffmpeg.html
It gives a decent amount of information, but I can't manage to find any real world examples or information on using a USB device as an input stream. Do you know of any manuals or documentation that might be suited to what I am trying to do? |
|
Back to top |
|
|
Ant P. Watchman
Joined: 18 Apr 2009 Posts: 6920
|
Posted: Wed Aug 27, 2014 12:36 am Post subject: |
|
|
You'd be better off reading the wiki as a starting point, the full manual is hard to follow without experience. At the bare minimum here's something that should work (assuming both cameras already configured):
Code: | ffmpeg -f v4l2 -framerate 30 -size vga -i /dev/video0 \
-f v4l2 -framerate 30 -size vga -i /dev/video1 \
-map 0 camera1.webm \
-map 1 camera2.webm |
|
|
Back to top |
|
|
thender Tux's lil' helper
Joined: 26 Aug 2013 Posts: 125
|
Posted: Wed Aug 27, 2014 3:30 am Post subject: |
|
|
Ant P. wrote: | You'd be better off reading the wiki as a starting point, the full manual is hard to follow without experience. At the bare minimum here's something that should work (assuming both cameras already configured):
Code: | ffmpeg -f v4l2 -framerate 30 -size vga -i /dev/video0 \
-f v4l2 -framerate 30 -size vga -i /dev/video1 \
-map 0 camera1.webm \
-map 1 camera2.webm |
|
Thanks!
I do not have the video capture device yet. I figured I'd try this on my laptop's webcam, which is at /dev/video0 to see how it works. I get this.
Code: | ffmpeg -f v4l2 -framerate 30 -size vga -i /dev/video0 \
ffmpeg version 2.2.7 Copyright (c) 2000-2014 the FFmpeg developers
built on Aug 26 2014 23:21:08 with gcc 4.8.3 (Gentoo 4.8.3 p1.1, pie-0.5.9)
configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared --cc=x86_64-pc-linux-gnu-gcc --cxx=x86_64-pc-linux-gnu-g++ --ar=x86_64-pc-linux-gnu-ar --optflags='-march=native -O3 -pipe' --extra-cflags='-march=native -O3 -pipe' --extra-cxxflags='-march=native -O3 -pipe' --disable-static --enable-gpl --enable-postproc --enable-avfilter --enable-avresample --disable-stripping --enable-version3 --disable-indev=v4l2 --disable-outdev=v4l2 --disable-indev=oss --disable-indev=jack --disable-outdev=oss --enable-bzlib --disable-runtime-cpudetect --disable-debug --disable-doc --disable-gnutls --enable-hardcoded-tables --enable-iconv --enable-network --disable-openssl --enable-ffplay --enable-vaapi --disable-vdpau --enable-zlib --enable-libvo-aacenc --disable-libvo-amrwbenc --enable-libmp3lame --disable-libaacplus --disable-libfaac --enable-libtheora --disable-libtwolame --enable-libwavpack --disable-libwebp --enable-libx264 --disable-libx265 --enable-libxvid --disable-libcdio --disable-libiec61883 --disable-libdc1394 --disable-libcaca --disable-openal --enable-opengl --disable-libv4l2 --enable-libpulse --enable-x11grab --disable-libflite --disable-frei0r --disable-fontconfig --disable-ladspa --disable-libass --enable-libfreetype --disable-libsoxr --disable-pthreads --disable-libopencore-amrwb --disable-libopencore-amrnb --disable-libfdk-aac --disable-libopenjpeg --disable-libbluray --disable-libcelt --disable-libgme --disable-libgsm --disable-libmodplug --enable-libopus --disable-libquvi --disable-librtmp --disable-libssh --disable-libschroedinger --disable-libspeex --enable-libvorbis --disable-libvpx --disable-libzvbi --disable-armv5te --disable-armv6 --disable-armv6t2 --disable-neon --disable-vfp --disable-mips32r2 --disable-mipsdspr1 --disable-mipsdspr2 --disable-mipsfpu --disable-altivec --disable-amd3dnow --disable-amd3dnowext --disable-avx --disable-avx2 --disable-fma3 --disable-fma4 --disable-mmxext --disable-sse3 --disable-ssse3 --disable-sse4 --disable-sse42 --cpu=host
libavutil 52. 66.100 / 52. 66.100
libavcodec 55. 52.102 / 55. 52.102
libavformat 55. 33.100 / 55. 33.100
libavdevice 55. 10.100 / 55. 10.100
libavfilter 4. 2.100 / 4. 2.100
libavresample 1. 2. 0 / 1. 2. 0
libswscale 2. 5.102 / 2. 5.102
libswresample 0. 18.100 / 0. 18.100
libpostproc 52. 3.100 / 52. 3.100
Unrecognized option 'size'.
Error splitting the argument list: Option not found
Conversion failed!
|
Here is the script I used.
Code: | # cat scriptrecording.log
ffmpeg -f v4l2 -framerate 30 -size vga -i /dev/video0 \
-map 0 camera1.webm
|
What am I doing wrong here? I tested /dev/video0 in Cheese, and I can see myself.
I tried removing size, and get this.
Code: | # ./scriptrecording.log
ffmpeg version 2.2.7 Copyright (c) 2000-2014 the FFmpeg developers
built on Aug 26 2014 23:21:08 with gcc 4.8.3 (Gentoo 4.8.3 p1.1, pie-0.5.9)
configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared --cc=x86_64-pc-linux-gnu-gcc --cxx=x86_64-pc-linux-gnu-g++ --ar=x86_64-pc-linux-gnu-ar --optflags='-march=native -O3 -pipe' --extra-cflags='-march=native -O3 -pipe' --extra-cxxflags='-march=native -O3 -pipe' --disable-static --enable-gpl --enable-postproc --enable-avfilter --enable-avresample --disable-stripping --enable-version3 --disable-indev=v4l2 --disable-outdev=v4l2 --disable-indev=oss --disable-indev=jack --disable-outdev=oss --enable-bzlib --disable-runtime-cpudetect --disable-debug --disable-doc --disable-gnutls --enable-hardcoded-tables --enable-iconv --enable-network --disable-openssl --enable-ffplay --enable-vaapi --disable-vdpau --enable-zlib --enable-libvo-aacenc --disable-libvo-amrwbenc --enable-libmp3lame --disable-libaacplus --disable-libfaac --enable-libtheora --disable-libtwolame --enable-libwavpack --disable-libwebp --enable-libx264 --disable-libx265 --enable-libxvid --disable-libcdio --disable-libiec61883 --disable-libdc1394 --disable-libcaca --disable-openal --enable-opengl --disable-libv4l2 --enable-libpulse --enable-x11grab --disable-libflite --disable-frei0r --disable-fontconfig --disable-ladspa --disable-libass --enable-libfreetype --disable-libsoxr --disable-pthreads --disable-libopencore-amrwb --disable-libopencore-amrnb --disable-libfdk-aac --disable-libopenjpeg --disable-libbluray --disable-libcelt --disable-libgme --disable-libgsm --disable-libmodplug --enable-libopus --disable-libquvi --disable-librtmp --disable-libssh --disable-libschroedinger --disable-libspeex --enable-libvorbis --disable-libvpx --disable-libzvbi --disable-armv5te --disable-armv6 --disable-armv6t2 --disable-neon --disable-vfp --disable-mips32r2 --disable-mipsdspr1 --disable-mipsdspr2 --disable-mipsfpu --disable-altivec --disable-amd3dnow --disable-amd3dnowext --disable-avx --disable-avx2 --disable-fma3 --disable-fma4 --disable-mmxext --disable-sse3 --disable-ssse3 --disable-sse4 --disable-sse42 --cpu=host
libavutil 52. 66.100 / 52. 66.100
libavcodec 55. 52.102 / 55. 52.102
libavformat 55. 33.100 / 55. 33.100
libavdevice 55. 10.100 / 55. 10.100
libavfilter 4. 2.100 / 4. 2.100
libavresample 1. 2. 0 / 1. 2. 0
libswscale 2. 5.102 / 2. 5.102
libswresample 0. 18.100 / 0. 18.100
libpostproc 52. 3.100 / 52. 3.100
Unknown input format: 'v4l2'
Conversion failed!
./scriptrecording.log: line 2: -map: command not found
|
|
|
Back to top |
|
|
thender Tux's lil' helper
Joined: 26 Aug 2013 Posts: 125
|
Posted: Wed Aug 27, 2014 1:07 pm Post subject: |
|
|
Since guvcview & cheese work where ffmpeg doesn't, is there a way to get one of those programs to record from two devices with the hit of one button? This would solve everything. |
|
Back to top |
|
|
krinn Watchman
Joined: 02 May 2003 Posts: 7470
|
Posted: Wed Aug 27, 2014 1:39 pm Post subject: |
|
|
I think AntP gave you the solve.
With many ffmpeg options, they are working only for certain codec, in certain form.
You can map two diff channels of the same file, but i'm not sure AntP trys to map them in two files is what the map option is for. Considering ffmpeg usage of -i what he has suggest would have been more a -o file1 -o file2 in ffmpeg style. But there's just no multi -o usage in ffmpeg.
And again, only in certain format: so be sure to use a container that can handle multi-channels streams.
Record from the two streams in entry so they are sync, and map them within the same file to two channels.
Once done, you have a file with two streams that were record at the same time. You can then easy extract them into two separate files to do what you want with them. |
|
Back to top |
|
|
Ant P. Watchman
Joined: 18 Apr 2009 Posts: 6920
|
Posted: Wed Aug 27, 2014 10:16 pm Post subject: |
|
|
Whoops, meant to write -video_size instead of -size. Or just -s works.
I'm not sure why your shell isn't interpreting a backslash line continuation correctly. Try it without. |
|
Back to top |
|
|
thender Tux's lil' helper
Joined: 26 Aug 2013 Posts: 125
|
Posted: Thu Aug 28, 2014 1:13 am Post subject: |
|
|
I tried
ffmpeg -framerate 10 -video_size vga -i /dev/video0
then
ffmpeg -f yuv -framerate 10 -video_size vga -i /dev/video0
then
ffmpeg -f v4l2 -framerate 10 -video_size vga -i /dev/video0
then
ffmpeg -f mjpg -framerate 10 -video_size vga -i /dev/video0
then
ffmpeg -f mjpeg -framerate 10 -video_size vga -i /dev/video0
Nothing, just errors on unknown input format
Here is the output of v42l listing the formats I can capture.
Code: | # v4l2-ctl --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
Index : 0
Type : Video Capture
Pixel Format: 'YUYV'
Name : YUV 4:2:2 (YUYV)
Size: Discrete 640x480
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Size: Discrete 320x180
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Size: Discrete 320x240
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Size: Discrete 352x288
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Size: Discrete 424x240
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Size: Discrete 640x360
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Size: Discrete 848x480
Interval: Discrete 0.050s (20.000 fps)
Size: Discrete 960x540
Interval: Discrete 0.067s (15.000 fps)
Size: Discrete 1280x720
Interval: Discrete 0.100s (10.000 fps)
Index : 1
Type : Video Capture
Pixel Format: 'MJPG' (compressed)
Name : MJPEG
Size: Discrete 640x480
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Size: Discrete 320x180
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Size: Discrete 320x240
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Size: Discrete 352x288
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Size: Discrete 424x240
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Size: Discrete 640x360
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Size: Discrete 848x480
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Size: Discrete 960x540
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.067s (15.000 fps)
Size: Discrete 1280x720
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.067s (15.000 fps)
|
What am I doing wrong? |
|
Back to top |
|
|
thender Tux's lil' helper
Joined: 26 Aug 2013 Posts: 125
|
Posted: Sat Aug 30, 2014 12:10 am Post subject: |
|
|
I figured this was impossible. Ah well. |
|
Back to top |
|
|
Chiitoo Administrator
Joined: 28 Feb 2010 Posts: 2571 Location: Here and Away Again
|
Posted: Sat Aug 30, 2014 2:43 pm Post subject: ><)))°€ |
|
|
thender wrote: | I figured this was impossible. Ah well. |
I wont let you give up just yet!
It takes a while to get used to the monster that is ffmpeg, but once you do, almost anything should be possible (except for maybe flying around the world with it).
When Ant P. suggested to try without it, I believe they meant the backslash, not everything after it. In your examples there, you have no output file at all, so that would indeed fail to do anything useful.
Try something like this:
Code: | ffmpeg -f v4l2 -framerate 30 -video_size vga -i /dev/video0 -map 0 test_output_file.mp4 |
The -map 0 could be left off here, since we're only working with one stream so it would be 0 either way.
So with two inputs, you'd simply add the additional input and map.
I hope this helps! _________________ Kindest of regardses. |
|
Back to top |
|
|
thender Tux's lil' helper
Joined: 26 Aug 2013 Posts: 125
|
Posted: Sun Aug 31, 2014 1:13 am Post subject: |
|
|
The problem is that it does not understand the v4l2 format at all. See below.
Code: | portable-bauer louis # ffmpeg -f v4l2 -framerate 30 -video_size vga -i /dev/video0 -map 0 test_output_file.mp4
ffmpeg version 2.2.7 Copyright (c) 2000-2014 the FFmpeg developers
built on Aug 30 2014 00:20:29 with gcc 4.8.3 (Gentoo 4.8.3 p1.1, pie-0.5.9)
configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared --cc=x86_64-pc-linux-gnu-gcc --cxx=x86_64-pc-linux-gnu-g++ --ar=x86_64-pc-linux-gnu-ar --optflags='-march=native -O3 -pipe' --extra-cflags='-march=native -O3 -pipe' --extra-cxxflags='-march=native -O3 -pipe' --disable-static --enable-gpl --enable-postproc --enable-avfilter --enable-avresample --disable-stripping --enable-version3 --disable-indev=v4l2 --disable-outdev=v4l2 --disable-indev=oss --disable-indev=jack --disable-outdev=oss --enable-bzlib --disable-runtime-cpudetect --disable-debug --disable-doc --disable-gnutls --enable-hardcoded-tables --enable-iconv --enable-network --disable-openssl --enable-ffplay --enable-vaapi --disable-vdpau --enable-zlib --enable-libvo-aacenc --disable-libvo-amrwbenc --enable-libmp3lame --disable-libaacplus --disable-libfaac --enable-libtheora --disable-libtwolame --enable-libwavpack --disable-libwebp --enable-libx264 --disable-libx265 --enable-libxvid --disable-libcdio --disable-libiec61883 --disable-libdc1394 --disable-libcaca --disable-openal --enable-opengl --disable-libv4l2 --enable-libpulse --enable-x11grab --disable-libflite --disable-frei0r --disable-fontconfig --disable-ladspa --disable-libass --enable-libfreetype --disable-libsoxr --disable-pthreads --disable-libopencore-amrwb --disable-libopencore-amrnb --disable-libfdk-aac --disable-libopenjpeg --disable-libbluray --disable-libcelt --disable-libgme --disable-libgsm --disable-libmodplug --enable-libopus --disable-libquvi --disable-librtmp --disable-libssh --disable-libschroedinger --disable-libspeex --enable-libvorbis --disable-libvpx --disable-libzvbi --disable-armv5te --disable-armv6 --disable-armv6t2 --disable-neon --disable-vfp --disable-mips32r2 --disable-mipsdspr1 --disable-mipsdspr2 --disable-mipsfpu --disable-altivec --disable-amd3dnow --disable-amd3dnowext --disable-avx --disable-avx2 --disable-fma3 --disable-fma4 --disable-mmxext --disable-sse3 --disable-ssse3 --disable-sse4 --disable-sse42 --cpu=host
libavutil 52. 66.100 / 52. 66.100
libavcodec 55. 52.102 / 55. 52.102
libavformat 55. 33.100 / 55. 33.100
libavdevice 55. 10.100 / 55. 10.100
libavfilter 4. 2.100 / 4. 2.100
libavresample 1. 2. 0 / 1. 2. 0
libswscale 2. 5.102 / 2. 5.102
libswresample 0. 18.100 / 0. 18.100
libpostproc 52. 3.100 / 52. 3.100
Unknown input format: 'v4l2'
Conversion failed! |
I did try v4l2-ctl --list-formats-ext and it did tell me YUYV and MJPG were supported formats, but none of those work either.
I did try to get ffmpeg to list the formats, but apparently this command in ffmpeg's own documentation doesn't work either.
Code: | # ffmpeg -list_formats all -f v4l2 -i /dev/video0
ffmpeg version 2.2.7 Copyright (c) 2000-2014 the FFmpeg developers
built on Aug 30 2014 00:20:29 with gcc 4.8.3 (Gentoo 4.8.3 p1.1, pie-0.5.9)
configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared --cc=x86_64-pc-linux-gnu-gcc --cxx=x86_64-pc-linux-gnu-g++ --ar=x86_64-pc-linux-gnu-ar --optflags='-march=native -O3 -pipe' --extra-cflags='-march=native -O3 -pipe' --extra-cxxflags='-march=native -O3 -pipe' --disable-static --enable-gpl --enable-postproc --enable-avfilter --enable-avresample --disable-stripping --enable-version3 --disable-indev=v4l2 --disable-outdev=v4l2 --disable-indev=oss --disable-indev=jack --disable-outdev=oss --enable-bzlib --disable-runtime-cpudetect --disable-debug --disable-doc --disable-gnutls --enable-hardcoded-tables --enable-iconv --enable-network --disable-openssl --enable-ffplay --enable-vaapi --disable-vdpau --enable-zlib --enable-libvo-aacenc --disable-libvo-amrwbenc --enable-libmp3lame --disable-libaacplus --disable-libfaac --enable-libtheora --disable-libtwolame --enable-libwavpack --disable-libwebp --enable-libx264 --disable-libx265 --enable-libxvid --disable-libcdio --disable-libiec61883 --disable-libdc1394 --disable-libcaca --disable-openal --enable-opengl --disable-libv4l2 --enable-libpulse --enable-x11grab --disable-libflite --disable-frei0r --disable-fontconfig --disable-ladspa --disable-libass --enable-libfreetype --disable-libsoxr --disable-pthreads --disable-libopencore-amrwb --disable-libopencore-amrnb --disable-libfdk-aac --disable-libopenjpeg --disable-libbluray --disable-libcelt --disable-libgme --disable-libgsm --disable-libmodplug --enable-libopus --disable-libquvi --disable-librtmp --disable-libssh --disable-libschroedinger --disable-libspeex --enable-libvorbis --disable-libvpx --disable-libzvbi --disable-armv5te --disable-armv6 --disable-armv6t2 --disable-neon --disable-vfp --disable-mips32r2 --disable-mipsdspr1 --disable-mipsdspr2 --disable-mipsfpu --disable-altivec --disable-amd3dnow --disable-amd3dnowext --disable-avx --disable-avx2 --disable-fma3 --disable-fma4 --disable-mmxext --disable-sse3 --disable-ssse3 --disable-sse4 --disable-sse42 --cpu=host
libavutil 52. 66.100 / 52. 66.100
libavcodec 55. 52.102 / 55. 52.102
libavformat 55. 33.100 / 55. 33.100
libavdevice 55. 10.100 / 55. 10.100
libavfilter 4. 2.100 / 4. 2.100
libavresample 1. 2. 0 / 1. 2. 0
libswscale 2. 5.102 / 2. 5.102
libswresample 0. 18.100 / 0. 18.100
libpostproc 52. 3.100 / 52. 3.100
Unrecognized option 'list_formats'.
Error splitting the argument list: Option not found
Conversion failed! |
I really do want this to work, but this is just such a cobbled together system, from the capturing to the editing that it's killing me. I don't mind editing a slideshow in kdenlive with no multicore effects, no GPU accelerated decoding, but when the software used for capturing has documentation that lists commands that no longer are relevant, it's over my head.
I would love any hint as to get this to work, as I'd rather work with Linux than any other OS, but it's not easy |
|
Back to top |
|
|
krinn Watchman
Joined: 02 May 2003 Posts: 7470
|
Posted: Sun Aug 31, 2014 2:02 am Post subject: |
|
|
thender wrote: | The problem is that it does not understand the v4l2 format at all. See below.
Code: | portable-bauer louis # ffmpeg -f v4l2 -framerate 30 -video_size vga -i /dev/video0 -map 0 test_output_file.mp4
ffmpeg version 2.2.7 Copyright (c) 2000-2014 the FFmpeg developers
built on Aug 30 2014 00:20:29 with gcc 4.8.3 (Gentoo 4.8.3 p1.1, pie-0.5.9)
configuration: --prefix=/usr ...
...
--disable-indev=v4l2 --disable-outdev=v4l2 --disable-libv4l2
...
|
|
I think we saw below, but did you? |
|
Back to top |
|
|
thender Tux's lil' helper
Joined: 26 Aug 2013 Posts: 125
|
Posted: Sun Aug 31, 2014 2:04 am Post subject: |
|
|
krinn wrote: | thender wrote: | The problem is that it does not understand the v4l2 format at all. See below.
Code: | portable-bauer louis # ffmpeg -f v4l2 -framerate 30 -video_size vga -i /dev/video0 -map 0 test_output_file.mp4
ffmpeg version 2.2.7 Copyright (c) 2000-2014 the FFmpeg developers
built on Aug 30 2014 00:20:29 with gcc 4.8.3 (Gentoo 4.8.3 p1.1, pie-0.5.9)
configuration: --prefix=/usr ...
...
--disable-indev=v4l2 --disable-outdev=v4l2 --disable-libv4l2
...
|
|
I think we saw below, but did you? |
What's interesting to me is that I have v4l2 as a use flag and it disabled it in compiling anyway. Grr! Time to redo.
NICE CATCH! Thank you greatly. |
|
Back to top |
|
|
thender Tux's lil' helper
Joined: 26 Aug 2013 Posts: 125
|
Posted: Sun Aug 31, 2014 2:59 am Post subject: |
|
|
krinn wrote: |
I think we saw below, but did you? |
Ok, recompiled with --enable-indev=v4l2 --enable-outdev=v4l2 --enable-libv4l2 and here is what I get.
Code: | # ffmpeg -f vl42 -s 640x480 -i /dev/video0 output.mpg | grep vl42
ffmpeg version N-65991-g8c63a0d Copyright (c) 2000-2014 the FFmpeg developers
built on Aug 30 2014 22:55:37 with gcc 4.8.3 (Gentoo 4.8.3 p1.1, pie-0.5.9)
configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared --cc=x86_64-pc-linux-gnu-gcc --cxx=x86_64-pc-linux-gnu-g++ --ar=x86_64-pc-linux-gnu-ar --optflags='-march=native -O3 -pipe' --extra-cflags='-march=native -O3 -pipe' --extra-cxxflags='-march=native -O3 -pipe' --disable-static --enable-gpl --enable-postproc --enable-avfilter --enable-avresample --disable-stripping --enable-version3 --enable-indev=v4l2 --enable-outdev=v4l2 --disable-indev=oss --disable-indev=jack --disable-outdev=oss --enable-bzlib --disable-runtime-cpudetect --disable-debug --disable-doc --disable-gnutls --enable-hardcoded-tables --enable-iconv --enable-network --disable-openssl --enable-ffplay --enable-vaapi --disable-vdpau --enable-zlib --enable-libvo-aacenc --disable-libvo-amrwbenc --enable-libmp3lame --enable-libfaac --enable-libtheora --disable-libtwolame --enable-libwavpack --disable-libwebp --enable-libx264 --disable-libx265 --enable-libxvid --disable-libcdio --disable-libiec61883 --disable-libdc1394 --disable-libcaca --disable-openal --enable-opengl --enable-libv4l2 --enable-libpulse --enable-x11grab --disable-libflite --enable-frei0r --disable-fontconfig --disable-ladspa --disable-libass --enable-libfreetype --disable-libsoxr --disable-pthreads --disable-libopencore-amrwb --disable-libopencore-amrnb --disable-libfdk-aac --disable-libbluray --disable-libcelt --disable-libgme --disable-libgsm --disable-libmodplug --enable-libopus --disable-libquvi --disable-librtmp --disable-libssh --disable-libschroedinger --enable-libspeex --enable-libvorbis --disable-libvpx --disable-libzvbi --disable-armv5te --disable-armv6 --disable-armv6t2 --disable-neon --disable-vfp --disable-mips32r2 --disable-mipsdspr1 --disable-mipsdspr2 --disable-mipsfpu --disable-altivec --disable-amd3dnow --disable-amd3dnowext --enable-avx --enable-avx2 --enable-fma3 --enable-fma4 --enable-mmxext --enable-sse3 --enable-ssse3 --enable-sse4 --enable-sse42 --cpu=host --enable-nonfree
libavutil 54. 7.100 / 54. 7.100
libavcodec 56. 1.100 / 56. 1.100
libavformat 56. 3.100 / 56. 3.100
libavdevice 56. 0.100 / 56. 0.100
libavfilter 5. 0.103 / 5. 0.103
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 0.100 / 3. 0.100
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 0.100 / 53. 0.100
Unknown input format: 'vl42' |
Same thing.. so what now? |
|
Back to top |
|
|
krinn Watchman
Joined: 02 May 2003 Posts: 7470
|
Posted: Sun Aug 31, 2014 11:14 am Post subject: |
|
|
thender wrote: | Same thing.. so what now? |
Exactly, same thing... still have shit in eyes
Code: | # ffmpeg -f vl42 -s 640x480 -i /dev... |
vl42 is not v4l2 ... and is not a format, what it just has tell you.
If you want reply with a facepalm picture, i think it's the right time... ps: pickup one with captain picard, i love that one. |
|
Back to top |
|
|
thender Tux's lil' helper
Joined: 26 Aug 2013 Posts: 125
|
Posted: Sun Aug 31, 2014 7:31 pm Post subject: |
|
|
I figured this out last night.. not figured out, but I tried typing the command and it magically worked. I didn't go back to figure out why. I was hoping it would be for something less stupid. God damn am I dumb! |
|
Back to top |
|
|
thender Tux's lil' helper
Joined: 26 Aug 2013 Posts: 125
|
Posted: Fri Sep 05, 2014 3:52 am Post subject: |
|
|
I got the USB dongle and it works great. Silly question though. It is supposed to support audio via the HDMI in. I can't find the device in pulse, and if I pull up guvcviewer, I see pulse, and my basic intel hdaudio integrated. Any clue or hint as to how I can look up if this thing really supports audio inan HDMI stream using V4L2?
Hopefully there is a simple solution and I just have shit in my ears this time.
This is the dongle. Pretty amazing for video so far |
|
Back to top |
|
|
thender Tux's lil' helper
Joined: 26 Aug 2013 Posts: 125
|
Posted: Fri Sep 05, 2014 4:09 am Post subject: |
|
|
I got the USB dongle and it works great. Silly question though. It is supposed to support audio via the HDMI in. I can't find the device in pulse, and if I pull up guvcviewer, I see pulse, and my basic intel hdaudio integrated. Any clue or hint as to how I can look up if this thing really supports audio in an HDMI stream using V4L2?
I tried this command to see what audio input devices were attached, and it doesn't recognize the dongle as anything.
Code: | # arecord -l
**** List of CAPTURE Hardware Devices ****
card 1: PCH [HDA Intel PCH], device 0: ALC3232 Analog [ALC3232 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0 |
V4L2 sees the magewell dongle clear as day.
Code: | # v4l2-ctl --list-devices
Integrated Camera (usb-0000:00:14.0-12):
/dev/video0
XI100DUSB-HDMI (usb-0000:00:14.0-2):
/dev/video2
|
But I can't find the audio anywhere. Hopefully there is a simple solution and I just have shit in my ears this time.
This is the dongle. It claims to support ALSA in Linux.
http://www.magewell.com/hardware/dongles/xi100dusb-hdmi/xi100dusb-hdmi_features.html?lang=en |
|
Back to top |
|
|
thender Tux's lil' helper
Joined: 26 Aug 2013 Posts: 125
|
Posted: Fri Sep 05, 2014 4:31 am Post subject: |
|
|
I recompiled my kernel and enabled some more options in the sound section. so now I get this.
Code: | # arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: Dummy [Dummy], device 0: Dummy PCM [Dummy PCM]
Subdevices: 8/8
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
Subdevice #7: subdevice #7
card 1: Loopback [Loopback], device 0: Loopback PCM [Loopback PCM]
Subdevices: 8/8
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
Subdevice #7: subdevice #7
card 1: Loopback [Loopback], device 1: Loopback PCM [Loopback PCM]
Subdevices: 8/8
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
Subdevice #7: subdevice #7
card 6: PCH [HDA Intel PCH], device 0: ALC3232 Analog [ALC3232 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 7: XI100DUSBHDMI [XI100DUSB-HDMI], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
|
I guess next step is to find the device name of the X100 and come up with a command line to get the audio from it into my video. |
|
Back to top |
|
|
thender Tux's lil' helper
Joined: 26 Aug 2013 Posts: 125
|
Posted: Fri Sep 05, 2014 8:54 pm Post subject: |
|
|
the cool thing is I found a line that works to record lossless audio & video from it
ffmpeg -f v4l2 -framerate 60 -s 1920x1080 -i /dev/video1 -f alsa -i pulse -c:v libx264 -crf 0 -preset ultrafast -c:a pcm_s16le outfile.mkv
the sad part is it only works 1 in 20 times. The other times, you get this.
Code: | /dev/video1: Invalid data found when processing input
[video4linux2,v4l2 @ 0x1fb2e80] Some buffers are still owned by the caller on close.
|
It will eventually work if you quit and run the command 10-40 times, but this obviously won't work if I am trying to record 2 streams at once.. I'll have to quit and start the command 50+ times just to get one working run.
Is there a way to get the buffers to not be owned by anything else so I can capture video properly? |
|
Back to top |
|
|
thender Tux's lil' helper
Joined: 26 Aug 2013 Posts: 125
|
Posted: Sat Sep 06, 2014 3:05 am Post subject: |
|
|
And solved!
Kernel 3.16.1 is absolutely useless for V4L2. 3.14.14 works amazing. No bugs, no buffer nonsense. If you want to use HDMI to USB3 capture dongles with Linux, avoid kernels in ~amd64.
You still get this silly nonsense with haswell integrated audio where everyone sounds like a chipmunk, but that is easily fixed. https://forums.gentoo.org/viewtopic-p-7568876-highlight-.html#7568876
Not only does the V4L2 driver in 3.14.14 work every time - CPU usage is close to nil! Here is the command line I was using before,and getting 110-130% CPU usage on. It is for realtime, lossless compression of the rawvideo stream.
ffmpeg -f v4l2 -framerate 60 -s 1920x1080 -i /dev/video0 -f alsa -i pulse -c:v libx264 -crf 0 -preset ultrafast -c:a pcm_s16le outfile.mkv
Now I get 33% CPU usage for doing the same thing. I am quite happy! |
|
Back to top |
|
|
thender Tux's lil' helper
Joined: 26 Aug 2013 Posts: 125
|
Posted: Sat Oct 04, 2014 10:52 pm Post subject: |
|
|
Sometimes I get this in the middle ofa recording, and it dies. I've tried different dongles, same thing.
"Some buffers are still owned by the caller on close."
Is there a way to either
a) Fix this
b) Get it to make a sound when this happens so I know to look up and start the recording again? |
|
Back to top |
|
|
thender Tux's lil' helper
Joined: 26 Aug 2013 Posts: 125
|
Posted: Wed Oct 08, 2014 11:09 am Post subject: |
|
|
I solved this issue completely and want to go over everything I did to solve it incase anyone else decides to use their machine for the same purpose.
My goal was to record two lossless and/or uncompressed audio & video streams in realtime, together, in sync for editing later, so I can switch back and forth between them or have a splitscreen view where you can see the two cameras at the same time. I am using two Magewell XI100DUSB-HDMI capture dongles, and a dual core laptop. I spoke to many, many people who work in pro video and I was told what I am looking to achieve would not be possible without $1500-$2000 in capture hardware, $800-$1200 in software, and a top of the line octo-core computer. I am currently achieving this task with a dual core laptop with two cheap SSDs in RAID 0, with free software, with $300 capture dongles, and have no issues at all.
I hope this helps someone else in the same place!!
So that buffers owned by callers on close thing is an ffmpeg isolated issue. I finally solved this to my liking by switching to cvlc. The documentation is 100x more confusing, as is the command line syntax, so I just cobbled together what I could from the manual and from reading example posts from others. It really is a lot more confusing than ffmpeg's documentation.
I used this code to record lossless video & uncompressed audio from the camcorder
Code: | cvlc v4l2:// :v4l2-dev=/dev/video1 :v4l2-width=1920 :v4l2-height=1080 --input-slave pulse:// --sout "#transcode{vcodec=HFYU,scale=1}:standard{access=file,dst=camcorder.avi}" |
and this to record lossless video from the microscope.
Code: | cvlc v4l2:// :v4l2-dev=/dev/video2 :v4l2-width=1920 :v4l2-height=1080 --sout "#transcode{vcodec=HFYU,scale=1}:standard{access=file,dst=microscope.avi}" |
This works great for recording lossless video in realtime with no interruptions, even on a laptop, and uncompressed PCM from pulse input. Just remember in pavucontrol to set the input of the recording device after you start recording!
I put each cvlc command that you see above into its own script, /bin/camcorder , /bin/microcorder.
My goal was to record both simultaneously, which I do with parallel, using this.
Code: | parallel sh ::: /bin/camcorder /bin/microcorder |
It actually records the two streams simultaneously, lossless video, uncompressed audio, no skips, and never crashes! I love ffmpeg, I truly do, but the random crashes, and V4L2 buffer errors were making it unusable. I was looking up at top every 20 seconds to see if one of the processes had crashed or stopped recording.
HFYU is an amazing codec, I am encoding not one but TWO 1080p rawvideo 243 MBps(that's MEGABYTES per second) 60 FPS streams in realtime on a dual core laptop WITH CPU TO SPARE! This is great and I appreciate it, but the video that comes out sucks. Can't seek through it, can't edit it in kdenlive without crashing. It's great to archive, but sucks for actual use. x264 is great for actual usage, but I would need an 8 core 3.6 GHz machine to be encoding this.
Not a problem! ffmpeg comes in and saves me! I record to HFYU, but then encode my video to an easier to use format once recording is done and I no longer care about realtime processing. This encodes the HFYU to x264 with no loss in quality.
Code: | ffmpeg -i camcorder.avi -c:v libx264 -qp 0 -preset ultrafast -c:a copy camcorder.mkv |
Code: | ffmpeg -i microcorder.avi c:v libx264 -qp 0 -preset ultrafast mirocorder.mkv |
This turns it into something I can easily play, edit, and seek through, and work with in kdenlive without constant crashing.
and there you have it, my $600 laptop, with two Crucial MX100 $200 SSDs in RAID 0, with two cheap $300 capture devices, and free software is live recording 1080p 60 FPS rawvideo streams with no crashing. I probably could have made back the $4000 I saved in hardware in the time I spent figuring all of this out, but... ah well. |
|
Back to top |
|
|
GetOperational n00b
Joined: 09 Nov 2014 Posts: 1
|
Posted: Sun Nov 09, 2014 3:15 am Post subject: |
|
|
thender: I find your posts very interesting. I hear you on the advice from "video pros" that have this condescending attitude of "you need to step up to the big leagues and drop $5000 like me, otherwise it's impossible". Technology changes but their advice stays the same long after it has ceased to be accurate.
I have spent a great deal of time figuring out how to do lossless 60fps capture and editing using ffmpeg/x11grab. This works well for screencasts, however one thing I cannot do is capture 60fps lossless video in Linux from an external source.
I check every couple months to see if there is something that meets my needs and have come up empty every time, usually the dealbreakers are:
device only works in windows and requires the use of garbage software from the manufacturer to do anything (I'm looking at you Avermedia)
device can't do 60fps at 1080p
device can do 60fps at 1080p but only at a reduced bitrate
device does its own lossy hardware encoding, or downsamples to yuv420 colorspace, making lossless capture impossible
device is super expensive and can only do lossless capture into manufacturer-specific video formats (Blackmagic)
This Magewell device appears to do everything I need:
1080p60 lossless
no weird drivers or proprietary programs
works in Linux
My remaining reservations are:
There are almost no reviews of this thing, which means it's hard to find unbiased evidence proving it does what it says it does.
Distribution seems very limited, often shipping from China and not available in stores. If it was $20 I wouldn't care but at $300 I want to know it works since returning it would be difficult.
Their specs page says it captures YUY2 and RGB24 colorspace video. I am confused as to why it is able to capture rgb24 in the rgb colorspace but is limited to yuv422 in the yuv colorspace, does this mean it cannot capture yuv444 with ffmpeg?
(update: looks like yuv422 is common amongst almost all capture cards, since it also does rgb24 that's good enough for me.)
Any information from someone with the device would be great.
And thanks again to thender for all the useful info. |
|
Back to top |
|
|
|