0

I am trying to convert multiple images to a video using FFMPY which seemed to be fine. However, the video was show and now I want to change the duration of how long an image appears in a video. One approach came from FFMPEG itself.

ff = ffmpy.FFmpeg(
    executable='/Users/username/Documents/GitHub/python_audio/ffmpeg',
    inputs={
        '/Users/username/Documents/GitHub/python_audio/images/img0.jpeg': ["-framerate=60"],
        '/Users/username/Documents/GitHub/python_audio/images/img1.jpeg': ["-framerate=60"]
    },
    outputs={'movie.mov': ["-filter:a", "atempo=0.5"]}
)
ff.run()

It doesn't work. Now it seems ffmpy is a bit different than FFMPEG's usual commands. Does anybody know how to change the length/duration of an image?

Thanks in advance.

EDIT: Another try:

ff = ffmpy.FFmpeg(
    executable='/Users/username/Documents/GitHub/python_audio/ffmpeg',
    inputs={
        '/Users/username/Documents/GitHub/python_audio/images/img0.jpeg': ["-framerate 25, -loop 1, -t 10"],
        '/Users/username/Documents/GitHub/python_audio/images/img1.jpeg': ["-framerate 25, -loop 1, -t 10"]
    },
    outputs={'movie.mov': ["-filter:a", "atempo=0.5"]}
)
ff.run()

But the response is

ffmpeg version 4.3.1-tessus  https://evermeet.cx/ffmpeg/  Copyright (c) 2000-2020 the FFmpeg developers
  built with Apple clang version 11.0.0 (clang-1100.0.33.17)
  configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvmaf --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-version3 --pkg-config-flags=--static --disable-ffplay
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Unrecognized option 'framerate 25, -loop 1, -t 10'.
Error splitting the argument list: Option not found
Traceback (most recent call last):
  File "pyff.py", line 16, in <module>
    ff.run()
  File "/Users/username/Library/Python/2.7/lib/python/site-packages/ffmpy.py", line 105, in run
    raise FFRuntimeError(self.cmd, self.process.returncode, out[0], out[1])
ffmpy.FFRuntimeError: `/Users/username/Documents/GitHub/python_audio/ffmpeg "-framerate 25, -loop 1, -t 10" -i /Users/username/Documents/GitHub/python_audio/images/img1.jpeg "-framerate 25, -loop 1, -t 10" -i /Users/username/Documents/GitHub/python_audio/images/img0.jpeg -filter:a atempo=0.5 movie.mov` exited with status 1

STDOUT:


STDERR:
nucky
  • 348
  • 5
  • 15
  • In normal ffmpeg you can do `ffmpeg -framerate 25 -loop 1 -t 10 -i img0.jpeg -framerate 25 -loop 1 -t 5 -i img1.jpeg ...` – llogan Oct 21 '20 at 17:47
  • @llogan thanks, I tried to include it. But, yeah, didn't work. – nucky Oct 21 '20 at 19:17
  • Your command has 2 images as input, but ffmpeg will only choose one by default. You have to concatenate the images. And you are using atempo filter but you do not provide an audio input. It is not clear what you are trying to do. – llogan Oct 21 '20 at 19:38

0 Answers0