Xfce Forum

Sub domains
 

You are not logged in.

#1 2014-10-26 11:05:32

birch
Member
Registered: 2014-07-12
Posts: 63

Custom Actions - Convert Images to Video Bash Script

I archive images to video, using the padding option in FFmpeg so that the images aren't distorted when viewed in video players. At the moment I'm using the following custom action, which converts selected jpgs to mp4 with a 1600x900 resolution and a framerate of 15:

for file in %N; do ffmpeg -framerate 15 -pattern_type glob -i '*.jpg' -vf "scale=min(1600/iw\,900/ih)*iw:min(1600/iw\,900/ih)*ih,pad=1600:900:(1600-(min(1600/iw\,900/ih)*iw))/2:(900-(min(1600/iw\,900/ih)*ih))/2" -c:v libx264 output.mp4; done

I'd like to change this to a bash script, which will offer the following pop-up options prior to conversion:

--choose one of several video formats, specifically mp4 and webm.

--choose one of several image formats, specifically jpg and webp

--customize padding width and height dimensions

--customize framerate

I tried modifying the following bash script, which is used for converting videos, to no avail -- but perhaps it will help as a guideline:

!# /bin/bash



ConvertTo=$(zenity --list --column="Select One" --title="Video 

Converter" --height=300 --width=250 --text="Select the format 

to convert to" avi 3gp flv mov mp4 mkv asf wmv mpg mov)

   if [ $? == 1 ]; then

      exit

   fi

Video=$(zenity --entry --entry-text="1000" --title="Video 

Converter" --text="Enter video bitrate (Kb/sec)")

   if [ $? == 1 ]; then

      exit

   fi

Audio=$(zenity --entry --entry-text="128" --title="Video 

Converter" --text="Enter audio bitrate (Kb/sec)")

   if [ $? == 1 ]; then

      exit

   fi



tail -f ~/Scripts/convert-video.sh | zenity --progress --pulsate

 --auto-close --auto-kill --title="Converting" --text="Converting

 video to $ConvertTo ... Please wait." &

name=$(echo $1 | cut -f1 -d.)



ffmpeg -i "$1" -ab "$Audio"K -vb "$Video"K "$name.$ConvertTo"



killall -KILL tail



zenity --info --title="Video Converter" --text="Conversion to 

$ConvertTo finished.\n\nPlease check file to insure\nno errors 

on conversion."



exit 0

Last edited by birch (2014-10-26 11:25:37)

Offline

Board footer

Powered by FluxBB