How to specify Input video device when I use ffmpeg - ffmpeg

I am trying to use ffmpeg to record video in command line.
I tried:
.\ffmpeg.exe -f vfwcap -i 0 c:\test.mp4
And it pops up a window asking for "Video Source", Select a Video Device: "Integrated Camera". So I tried:
.\ffmpeg.exe -f vfwcap -i "Integrated Camera" c:\test.mp4
But it still pops up the same window. How I can specify the 'Integrated Camera' as my input device to ffmpeg?

vfwcap is deprecated as mentioned here. You can use dshow instead of vfwcap.
ffmpeg -f dshow -i video="Integrated Webcam" camera.mp4

Related

ffmpeg volume levels

I AM USING WINDOWS
I did recording camera,microphone and system sounds each separately with ffmpeg.
ffmpeg -f dshow -i video="USB2.0 PC CAMERA" output.mkv
Above code for camera recording.
ffmpeg -f dshow -i audio="#device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{5B4DB0B5-B645-4AFA-930D-4710AAF753DB}" output.wav
And above for microphone.
ffmpeg -f dshow -i audio="#device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{ADECEC1D-C3CC-4BAE-8516-752251B8B63F}" output.mkv
And above for system audio.
I mixed system audio with microphone like below:
ffmpeg -f dshow -i audio="#device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{5B4DB0B5-B645-4AFA-930D-4710AAF753DB}" -f dshow -i audio="#device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{ADECEC1D-C3CC-4BAE-8516-752251B8B63F}" -filter_complex amerge=inputs=2 stream.mp3
BUT there is still issue to volume levels. How do I adjust sound volume levels
for each input or output file?
You can add the volume filter:
ffmpeg -f dshow -i audio="#device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{5B4DB0B5-B645-4AFA-930D-4710AAF753DB}" -f dshow -i audio="#device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{ADECEC1D-C3CC-4BAE-8516-752251B8B63F}" -filter_complex "[0:a]volume=0.3[a0];[1:a]volume=0.5[a1];[a0][a1]amerge=inputs=2" -ac 1 stream.mp3

How to stream webcam video using ffmpeg?

I am very new to ffmpeg and just read some examples on how to open a video file and decode its stream.
But is it possible to open a webcam's stream, something like:
http://192.168.1.173:80/live/0/mjpeg.jpg?x.mjpeg
Is there any examples/tutorials on this?
I need to use ffmpeg as decoder to decode the stream in my own Qt based program.
Nyaruko,
First check if your webcam is supported... Do
ffmpeg -y -f vfwcap -i list
Next ,
ffmpeg -y -f vfwcap -r 25 -i 0 out.mp4 for encoding
This site has helpful info;
http://www.area536.com/projects/streaming-video/
Best of Luck.
This works for live video streaming:
ffplay -f dshow -video_size 1280x720 -i video0
The other option using ffmpeg is:
ffmpeg -f dshow -video_size 1280x720 -i video0 -f sdl2 -
Above both the solution are provided by FFMPED

avconv or FFMPEG command to have multiple pictures slices from a direct webcam on pc

I have found the command
ffmpeg -i rtsp://10.2.69.201:554/ch0_0.h264 -f image2 -vf fps=fps=1/120 img%03d.jpg
but it fail if I'm not on network. I tryed on my on computer but I have bind error.
I would like to have a command like or a mix of these one:
ffmpeg -f v4l2 -s 640x480 -i /dev/video0 output.mpg
Thanks for your help. This is appreciated if that possible
Ok all I found it after a lot of work. This meaned reading the error message. That's the key and you always mention it:
ffmpeg -f v4l2 -s 640x480 -i /dev/video0 -bt 20M -vf fps=1 img%03d.jpg
This code work simply and perfectly. I hope you enjoy.
Thanks all

recording live video stream from tv card using ffmpeg in windows

I want to capture thumbnail every 1 second from tv card(tv signal) using ffmpeg in windows.
first of all, to record live video from tv card, I tried below.
ffmpeg -f dshow -i video="SKYTV HD USB Maxx Video Capture" -r 20 -threads 0 D://test.mkv
But it didn't work.
the Error message is
"[dshow#000000000034d920] Could not run filter
video=SKYTV HD USB Maxx Video Capture: Input/output error"
I use the device called 'SKYTV HD USB Maxx Video Capture' for getting tv signal(TV card).
(people usually suggest "ffmpeg -f oss -i dev/dsp -f video4linux2 -i dev/video0/tmp/out.mpg"
but I dont think it works at window. this is the error message i got: "Unknown input format: 'video4linux2'")
what should i do to record live video and get thumbnail every 1 second from tv card(tv signal) using ffmpeg in window?
Please help..!
First be sure that the video label you use is really the label return by:
ffmpeg -list_devices true -f dshow -i dummy
More info here
But another solution should be ti use the old "Video For Windows" (VFW).
To try that, list your device with:
ffmpeg -y -f vfwcap -i list
And use your device number as value of the -ioption:
ffmpeg -y -f vfwcap -r 25 -i 0 out.mp4
And if finally you are able to record your stream, there is different options, but in your case everything is clear describe here
ffmpeg -y -f vfwcap -r 25 -i 0 -f image2 -vf fps=fps=1 out%d.jpg

recording sound from webcam using ffmpeg

Using ffmpeg arecord -L, I am able to identify my Logitech usb webcam as:
hw:CARD=U0x46d0x821,DEV=0
USB Device 0x46d:0x821, USB Audio
Direct hardware device without any conversions
plughw:CARD=U0x46d0x821,DEV=0
USB Device 0x46d:0x821, USB Audio
Hardware device with all software conversions
when I go into /dev/snd/by-id, the webcam is described as:
usb-046d_0821_6813BFD0-00 -> ../controlC1
I know that the command to use a sound device in ffmpeg is
ffmpeg -f alsa -i $ALSA_DEVICE_NAME..
I have tried
ffmpeg -f alsa -i "hw:CARD=U0x46d0x821,DEV=0"
and
ffmpeg -f alsa -i "plughw:CARD=U0x46d0x821,DEV=0"
and in both cases I receive the same error message:
ALSA lib pcm.c:2208:(snd_pcm_open_noupdate) Unknown PCM hw=CARD=U0x46d0x821,DEV=0
[alsa # 0x9c96580] cannot open audio device hw=CARD=U0x46d0x821,DEV=0 (No such file or directory)
hw:CARD=U0x46d0x821,DEV=0: Input/output error
I have also tried:
ffmpeg -f alsa -i "usb-046d_0821_6813BFD0-00"
and
ffmpeg -f alsa -i "usb-046d_0821_6813BFD0-00,DEV=0"
and have still received error message
Could you please help in formulating the correct format of the command
I have finally been able to use the sound portion of the webcam under ffmpeg. The correct way to do it is NOT to enclose the hardware value in quotes. Do not enclose the hardware in quotes:
ffmpeg -f alsa -i plughw:CARD=U0x46d0x821,DEV=0
instead of:
ffmpeg -f alsa -i "plughw:CARD=U0x46d0x821,DEV=0"
I hope this helps someone else.
Maybe this works:
ffmpeg -f alsa -r 16000 -i hw:2,0 -f video4linux2 -s 800x600 -i /dev/video0 -r 30 -f avi -vcodec mpeg4 -vtag xvid -sameq -acodec libmp3lame -ab 96k output.avi
Source

Resources