[英]ffmpeg overlay issue with rotation
I want to execute a command using ffmpeg
so it performs three tasks for me at once: 我想使用
ffmpeg
执行命令,以便它一次为我执行三个任务:
Unfortunately, the tasks 1 and 2 are performed, but the overlay isn't. 不幸的是,执行了任务1和2,但没有执行叠加。 Please help me.. Here's the command I'm using:
请帮助我。这是我正在使用的命令:
ffmpeg -i " + path + " -i /storage/emulated/0/image.png -filter_complex [0]crop=" + cut + ":" + cut + ":0:0 -metadata:s:v:0 rotate=90 -c:a [a];[a][1]overlay=10:10 -preset ultrafast -codec:a copy /storage/emulated/0/Nitin/" + videoFile;
By using the options -metadata:s:v:0 rotate=90
, you were settings the rotate matrix in your video stream. 通过使用
-metadata:s:v:0 rotate=90
,您可以在视频流中设置旋转矩阵。
It seems your filters are not chained in your filter graph. 似乎您的过滤器未在过滤器图中链接。 You could achieve all your goals in a filter chain.
您可以在过滤器链中实现所有目标。
[in] ---> crop ---> transpose ---> overlay ---> [out]
^
|
---> movie -----------------|
The filter graph showed above can be specified with -vf
option like below. 上面显示的过滤器图可以使用
-vf
选项指定,如下所示。
ffmpeg -i input.mp4 -vf "crop=200:200:12:34,transpose=1 [ct];movie=/path/to/the/overlay/image.png [movie];[ct] [movie]overlay=(W-w)/2:(H-h)/2" -c:a copy -c:v libx264 output.mp4
You should change crop
parameters to yours, the transpose
filter with 1
parameter will rotate clock wise by 90 degree, see here for more information. 您应该将
crop
参数更改为自己的参数,带有1
参数的transpose
滤波器将顺时针旋转90度,有关更多信息,请参见此处 。
Also change the movie filter parameter to the path of your image. 另外,将影片滤镜参数更改为图像的路径。
At last, these two outputs will centred overlay to generate final output. 最后,这两个输出将居中放置以生成最终输出。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.