Using FFMPEG I am trying to record a video which will have input from two cameras. In output video I want input of camera side by side for this I have used hstack:
ffmpeg -rtbufsize 200M -f dshow -i video="Integrated Webcam" -f dshow -i video="USB2.0 Camera" -filter_complex "[0:v][1:v]hstack=inputs=2[v];" -map "[v]" -f flv test.flv
But I am getting an error as:
Use
ffmpeg -rtbufsize 200M -f dshow -i video="Integrated Webcam" -rtbufsize 200M -f dshow -i video="USB2.0 Camera" -filter_complex "[0:v][1:v]hstack=inputs=2[v]" -map "[v]" -f flv test.flv
rtbufsize is an input option and has to be applied to each input for which it is intended.
The final filter in a filter_complex should not be terminated with a delimiter (, or ;).
Related
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
I try concat two videos (1.mkv has 640:360 image size, 2.mkv has 1280:720 image size), both videos have 2 video tracks and 0 audio tracks. I tried this code:
ffmpeg -i 1.mkv -i 2.mkv -filter_complex "[0:v:0]scale=1280:720:force_original_aspect_ratio=decrease,pad=1280:720:(ow-iw)/2:(oh-ih)/2[v0];[0:v:1]scale=1280:720:force_original_aspect_ratio=decrease,pad=1280:720:(ow-iw)/2:(oh-ih)/2[v0];[v0][1:v:0][1:v:1]concat=n=2:v=2:a=0[v]" -map "[v]" -c:v "libvpx" 1+2.mkv
But I have wrong:
Filter pad has an unconnected output
Your filter labels need to be adjusted, and you need to change v=2 to v=1 in concat filter:
ffmpeg -i 1.mkv -i 2.mkv -filter_complex "[0:v:0]scale=1280:720:force_original_aspect_ratio=decrease,pad=1280:720:(ow-iw)/2:(oh-ih)/2[v0];[1:v:0]scale=1280:720:force_original_aspect_ratio=decrease,pad=1280:720:(ow-iw)/2:(oh-ih)/2[v1];[v0][v1]concat=n=2:v=1:a=0[v]" -map "[v]" -c:v libvpx 1+2.mkv
Since 2.mkv is already 1280x720 you can avoid processing that input:
ffmpeg -i 1.mkv -i 2.mkv -filter_complex "[0:v:0]scale=1280:720:force_original_aspect_ratio=decrease,pad=1280:720:(ow-iw)/2:(oh-ih)/2[v0];[v0][1:v]concat=n=2:v=1:a=0[v]" -map "[v]" -c:v libvpx 1+2.mkv
I am trying to use FFMPEG to splice few videos and output one combined video.
I managed to get all video stream with this command :
ffmpeg.exe -i 1.mov -i 2.mov -filter_complex "[0:v]scale=1920:1080[v0];[1:v]scale=1920:1080[v1];[v0][v1] concat=n=2:v=1[v]" -map "[v]" out.mp4
Also, to add a dummy audio to a video with this command:
ffmpeg.exe -i 1.mov -f lavfi -i aevalsrc=0 -shortest -i out.mov
Above commands work perfectly, however 2.mov has an audio stream while 1.mov does not.
Is there any method that can set a dummy audio for 1.mov and then combine both video and audio streams from 1.mov and 2.mov at one go, so that output a combined video that can play sound when it is at clip 2.mov.
Use
ffmpeg.exe -i 1.mov -i 2.mov -f lavfi -t 1 -i anullsrc -filter_complex "[0:v]scale=1920:1080[v0];[1:v]scale=1920:1080[v1];[v0][2:a][v1][1:a] concat=n=2:v=1:a=1[v][a]" -map "[v]" -map "[a]" out.mp4
-f lavfi -t 1 -i anullsrc adds a silent 1 second audio input, which is used as a counterpart to the video input from 1.mov. The concat filter will pad the audio to match the video duration of 1.mov.
NOTE: The below ffmpeg command lines are just a pseudo lines, not 100% final.
From single source I need to stream 2 different udp:// stream.
And I need to overlay 2 different png images on each.
Base sample line:
ffmpeg -r 25 -f dshow -i "video=VideoCaptureDevice:audio=AudioCaptureDevice" -codec:v libx264 -codec:a libfaac -f mpegts "udp://224.1.1.1:1234?pkt_size=1316" -codec:v libx264 s:v 720x480 -codec:a libfaac -f mpegts "udp://224.1.1.1:1235?pkt_size=1316"
Now I need to overlay 2 separate images in each output.
I tried below lines and failed.
Overlay sample line what I tried:
ffmpeg -r 25 -f dshow -i "video=VideoCaptureDevice:audio=AudioCaptureDevice" -i "C:\Image1.png" -filter_complex "overlay=100:100" -codec:v libx264 -codec:a libfaac -f mpegts "udp://224.1.1.1:1234?pkt_size=1316" -i "C:\Image2.png" -filter_complex "overlay=500:100" -codec:v libx264 s:v 720x480 -codec:a libfaac -f mpegts "udp://224.1.1.1:1235?pkt_size=1316"
Use
ffmpeg -r 25 -f dshow -i "video=VideoCaptureDevice:audio=AudioCaptureDevice" -i "C:\Image1.png" -i "C:\Image2.png" -filter_complex "split[a][b];[a][1]overlay=100:100[v1];[b][2]overlay=500:100,scale=720:480[v2]" -map "[v1]" -map 0:a -codec:v libx264 -codec:a libfaac -f mpegts "udp://224.1.1.1:1234?pkt_size=1316" -map "[v2]" -map 0:a -codec:v libx264 -codec:a libfaac -f mpegts "udp://224.1.1.1:1235?pkt_size=1316"
i want to output ffmpeg to one rtmp stream.
and at the same time, I want to handle the H264 stream by my program.
I already tried "ffmpeg -f dshow -i video="Webcam C110" -vcodec libx264 -f tee -map 0:v "xx.mkv|-"
but not work.
Base syntax would be
ffmpeg -f dshow -i video="Webcam C110" -vcodec libx264 -f tee -map 0:v "[f=flv]rtmp://url|[f=h264]pipe:1"