创建放大的镜像效果

创建放大的镜像效果

在此处输入图片描述我正在尝试创建视频的放大镜像效果,其转换过程类似于

Input -> Output 
______________      ________________________________________
|Top Section   |  -> |Top Section    + Zoomed top 1/3 Middle| 
|Middle Section|  -> |Middle Section + Zoomed mid 1/3 Middle|
|Bottom Section|  -> |Middle Section + Zoomed bot 1/3 Middle|
______________      ________________________________________

我认为这可以作为一次复杂过滤器工作,但我不了解语法,因此我分两次进行,此时结合两个输入总是会引发错误。

我的原始视频是 1080:1920 @ 60 fps。

如果我 ffprobe 我得到两个文件

ffprobe version 4.2.4-1ubuntu0.1 Copyright (c) 2007-2020 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Cropped/PXL_20210124_220945291.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.29.100
  Duration: 00:00:45.05, start: 0.000000, bitrate: 3227 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1080x1920 [SAR 8:7 DAR 9:14], 3022 kb/s, 60 fps, 60 tbr, 15360 tbn, 120 tbc (default)
    Metadata:
      handler_name    : VideoHandle
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 191 kb/s (default)
    Metadata:
      rotate          : 90
      handler_name    : SoundHandle

ffprobe version 4.2.4-1ubuntu0.1 Copyright (c) 2007-2020 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './PXL_20210124_220945291.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2021-01-24T22:10:31.000000Z
    com.android.capture.fps: 60.000000
  Duration: 00:00:45.04, start: 0.000000, bitrate: 29957 kb/s
    Stream #0:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 191 kb/s (default)
    Metadata:
      rotate          : 90
      creation_time   : 2021-01-24T22:10:31.000000Z
      handler_name    : SoundHandle
    Stream #0:1(eng): Video: hevc (Main) (hev1 / 0x31766568), yuvj420p(pc, smpte170m/bt470bg/smpte170m), 1920x1080, 29760 kb/s, SAR 1:1 DAR 16:9, 59.97 fps, 60 tbr, 90k tbn, 90k tbc (default)
    Metadata:
      rotate          : 90
      creation_time   : 2021-01-24T22:10:31.000000Z
      handler_name    : VideoHandle
    Side data:
      displaymatrix: rotation of -90.00 degrees

如果我尝试使用并排合并(我尝试过改变裁剪视频的比例和旋转,但到目前为止我无法得到正确的组合

    ffmpeg -i PXL_20210124_220945291.mp4 -t 00:00:3 -vf crop=in_w*.4:in_h*.35:in_w*.275:in_h*.15, scale=1920:1080 -c:a copy -preset medium -pix_fmt yuv420p -metadata:s:v:0 rotate=90 -y Cropped/PXL_20210124_220945291.mp4
    ffmpeg -i PXL_20210124_220945291.mp4 -i Cropped/PXL_20210124_220945291.mp4.mkv -filter_complex 'hstack,format=yuv420p' -c:v libx265 -crf 18 -r 60 -y Combined/PXL_20210124_220945291.mp4 

总是会回来

[Parsed_hstack_0 @ 0x55cafa398540] Input 1 height 1080 does not match input 0 height 1920.
[Parsed_hstack_0 @ 0x55cafa398540] Failed to configure output pad on Parsed_hstack_0
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #1:0
Conversion failed!

如果有用的话我可以发布文件的简短片段。

相关内容