I've basically installed ffmpeg on a vps with 20.04 ubuntu

I am trying to create a video in /home/ubuntu/video folder - so i am asking script to select all jpeg files in that folder

ffmpeg -f image2 -r 25 -pattern_type glob -i '*.jpg' -qscale 3 -s 1920x1080 -c:v wmv1 video.wmv

which works perfectly and creates a video

so i have now asked cronjobs to do this automatically - every 2 minuted therefore created an sh file and used this script

*/2 * * * * /home/ubuntu/video/makewmv.sh

and this is the .sh file

ffmpeg -f image2 -r 25 -pattern_type glob -i '*.jpg' -qscale 3 -s 1920x1080 -c:v wmv1 video.wmv

and when i do grep CRON logs i get this

Dec 29 23:16:01 vps-1fd6f1ab CRON[16186]: (ubuntu) CMD (/home/ubuntu/video/makewmv.sh)

But i do not have the video.wmv ..

I can see the cronjobs are doing what it suppose to be doing - however i am doing something wrong

Can someone help please

I really appreciate it.

(I am extremely new to Linux)

  • Have you tried logging and examining the job's output/errors ex. /home/ubuntu/video/makewmv.sh >/home/ubuntu/cron.log 2>&1 ? – steeldriver Dec 30 '20 at 0:00
  • Thank you for your response - i am getting Could not open file : *.jpg and 'Could not find codec parameters for stream 0 (Video: mjpeg, none(bt470bg/unknown/unknown)): unspecified size Consider increasing the value for the 'analyzeduration' and 'probesize' options' – M Kinili Dec 30 '20 at 0:55
  • ... you probably need to add a cd /home/ubuntu/video/ before the ffmpeg command in your script – steeldriver Dec 30 '20 at 0:56
  • Still having issues - i changed the crontab -e to */2 * * * * cd /home/ubuntu/video/ ffmpeg -f image2 -r 25 -pattern_type glob -i '*.jpg' -qscale 3 -s 1920x1080 -c:v wmv1 video.wmv still not winining!! – M Kinili Dec 30 '20 at 1:26
  • 1
    I'd suggest you ad the cd command inside the script, however if you wish to add it as part of the cron job it needs to be a separate command separated from the ffmpeg command by either && or ; – steeldriver Dec 30 '20 at 1:32
*/2 * * * * /home/ubuntu/video/makewmv.sh

Put this in your cron file, and then cd to the correct directory in your bash script, which should be as follows:

cd /home/ubuntu/video
ffmpeg -f image2 -r 25 -pattern_type glob -i '*.jpg' -qscale 3 -s 1920x1080 -c:v wmv1 video.wmv > makewmv.log 2>&1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.