Open nomaam opened 3 weeks ago
Script are tested with bash. If you have a bash interpreter they should work as expected.
Does it work on Windows?
I have received next error:
Error opening output file ../transition_clock.mp4.
Error opening output files: Invalid argument
Full log:
Image count: 5 Dimension: 1280x720 FPS: 30 Image duration: 2 s Transition duration: 1 s Total duration: 14 s
ffmpeg version N-117763-ge35587250c-20241113 Copyright (c) 2000-2024 the FFmpeg developers built with gcc 14.2.0 (crosstool-NG 1.26.0.120_4d36f27) configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --disable-w32threads --enable-pthreads --enable-iconv --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-libxml2 --enable-lzma --enable-fontconfig --enable-libharfbuzz --enable-libvorbis --enable-opencl --disable-libpulse --enable-libvmaf --disable-libxcb --disable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-chromaprint --enable-libdav1d --enable-libdavs2 --enable-libdvdread --enable-libdvdnav --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libaribcaption --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-libzmq --enable-lv2 --enable-libvpl --enable-openal --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --disable-libdrm --enable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libvvenc --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-libs=-lgomp --extra-ldflags=-pthread --extra-ldexeflags= --cc=x86_64-w64-mingw32-gcc --cxx=x86_64-w64-mingw32-g++ --ar=x86_64-w64-mingw32-gcc-ar --ranlib=x86_64-w64-mingw32-gcc-ranlib --nm=x86_64-w64-mingw32-gcc-nm --extra-version=20241113 libavutil 59. 46.100 / 59. 46.100 libavcodec 61. 24.100 / 61. 24.100 libavformat 61. 9.100 / 61. 9.100 libavdevice 61. 4.100 / 61. 4.100 libavfilter 10. 6.101 / 10. 6.101 libswscale 8. 9.101 / 8. 9.101 libswresample 5. 4.100 / 5. 4.100 libpostproc 58. 4.100 / 58. 4.100 -vsync is deprecated. Use -fps_mode Passing a number to -vsync is deprecated, use a string argument as described in the manual. Input #0, image2, from '../media/1.jpg': Duration: 00:00:00.04, start: 0.000000, bitrate: 146205 kb/s Stream #0:0: Video: mjpeg (Baseline), yuvj444p(pc, bt470bg/unknown/unknown), 2048x1188 [SAR 300:300 DAR 512:297], 25 fps, 25 tbr, 25 tbn Input #1, image2, from '../media/2.jpg': Duration: 00:00:00.04, start: 0.000000, bitrate: 119701 kb/s Stream #1:0: Video: mjpeg (Baseline), yuvj444p(pc, bt470bg/unknown/unknown), 2048x1365 [SAR 72:72 DAR 2048:1365], 25 fps, 25 tbr, 25 tbn Input #2, image2, from '../media/3.jpg': Duration: 00:00:00.04, start: 0.000000, bitrate: 203286 kb/s Stream #2:0: Video: mjpeg (Baseline), yuvj444p(pc, bt470bg/unknown/unknown), 2048x1365 [SAR 72:72 DAR 2048:1365], 25 fps, 25 tbr, 25 tbn Input #3, image2, from '../media/4.jpg': Duration: 00:00:00.04, start: 0.000000, bitrate: 231145 kb/s Stream #3:0: Video: mjpeg (Baseline), yuvj444p(pc, bt470bg/unknown/unknown), 2048x1365 [SAR 72:72 DAR 2048:1365], 25 fps, 25 tbr, 25 tbn Input #4, image2, from '../media/5.jpg': Duration: 00:00:00.04, start: 0.000000, bitrate: 175722 kb/s Stream #4:0: Video: mjpeg (Baseline), yuvj444p(pc, bt470bg/unknown/unknown), 2048x1365 [SAR 72:72 DAR 2048:1365], 25 fps, 25 tbr, 25 tbn [vost#0:0/libx264 @ 000001add94304c0] One of -r/-fpsmax was specified together a non-CFR -vsync/-fps_mode. This is contradictory. Error opening output file ../transition_clock.mp4. Error opening output files: Invalid argument
Slideshow created in 0 seconds
Script are tested with bash. If you have a bash interpreter they should work as expected.
Error opening output file ../transition_clock.mp4. Error opening output files: Invalid argument
The same response in cygwin, git bash and command line.
cygwin
has a fully functional bash
, we have confirmed that scripts work under cygwin
.git bash
is a bash
emulator, doesn't support all bash
features. Scripts that use standard bash
features work, scripts that use advanced bash
features don't work under git bash
.command line
has nothing to do with bash
.One of -r/-fpsmax was specified together a non-CFR -vsync/-fps_mode. This is contradictory.
This is the error that breaks the script. ffmpeg or x264 installed doesn't like some of the video encoding options. Resolving this error will fix the script.
Script works well if one of these options omitted (-vsync or -r anyway):
ffmpeg -y -loop 1 -i '../media/1.jpg' -loop 1 -i '../media/2.jpg' -loop 1 -i '../media/3.jpg' -loop 1 -i '../media/4.jpg' -loop 1 -i '../media/5.jpg' \
-filter_complex "[0:v]setpts=PTS-STARTPTS,scale=w='if(gte(iw/ih,1280/720),-1,1280)':h='if(gte(iw/ih,1280/720),720,-1)',crop=1280:720,setsar=sar=1/1,fps=30,format=rgba,split=2[stream1out1][stream1out2];[1:v]setpts=PTS-STARTPTS,scale=w='if(gte(iw/ih,1280/720),-1,1280)':h='if(gte(iw/ih,1280/720),720,-1)',crop=1280:720,setsar=sar=1/1,fps=30,format=rgba,split=2[stream2out1][stream2out2];[2:v]setpts=PTS-STARTPTS,scale=w='if(gte(iw/ih,1280/720),-1,1280)':h='if(gte(iw/ih,1280/720),720,-1)',crop=1280:720,setsar=sar=1/1,fps=30,format=rgba,split=2[stream3out1][stream3out2];[3:v]setpts=PTS-STARTPTS,scale=w='if(gte(iw/ih,1280/720),-1,1280)':h='if(gte(iw/ih,1280/720),720,-1)',crop=1280:720,setsar=sar=1/1,fps=30,format=rgba,split=2[stream4out1][stream4out2];[4:v]setpts=PTS-STARTPTS,scale=w='if(gte(iw/ih,1280/720),-1,1280)':h='if(gte(iw/ih,1280/720),720,-1)',crop=1280:720,setsar=sar=1/1,fps=30,format=rgba,split=2[stream5out1][stream5out2];[stream1out1]pad=width=1280:height=720:x=(1280-iw)/2:y=(720-ih)/2:color=#00000000,trim=duration=2,select=lte(n\,60)[stream1overlaid];[stream1out2]pad=width=1280:height=720:x=(1280-iw)/2:y=(720-ih)/2:color=#00000000,trim=duration=1,select=lte(n\,30)[stream1ending];[stream2out1]pad=width=1280:height=720:x=(1280-iw)/2:y=(720-ih)/2:color=#00000000,trim=duration=2,select=lte(n\,60)[stream2overlaid];[stream2out2]pad=width=1280:height=720:x=(1280-iw)/2:y=(720-ih)/2:color=#00000000,trim=duration=1,select=lte(n\,30),split=2[stream2starting][stream2ending];[stream3out1]pad=width=1280:height=720:x=(1280-iw)/2:y=(720-ih)/2:color=#00000000,trim=duration=2,select=lte(n\,60)[stream3overlaid];[stream3out2]pad=width=1280:height=720:x=(1280-iw)/2:y=(720-ih)/2:color=#00000000,trim=duration=1,select=lte(n\,30),split=2[stream3starting][stream3ending];[stream4out1]pad=width=1280:height=720:x=(1280-iw)/2:y=(720-ih)/2:color=#00000000,trim=duration=2,select=lte(n\,60)[stream4overlaid];[stream4out2]pad=width=1280:height=720:x=(1280-iw)/2:y=(720-ih)/2:color=#00000000,trim=duration=1,select=lte(n\,30),split=2[stream4starting][stream4ending];[stream5out1]pad=width=1280:height=720:x=(1280-iw)/2:y=(720-ih)/2:color=#00000000,trim=duration=2,select=lte(n\,60)[stream5overlaid];[stream5out2]pad=width=1280:height=720:x=(1280-iw)/2:y=(720-ih)/2:color=#00000000,trim=duration=1,select=lte(n\,30)[stream5starting];[stream2starting][stream1ending]blend=all_expr='if(lte(T,0.125),if(gt(X,W/2)*lte(Y,H/2)*lte(X-W/2+Y-H/2,0),A,B),if(lte(T,0.25),if(gt(X,W/2)*lte(Y,H/2),A,B),if(lte(T,0.375),if((gt(X,W/2)*gt(Y,H/2)*gt(X-W/2-Y+H/2,0))+(gt(X,W/2)*lte(Y,H/2)),A,B),if(lte(T,0.5),if(gt(X,W/2),A,B),if(lte(T,0.625),if((lte(X,W/2)*gt(Y,H/2)*gt(X-W/2+Y-H/2,0))+gt(X,W/2),A,B),if(lte(T,0.75),if((lte(X,W/2)*gt(Y,H/2))+gt(X,W/2),A,B),if(lte(T,0.875),if((lte(X,W/2)*lte(Y,H/2)*lte(Y-H/2-X+W/2,0)),B,A),A)))))))':shortest=1[stream2blended];[stream3starting][stream2ending]blend=all_expr='if(lte(T,0.125),if(gt(X,W/2)*lte(Y,H/2)*lte(X-W/2+Y-H/2,0),A,B),if(lte(T,0.25),if(gt(X,W/2)*lte(Y,H/2),A,B),if(lte(T,0.375),if((gt(X,W/2)*gt(Y,H/2)*gt(X-W/2-Y+H/2,0))+(gt(X,W/2)*lte(Y,H/2)),A,B),if(lte(T,0.5),if(gt(X,W/2),A,B),if(lte(T,0.625),if((lte(X,W/2)*gt(Y,H/2)*gt(X-W/2+Y-H/2,0))+gt(X,W/2),A,B),if(lte(T,0.75),if((lte(X,W/2)*gt(Y,H/2))+gt(X,W/2),A,B),if(lte(T,0.875),if((lte(X,W/2)*lte(Y,H/2)*lte(Y-H/2-X+W/2,0)),B,A),A)))))))':shortest=1[stream3blended];[stream4starting][stream3ending]blend=all_expr='if(lte(T,0.125),if(gt(X,W/2)*lte(Y,H/2)*lte(X-W/2+Y-H/2,0),A,B),if(lte(T,0.25),if(gt(X,W/2)*lte(Y,H/2),A,B),if(lte(T,0.375),if((gt(X,W/2)*gt(Y,H/2)*gt(X-W/2-Y+H/2,0))+(gt(X,W/2)*lte(Y,H/2)),A,B),if(lte(T,0.5),if(gt(X,W/2),A,B),if(lte(T,0.625),if((lte(X,W/2)*gt(Y,H/2)*gt(X-W/2+Y-H/2,0))+gt(X,W/2),A,B),if(lte(T,0.75),if((lte(X,W/2)*gt(Y,H/2))+gt(X,W/2),A,B),if(lte(T,0.875),if((lte(X,W/2)*lte(Y,H/2)*lte(Y-H/2-X+W/2,0)),B,A),A)))))))':shortest=1[stream4blended];[stream5starting][stream4ending]blend=all_expr='if(lte(T,0.125),if(gt(X,W/2)*lte(Y,H/2)*lte(X-W/2+Y-H/2,0),A,B),if(lte(T,0.25),if(gt(X,W/2)*lte(Y,H/2),A,B),if(lte(T,0.375),if((gt(X,W/2)*gt(Y,H/2)*gt(X-W/2-Y+H/2,0))+(gt(X,W/2)*lte(Y,H/2)),A,B),if(lte(T,0.5),if(gt(X,W/2),A,B),if(lte(T,0.625),if((lte(X,W/2)*gt(Y,H/2)*gt(X-W/2+Y-H/2,0))+gt(X,W/2),A,B),if(lte(T,0.75),if((lte(X,W/2)*gt(Y,H/2))+gt(X,W/2),A,B),if(lte(T,0.875),if((lte(X,W/2)*lte(Y,H/2)*lte(Y-H/2-X+W/2,0)),B,A),A)))))))':shortest=1[stream5blended];[stream1overlaid][stream2blended][stream2overlaid][stream3blended][stream3overlaid][stream4blended][stream4overlaid][stream5blended][stream5overlaid]concat=n=9:v=1:a=0,format=yuv420p[video]" \
-map [video] \
-vsync 2 \
-async 1 \
-rc-lookahead 0 \
-g 0 \
-profile:v main \
-level 42 \
-c:v libx264 \
-r 30 \
../transition_clock.mp4
NB: ffmpeg documentation says, that -vsync option is deprecated.
Can your software be run via command line?