Stack + resize + use audio from first video?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Stack + resize + use audio from first video?

Gilles
Hello,

It's a bit over my head.

In one command, I'd like to stack two videos, resize them to the same
width+height, and use audio from the first video.

Would someone have a working example?

#Stack
ffmpeg -i input0 -i input1 -filter_complex vstack=inputs=2 output

#Using audio from one particular input. This example will use the audio from
input1:
ffmpeg -i input0 -i input1 -filter_complex "[0:v][1:v]vstack=inputs=2[v]"
-map "[v]" -map 1:a output

#Resize/scale an input
ffmpeg -i input0 -i input2 -filter_complex
"[0:v]scale=640:-1[v0];[v0][1:v]vstack=inputs=2" output

Thank you.



--
Sent from: http://ffmpeg-users.933282.n4.nabble.com/
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Stack + resize + use audio from first video?

Moritz Barsnick
On Mon, Feb 08, 2021 at 13:00:15 -0600, Gilles wrote:
> In one command, I'd like to stack two videos, resize them to the same
> width+height, and use audio from the first video.

Which of the below works for you? The first two, right?

> #Stack
> ffmpeg -i input0 -i input1 -filter_complex vstack=inputs=2 output
>
> #Using audio from one particular input. This example will use the audio from
> input1:
> ffmpeg -i input0 -i input1 -filter_complex "[0:v][1:v]vstack=inputs=2[v]"
> -map "[v]" -map 1:a output
>
> #Resize/scale an input
> ffmpeg -i input0 -i input2 -filter_complex
> "[0:v]scale=640:-1[v0];[v0][1:v]vstack=inputs=2" output

You could just merge your work from the second and the third example.
Did you try this?:

$ ffmpeg -i input0 -i input1 -filter_complex "[0:v]scale=640:-1[v0];[v0][1:v]vstack=inputs=2[v]" -map "[v]" -map 1:a output
(Untested by myself.)

There's also a very handy filter called "scale2ref". It will scale one
input based on the other's size:

https://ffmpeg.org/ffmpeg-filters.html#scale2ref

Cheers,
Moritz
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".