DirectShow Capture support

Announcements made by users.
Post Reply
rogerdpack
Posts: 1882
Joined: Fri Aug 05, 2011 9:56 pm

Re: DirectShow Capture support

Post by rogerdpack »

@mobi1300 I think you just use
-pixel_format XXX

is that enough to select what you want or does it need another parameter? Could you post your full output, too?

re: latency
http://ffmpeg.org/trac/ffmpeg/wiki/StreamingGuide "latency" sub section might help. (note that the audio_buffer_size setting will be available in the next Zeranoe build, or I can get you an experimental build with it).
How are you streaming and what are you using as your player?

@Meierhans did you try the experimental builds I posted? Were they enough?
-r

mobi1300
Posts: 14
Joined: Tue Aug 28, 2012 4:44 am

Re: DirectShow Capture support

Post by mobi1300 »

Hello Rogerdpack:

Sorry for the incomplete info.

Here is the complete output:

PS C:\ffmpeg-test> ./ffmpeg-32 -list_devices true -f dshow -i dummy
ffmpeg version N-43887-g82bb129 Copyright (c) 2000-2012 the FFmpeg developers
built on Aug 24 2012 13:25:03 with gcc 4.7.1 (GCC)
configuration: --enable-gpl --enable-version3 --disable-pthreads --enable-runtime-cpudetect --enable-avisynth --enable
-bzlib --enable-frei0r --enable-libass --enable-libcelt --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-l
ibfreetype --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libopenjpeg --enable-librtmp --enable-libschroed
inger --enable-libspeex --enable-libtheora --enable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-li
bvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
libavutil 51. 70.100 / 51. 70.100
libavcodec 54. 54.100 / 54. 54.100
libavformat 54. 25.104 / 54. 25.104
libavdevice 54. 2.100 / 54. 2.100
libavfilter 3. 13.100 / 3. 13.100
libswscale 2. 1.101 / 2. 1.101
libswresample 0. 15.100 / 0. 15.100
libpostproc 52. 0.100 / 52. 0.100
[dshow @ 020ac400] DirectShow video devices
[dshow @ 020ac400] "Logitech HD Pro Webcam C920"
[dshow @ 020ac400] "Video WebCam"
[dshow @ 020ac400] DirectShow audio devices
[dshow @ 020ac400] "Microphone (Realtek High Defini"
[dshow @ 020ac400] "Microphone (HD Pro Webcam C920)"
dummy: Immediate exit requested

PS C:\ffmpeg-test> ./ffmpeg-32 -list_options true -f dshow -i video="Logitech HD Pro Webcam C920"
ffmpeg version N-43887-g82bb129 Copyright (c) 2000-2012 the FFmpeg developers
built on Aug 24 2012 13:25:03 with gcc 4.7.1 (GCC)
configuration: --enable-memalign-hack --arch=x86 --enable-gpl --enable-libx264 --enable-avisynth --enable-libxvid --ta
rget-os=mingw32 --cross-prefix=/home/rogerdpack/dev/ffmpeg-windows-build-helpers/builds/mingw-w64-i686/bin/i686-w64-ming
w32- --pkg-config=pkg-config --enable-libmp3lame --enable-version3 --enable-libvo-aacenc --enable-libvpx --extra-libs=-l
ws2_32 --extra-libs=-lpthread --enable-zlib --extra-libs=-lwinmm --extra-libs=-lgdi32 --enable-librtmp --enable-libvorbi
s --enable-libtheora --enable-libspeex --enable-libopenjpeg --enable-gnutls --enable-libgsm --enable-runtime-cpudetect
libavutil 51. 70.100 / 51. 70.100
libavcodec 54. 54.100 / 54. 54.100
libavformat 54. 25.104 / 54. 25.104
libavdevice 54. 2.100 / 54. 2.100
libavfilter 3. 13.101 / 3. 13.101
libswscale 2. 1.101 / 2. 1.101
libswresample 0. 15.100 / 0. 15.100
libpostproc 52. 0.100 / 52. 0.100
[dshow @ 01D1FA80] DirectShow video device options
[dshow @ 01D1FA80] Pin "Capture"
[dshow @ 01D1FA80] pix_fmt=bgr24 min s=640x480 fps=5 max s=640x480 fps=30
[dshow @ 01D1FA80] pix_fmt=bgr24 min s=160x90 fps=5 max s=160x90 fps=30
[dshow @ 01D1FA80] pix_fmt=bgr24 min s=160x120 fps=5 max s=160x120 fps=30
[dshow @ 01D1FA80] pix_fmt=bgr24 min s=176x144 fps=5 max s=176x144 fps=30
[dshow @ 01D1FA80] pix_fmt=bgr24 min s=320x180 fps=5 max s=320x180 fps=30
[dshow @ 01D1FA80] pix_fmt=bgr24 min s=320x240 fps=5 max s=320x240 fps=30
[dshow @ 01D1FA80] pix_fmt=bgr24 min s=352x288 fps=5 max s=352x288 fps=30
[dshow @ 01D1FA80] pix_fmt=bgr24 min s=432x240 fps=5 max s=432x240 fps=30
[dshow @ 01D1FA80] pix_fmt=bgr24 min s=640x360 fps=5 max s=640x360 fps=30
[dshow @ 01D1FA80] pix_fmt=bgr24 min s=800x448 fps=5 max s=800x448 fps=30
[dshow @ 01D1FA80] pix_fmt=bgr24 min s=800x600 fps=5 max s=800x600 fps=30
[dshow @ 01D1FA80] pix_fmt=bgr24 min s=864x480 fps=5 max s=864x480 fps=30
[dshow @ 01D1FA80] pix_fmt=bgr24 min s=960x720 fps=5 max s=960x720 fps=30
[dshow @ 01D1FA80] pix_fmt=bgr24 min s=1024x576 fps=5 max s=1024x576 fps=30
[dshow @ 01D1FA80] pix_fmt=bgr24 min s=1280x720 fps=5 max s=1280x720 fps=30
[dshow @ 01D1FA80] pix_fmt=bgr24 min s=1600x896 fps=5 max s=1600x896 fps=30
[dshow @ 01D1FA80] pix_fmt=bgr24 min s=1920x1080 fps=5 max s=1920x1080 fps=30
[dshow @ 01D1FA80] pix_fmt=bgr24 min s=2304x1296 fps=2 max s=2304x1296 fps=2
[dshow @ 01D1FA80] pix_fmt=bgr24 min s=2304x1536 fps=2 max s=2304x1536 fps=2
[dshow @ 01D1FA80] pix_fmt=yuv420p min s=640x480 fps=5 max s=640x480 fps=30
[dshow @ 01D1FA80] pix_fmt=yuv420p min s=160x90 fps=5 max s=160x90 fps=30
[dshow @ 01D1FA80] pix_fmt=yuv420p min s=160x120 fps=5 max s=160x120 fps=30
[dshow @ 01D1FA80] pix_fmt=yuv420p min s=176x144 fps=5 max s=176x144 fps=30
[dshow @ 01D1FA80] pix_fmt=yuv420p min s=320x180 fps=5 max s=320x180 fps=30
[dshow @ 01D1FA80] pix_fmt=yuv420p min s=320x240 fps=5 max s=320x240 fps=30
[dshow @ 01D1FA80] pix_fmt=yuv420p min s=352x288 fps=5 max s=352x288 fps=30
[dshow @ 01D1FA80] pix_fmt=yuv420p min s=432x240 fps=5 max s=432x240 fps=30
[dshow @ 01D1FA80] pix_fmt=yuv420p min s=640x360 fps=5 max s=640x360 fps=30
[dshow @ 01D1FA80] pix_fmt=yuv420p min s=800x448 fps=5 max s=800x448 fps=30
[dshow @ 01D1FA80] pix_fmt=yuv420p min s=800x600 fps=5 max s=800x600 fps=30
[dshow @ 01D1FA80] pix_fmt=yuv420p min s=864x480 fps=5 max s=864x480 fps=30
[dshow @ 01D1FA80] pix_fmt=yuv420p min s=960x720 fps=5 max s=960x720 fps=30
[dshow @ 01D1FA80] pix_fmt=yuv420p min s=1024x576 fps=5 max s=1024x576 fps=30
[dshow @ 01D1FA80] pix_fmt=yuv420p min s=1280x720 fps=5 max s=1280x720 fps=30
[dshow @ 01D1FA80] pix_fmt=yuv420p min s=1600x896 fps=5 max s=1600x896 fps=30
[dshow @ 01D1FA80] pix_fmt=yuv420p min s=1920x1080 fps=5 max s=1920x1080 fps=30
[dshow @ 01D1FA80] pix_fmt=yuv420p min s=2304x1296 fps=2 max s=2304x1296 fps=2
[dshow @ 01D1FA80] pix_fmt=yuv420p min s=2304x1536 fps=2 max s=2304x1536 fps=2
[dshow @ 01D1FA80] video_codec=mjpeg min s=640x480 fps=5 max s=640x480 fps=30
[dshow @ 01D1FA80] video_codec=mjpeg min s=160x90 fps=5 max s=160x90 fps=30
[dshow @ 01D1FA80] video_codec=mjpeg min s=160x120 fps=5 max s=160x120 fps=30
[dshow @ 01D1FA80] video_codec=mjpeg min s=176x144 fps=5 max s=176x144 fps=30
[dshow @ 01D1FA80] video_codec=mjpeg min s=320x180 fps=5 max s=320x180 fps=30
[dshow @ 01D1FA80] video_codec=mjpeg min s=320x240 fps=5 max s=320x240 fps=30
[dshow @ 01D1FA80] video_codec=mjpeg min s=352x288 fps=5 max s=352x288 fps=30
[dshow @ 01D1FA80] video_codec=mjpeg min s=432x240 fps=5 max s=432x240 fps=30
[dshow @ 01D1FA80] video_codec=mjpeg min s=640x360 fps=5 max s=640x360 fps=30
[dshow @ 01D1FA80] video_codec=mjpeg min s=800x448 fps=5 max s=800x448 fps=30
[dshow @ 01D1FA80] video_codec=mjpeg min s=800x600 fps=5 max s=800x600 fps=30
[dshow @ 01D1FA80] video_codec=mjpeg min s=864x480 fps=5 max s=864x480 fps=30
[dshow @ 01D1FA80] video_codec=mjpeg min s=960x720 fps=5 max s=960x720 fps=30
[dshow @ 01D1FA80] video_codec=mjpeg min s=1024x576 fps=5 max s=1024x576 fps=30
[dshow @ 01D1FA80] video_codec=mjpeg min s=1280x720 fps=5 max s=1280x720 fps=30
[dshow @ 01D1FA80] video_codec=mjpeg min s=1600x896 fps=5 max s=1600x896 fps=30
[dshow @ 01D1FA80] video_codec=mjpeg min s=1920x1080 fps=5 max s=1920x1080 fps=30
[dshow @ 01D1FA80] Pin "Capture"
[dshow @ 01D1FA80] video_codec=h264 min s=640x480 fps=5 max s=640x480 fps=30
[dshow @ 01D1FA80] video_codec=h264 min s=160x90 fps=5 max s=160x90 fps=30
[dshow @ 01D1FA80] video_codec=h264 min s=160x120 fps=5 max s=160x120 fps=30
[dshow @ 01D1FA80] video_codec=h264 min s=176x144 fps=5 max s=176x144 fps=30
[dshow @ 01D1FA80] video_codec=h264 min s=320x180 fps=5 max s=320x180 fps=30
[dshow @ 01D1FA80] video_codec=h264 min s=320x240 fps=5 max s=320x240 fps=30
[dshow @ 01D1FA80] video_codec=h264 min s=352x288 fps=5 max s=352x288 fps=30
[dshow @ 01D1FA80] video_codec=h264 min s=432x240 fps=5 max s=432x240 fps=30
[dshow @ 01D1FA80] video_codec=h264 min s=640x360 fps=5 max s=640x360 fps=30
[dshow @ 01D1FA80] video_codec=h264 min s=800x448 fps=5 max s=800x448 fps=30
[dshow @ 01D1FA80] video_codec=h264 min s=800x600 fps=5 max s=800x600 fps=30
[dshow @ 01D1FA80] video_codec=h264 min s=864x480 fps=5 max s=864x480 fps=30
[dshow @ 01D1FA80] video_codec=h264 min s=960x720 fps=5 max s=960x720 fps=30
[dshow @ 01D1FA80] video_codec=h264 min s=1024x576 fps=5 max s=1024x576 fps=30
[dshow @ 01D1FA80] video_codec=h264 min s=1280x720 fps=5 max s=1280x720 fps=30
[dshow @ 01D1FA80] video_codec=h264 min s=1600x896 fps=5 max s=1600x896 fps=30
[dshow @ 01D1FA80] video_codec=h264 min s=1920x1080 fps=5 max s=1920x1080 fps=30

The question now being: how do I select video_codec=h264, s = 160X90, r = 30 ?

When I tried this:
PS C:\ffmpeg-test> ./ffmpeg-32 -f dshow -s 160x90 -r 15 -video_codec h264 -i video="Logitech HD ProWebcam C920" -vcodec libx264 -f mpegts udp://127.0.0.1:6666
ffmpeg version N-43887-g82bb129 Copyright (c) 2000-2012 the FFmpeg developers
built on Aug 24 2012 13:25:03 with gcc 4.7.1 (GCC)
configuration: --enable-memalign-hack --arch=x86 --enable-gpl --enable-libx264 --enable-avisynth --enable-libxvid --ta
rget-os=mingw32 --cross-prefix=/home/rogerdpack/dev/ffmpeg-windows-build-helpers/builds/mingw-w64-i686/bin/i686-w64-ming
w32- --pkg-config=pkg-config --enable-libmp3lame --enable-version3 --enable-libvo-aacenc --enable-libvpx --extra-libs=-l
ws2_32 --extra-libs=-lpthread --enable-zlib --extra-libs=-lwinmm --extra-libs=-lgdi32 --enable-librtmp --enable-libvorbi
s --enable-libtheora --enable-libspeex --enable-libopenjpeg --enable-gnutls --enable-libgsm --enable-runtime-cpudetect
libavutil 51. 70.100 / 51. 70.100
libavcodec 54. 54.100 / 54. 54.100
libavformat 54. 25.104 / 54. 25.104
libavdevice 54. 2.100 / 54. 2.100
libavfilter 3. 13.101 / 3. 13.101
libswscale 2. 1.101 / 2. 1.101
libswresample 0. 15.100 / 0. 15.100
libpostproc 52. 0.100 / 52. 0.100
Unrecognized option 'video_codec'
Failed to set value 'h264' for option 'video_codec'

Thanks for the pointer on the latency issue. Its much better now.

My setup is as follows, although, I've not tried to stream to Wowza using ffmpeg yet.

RTMP RTMP
HD WebCam ---------> Wowza Media server ----------> Browser (Flash app)

Any pointer for this would be helpful.

Thanks a bunch.

rogerdpack
Posts: 1882
Joined: Fri Aug 05, 2011 9:56 pm

Re: DirectShow Capture support

Post by rogerdpack »

hmm... I had thought there was a "-vcodec" option but appears only pix_fmt currently. Let me see what I can do...

ramiro
Posts: 157
Joined: Tue May 10, 2011 12:56 am

Re: DirectShow Capture support

Post by ramiro »

try -c:v
but I agree it's misleading to call it one thing on dshow and another on the command line. I'll try to fix that.

mobi1300
Posts: 14
Joined: Tue Aug 28, 2012 4:44 am

Re: DirectShow Capture support

Post by mobi1300 »

Ramiro:

I tried your suggestion, as follows:
>>
PS C:\ffmpeg-test> ./ffmpeg-32 -f dshow -c:v h264 -s 320x180 -r 30 -i video="Logitech HD Pro Webcam
C920" -vcodec copy -f flv rtmp://server/live/myStream

ffmpeg version N-43887-g82bb129 Copyright (c) 2000-2012 the FFmpeg developers
built on Aug 24 2012 13:25:03 with gcc 4.7.1 (GCC)
configuration: --enable-memalign-hack --arch=x86 --enable-gpl --enable-libx264 --enable-avisynth --enable-libxvid --ta
rget-os=mingw32 --cross-prefix=/home/rogerdpack/dev/ffmpeg-windows-build-helpers/builds/mingw-w64-i686/bin/i686-w64-ming
w32- --pkg-config=pkg-config --enable-libmp3lame --enable-version3 --enable-libvo-aacenc --enable-libvpx --extra-libs=-l
ws2_32 --extra-libs=-lpthread --enable-zlib --extra-libs=-lwinmm --extra-libs=-lgdi32 --enable-librtmp --enable-libvorbi
s --enable-libtheora --enable-libspeex --enable-libopenjpeg --enable-gnutls --enable-libgsm --enable-runtime-cpudetect
libavutil 51. 70.100 / 51. 70.100
libavcodec 54. 54.100 / 54. 54.100
libavformat 54. 25.104 / 54. 25.104
libavdevice 54. 2.100 / 54. 2.100
libavfilter 3. 13.101 / 3. 13.101
libswscale 2. 1.101 / 2. 1.101
libswresample 0. 15.100 / 0. 15.100
libpostproc 52. 0.100 / 52. 0.100
[h264 @ 01BC2640] no frame!
Last message repeated 28 times
[dshow @ 01CFFA40] Stream #0: not enough frames to estimate rate; consider increasing probesize
[dshow @ 01CFFA40] decoding for stream 0 failed
[dshow @ 01CFFA40] Estimating duration from bitrate, this may be inaccurate
Input #0, dshow, from 'video=Logitech HD Pro Webcam C920':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: h264, bgr24, 320x180, 30 tbr, 10000k tbn, 60 tbc
[dshow @ 01CFFA40] real-time buffer 79% full! frame dropped!
Last message repeated 1 times
[dshow @ 01CFFA40] real-time buffer 90% full! frame dropped!
Last message repeated 2 times
Output #0, flv, to 'rtmp://server/live/myStream':
Metadata:
encoder : Lavf54.25.104
Stream #0:0: Video: h264 ([7][0][0][0] / 0x0007), bgr24, 320x180, q=2-31, 1k tbn, 10000k tbc
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame= 0 fps=0.0 q=-1.0 Lsize= 0kB time=00:00:00.00 bitrate= 0.0kbits/s
video:0kB audio:0kB subtitle:0 global headers:0kB muxing overhead 1.#INF00%
Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)
<<
But I don't think it made any difference.


A question on libx264:

Does not matter which preset/profile I use, I always end up with:
profile High 4:4:4 Predictive, level 1.3, 4:4:4 8-bit

How do I change this to say Main level 3.1 ?

Thanks for the support

rogerdpack
Posts: 1882
Joined: Fri Aug 05, 2011 9:56 pm

Re: DirectShow Capture support

Post by rogerdpack »

This looks interesting:


Stream #0:0: Video: h264, bgr24, 320x180, 30 tbr, 10000k tbn, 60 tbc

h264 with "bgr24"


If you look at the enumeration, the first 320x180 device is:

[dshow @ 01D1FA80] DirectShow video device options
[dshow @ 01D1FA80] Pin "Capture"
...
[dshow @ 01D1FA80] pix_fmt=bgr24 min s=320x180 fps=5 max s=320x180 fps=30


Which makes me wonder if it's picking the bgr24 format, even though h264 was requested...
hmm...
-r

mobi1300
Posts: 14
Joined: Tue Aug 28, 2012 4:44 am

Re: DirectShow Capture support

Post by mobi1300 »

I noticed that too, so tried this:

PS C:\ffmpeg-test> ./ffmpeg-32 -f dshow -s 160x90 -pix_fmt yuv420p -c:v h264 -i video="Logitech HD Pr
o Webcam C920" -c:v copy sample.mp4

ffmpeg version N-43887-g82bb129 Copyright (c) 2000-2012 the FFmpeg developers
built on Aug 24 2012 13:25:03 with gcc 4.7.1 (GCC)
configuration: --enable-memalign-hack --arch=x86 --enable-gpl --enable-libx264 --enable-avisynth --enable-libxvid --ta
rget-os=mingw32 --cross-prefix=/home/rogerdpack/dev/ffmpeg-windows-build-helpers/builds/mingw-w64-i686/bin/i686-w64-ming
w32- --pkg-config=pkg-config --enable-libmp3lame --enable-version3 --enable-libvo-aacenc --enable-libvpx --extra-libs=-l
ws2_32 --extra-libs=-lpthread --enable-zlib --extra-libs=-lwinmm --extra-libs=-lgdi32 --enable-librtmp --enable-libvorbi
s --enable-libtheora --enable-libspeex --enable-libopenjpeg --enable-gnutls --enable-libgsm --enable-runtime-cpudetect
libavutil 51. 70.100 / 51. 70.100
libavcodec 54. 54.100 / 54. 54.100
libavformat 54. 25.104 / 54. 25.104
libavdevice 54. 2.100 / 54. 2.100
libavfilter 3. 13.101 / 3. 13.101
libswscale 2. 1.101 / 2. 1.101
libswresample 0. 15.100 / 0. 15.100
libpostproc 52. 0.100 / 52. 0.100
[h264 @ 01BB3760] no frame!
Last message repeated 231 times
[dshow @ 0214FA60] Stream #0: not enough frames to estimate rate; consider increasing probesize
[dshow @ 0214FA60] decoding for stream 0 failed
[dshow @ 0214FA60] Estimating duration from bitrate, this may be inaccurate
Input #0, dshow, from 'video=Logitech HD Pro Webcam C920':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: h264, yuv420p, 160x90, 30 tbr, 10000k tbn, 60 tbc
Output #0, mp4, to 'sample.mp4':
Metadata:
encoder : Lavf54.25.104
Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 160x90, q=2-31, 10000k tbn, 10000k tbc
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame= 0 fps=0.0 q=-1.0 Lsize= 0kB time=00:00:00.00 bitrate= 0.0kbits/s
video:0kB audio:0kB subtitle:0 global headers:0kB muxing overhead 1.#INF00%
Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)

rogerdpack
Posts: 1882
Joined: Fri Aug 05, 2011 9:56 pm

Re: DirectShow Capture support

Post by rogerdpack »

I plan on working more on this after Ramiro's pix_fmt patch is accepted.

rogerdpack
Posts: 1882
Joined: Fri Aug 05, 2011 9:56 pm

Re: DirectShow Capture support

Post by rogerdpack »

Ok it was accepted, cool!

I finally did get it to work by using this syntax:

$ ffmpeg -vcodec h264 -f dshow -i video=XXX ...

or like

$ ffmpeg -f dshow -vcodec h264 -i video=XXX ...

I couldn't get video_codec or -c:v to work at all. Hmm...maybe we should look into that sometime.

Anyway if you could also try this build:

http://rogerdpack.t28.net/incoming/ffmp ... c_debug.7z

Like this:

$ ffmpeg -loglevel debug -f dshow -vcodec h264 -i video=XXX ...

It might spit out some more helpful info...paste it here. I don't have a USB cam that outputs h264 so can't test it right.
Thanks!
-roger-

mobi1300
Posts: 14
Joined: Tue Aug 28, 2012 4:44 am

Re: DirectShow Capture support

Post by mobi1300 »

Roger:

Something went wrong with the build here. I can not run these binaries. . I get an error "libstdc++-6.dll is missing".

Can you pl. fix this issue.

Thanks

Post Reply