2

I want to export all frames from a lot of video files, automatically in a jenkins build job using ffmpeg.

This script is running fine when I ssh into the slave and execute it in the same folder:

find . -name "*.mp4" -exec ffmpeg -i {} -qscale:v 1 -vf fps=6 {}_exportedFrame_%d.jpg \;

It should find all mp4 files and run ffmpeg on them.

It fails with this message when jenkins is running it (execute shell plugin):

08:51:32 find: ffmpeg: No such file or directory
08:51:32 find: ffmpeg: No such file or directory
08:51:32 find: ffmpeg: No such file or directory
08:51:32 find: ffmpeg: No such file or directory
...many more lines of the same error

Output from terminal (it's running fine):

bash-3.2$ find . -name "*.mp4" -exec ffmpeg -i {} -qscale:v 1 -vf fps=6 {}_exportedFrame_%d.jpg \;
ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
  built with Apple LLVM version 10.0.0 (clang-1000.11.45.5)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gpl --enable-libmp3lame --enable-libopus --enable-libsnappy --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-opencl --enable-videotoolbox
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
...

Build slave is running the latest version of mac os. ffmpeg is installed.

edit: I've added ffmpeg to the paths file

bash-3.2$ cat /etc/paths
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin/ffmpeg
bash-3.2$ type ffmpeg
ffmpeg is /usr/local/bin/ffmpeg

I'm still getting the same error.

Tamás
  • 105

1 Answers1

4

Probably ffmpeg is not in the PATH of the jenkins job.

Run type ffmpeg in your terminal to see where ffmpeg is located and echo $PATH in your jenkins job and compare.

Bodo
  • 6,068
  • 17
  • 27
  • I've added ffmpeg to paths, it still fails with the same error. See my edit in the question. – Tamás Jan 22 '19 at 14:15
  • And what does echo $PATH print when you add it to your jenkins job script? – Bodo Jan 22 '19 at 14:19
  • I guess adding ffmpeg to /etc/paths did not help. Output of echo $PATH: /usr/bin:/bin:/usr/sbin:/sbin – Tamás Jan 22 '19 at 14:21
  • I don't know when /etc/paths is used to construct the PATH variable. Maybe you have to restart jenkins. – Bodo Jan 22 '19 at 14:31
  • Yeah jenkins was the problem, I'm using now the explicit path (/usr/local/bin/ffmpeg) to ffmpeg in my scripts instead, and it works. It's lame, but changing the path variable did not work somehow. I guess some plugin or some setting somewhere overwrites my jenkins slave environment settings. – Tamás Jan 23 '19 at 13:13