如何使用 ffmpeg 和 CMD 批量 zoompan .mp4

如何使用 ffmpeg 和 CMD 批量 zoompan .mp4

我需要一个 ffmpeg 批处理代码,它可以使用批处理代码将文件夹内的所有视频的分辨率编码和缩放到原始分辨率的 110% 和 125%。

以下是我测试过不起作用的一些代码:

for %%a in ("*.*") do ffmpeg -i "%%a"  -vf scale=2*iw:-1, crop=iw/2:ih/2" "newfiles\%%~na.mp4"

pause
for %%a in ("*.*") do ffmpeg -i "%%a" -vf "zoompan=z='1+(1.4*in/300)':x='70*in/300':y='190*in/300':d=1"  "newfiles\%%~na.mp4"
for %%a in ("*.*") do ffmpeg -i "%%a" -vf "zoompan=z='1+(1.4*in/300"  "newfiles\%%~na.mp4"

error i getting

[code]C:\down\Compressed\DRIVER PACK FOR MOBILE PHONE\DRIVER PACK FOR MOBILE PHONE>ffm
peg -i "avutil-ics-56.dll" -vf "zoompan=z='1+(1.4*in/300"  "newfiles\avutil-ics-
56.mp4"
ffmpeg version N-93461-g6e42021128 Copyright (c) 2000-2019 the FFmpeg developers

  built with gcc 8.2.1 (GCC) 20190212
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfi
g --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libb
luray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enab
le-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --e
nable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable
-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 -
-enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enab
le-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --en
able-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --en
able-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --e
nable-dxva2 --enable-avisynth --enable-libopenmpt
  libavutil      56. 26.100 / 56. 26.100
  libavcodec     58. 47.105 / 58. 47.105
  libavformat    58. 26.101 / 58. 26.101
  libavdevice    58.  7.100 / 58.  7.100
  libavfilter     7. 48.100 /  7. 48.100
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
avutil-ics-56.dll: Invalid data found when processing input

C:\down\Compressed\DRIVER PACK FOR MOBILE PHONE\DRIVER PACK FOR MOBILE PHONE>ffm
peg -i "ffmpeg.exe" -vf "zoompan=z='1+(1.4*in/300"  "newfiles\ffmpeg.mp4"
ffmpeg version N-93461-g6e42021128 Copyright (c) 2000-2019 the FFmpeg developers

  built with gcc 8.2.1 (GCC) 20190212
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfi
g --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libb
luray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enab
le-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --e
nable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable
-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 -
-enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enab
le-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --en
able-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --en
able-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --e
nable-dxva2 --enable-avisynth --enable-libopenmpt
  libavutil      56. 26.100 / 56. 26.100
  libavcodec     58. 47.105 / 58. 47.105
  libavformat    58. 26.101 / 58. 26.101
  libavdevice    58.  7.100 / 58.  7.100
  libavfilter     7. 48.100 /  7. 48.100
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
ffmpeg.exe: Invalid data found when processing input
[/code]

答案1

Windows 10 64 位

如何使用 ffmpeg 和 cmd 批量 zoompan .mp4。

@rem windows 10 64-bit. How to zoompan .mp4 using cmd and ffmpeg.
@echo off
setlocal enableextensions 
MD "new folder"
for %%a in ("*.mp4") do ffmpeg -i "%%a" -vf "zoompan=z='1+(1.4*in/300)':x='70*in/300':y='190*in/300':d=1" "new folder\%%~na.mp4"

文档在 ffmpeg.org

相关内容