0

Thank you so much for checking out my post, I'm still new to ffmpeg but getting addicted to experimenting with it, yet I'm facing the following problem:

ffmpeg -f gdigrab -s 1360x768 -framerate 30 -i desktop 
       -f dshow -i video="video-input-device":audio="audio-input-device" 
       -i image.png 
       -filter_complex "[0:v]format=yuv420p,yadif[v];[1:v]scale=256:-1,overlay=10:10[secondvideo];[v][2]overlay=main_w-overlay_w-10/2:main_h-overlay_h-10/2[image];[image][secondvideo]concat=n=2[outer];[outer]split=2[out0][out1]" 
       -map 1:a -c:a aac -b:a 128k -map "[out0]" -c:v libx264 -b:v 2M -preset ultrafast -s 1280x720 -f mp4 output0.mp4 
       -map 1:a -c:a aac -b:a 128k -map "[out1]" -c:v libx264 -b:v 2M -preset ultrafast -s 1280x720 -f mp4 output1.mp4

Expected output: Two videos containing audio, screen being recorded and multiple video streams located on different places in the video, in my case it's a webcam on the top left of the video and an image on the bottom right.

Real output: The following error

Stream mapping:
Stream #0:0 (bmp) -> format (graph 0)
Stream #1:0 (rawvideo) -> scale (graph 0)
Stream #2:0 (png) -> overlay:overlay (graph 0)
Stream #2:0 (png) -> overlay:overlay (graph 0)
Stream #1:1 -> #0:0 (pcm_s16le (native) -> aac (native))
split:output0 (graph 0) -> Stream #0:1 (libx264)
Stream #1:1 -> #1:0 (pcm_s16le (native) -> aac (native))
split:output1 (graph 0) -> Stream #1:1 (libx264)
Press [q] to stop, [?] for help
[dshow @ 0000003601a30ec0] Thread message queue blocking; consider raising 
the thread_queue_size option (current value: 8)
[Parsed_concat_5 @ 000000360bdef840] Input link in1:v0 parameters (size 
256x192, SAR 0:1) do not match the corresponding output link in0:v0 
parameters (1360x768, SAR 0:1)
[Parsed_concat_5 @ 000000360bdef840] Failed to configure output pad on 
Parsed_concat_5
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #2:0
[aac @ 0000003601a9ef00] Qavg: 198.729
[aac @ 0000003601a9ef00] 2 frames left in the queue on closing
[aac @ 000000360a253800] Qavg: 198.729
[aac @ 000000360a253800] 2 frames left in the queue on closing
Conversion failed!

I know it's a filter_complex issue but I don't know where exactly, any help would be very appreciated!

1

Use

ffmpeg -f gdigrab -s 1360x768 -framerate 30 -i desktop 
       -f dshow -i video="video-input-device":audio="audio-input-device" 
       -i image.png 
       -filter_complex "[1:v]scale=256:-1[secondvideo];[0:v][secondvideo]overlay=10:10[v1];[v1][2]main_w-overlay_w-10/2:main_h-overlay_h-10/2,split=2[out0][out1]" 
       -map 1:a -c:a aac -b:a 128k -map "[out0]" -c:v libx264 -b:v 2M -preset ultrafast -s 1280x720 -f mp4 output0.mp4 
       -map 1:a -c:a aac -b:a 128k -map "[out1]" -c:v libx264 -b:v 2M -preset ultrafast -s 1280x720 -f mp4 output1.mp4

There's no need to deinterlace an input from the GDI buffer, and the format is not necessary either. The overlays should be applied in succession with labelled input pads.

  • Thank you again so much for your help, it's crazy how fun working on FFmpeg can get! – Sano Dec 11 '18 at 11:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.