Simple Nautilus shell script driving me nuts!
This Nautilus Shell-script does a simple video format conversion of a selected file and outputs the file to output.mp4:
#! /bin/bash FILE=$(echo "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | sed q) ffmpeg -i "$FILE" -sameq -s hd720 "output.mp4" but if I try to incorporate the original filename into the output, it does nothing!! #! /bin/bash FILE=$(echo "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | sed q) output="conv."$FILE".mp4" ffmpeg -i "$FILE" -sameq -s hd720 "$output" WHY??? |
Hi,
Try to run the script in debugging mode, so you will get to know, where it is breaking Eg: bash -bvx <scriptname> -b Notify of job termination immediately. -v Print shell input lines as they are read. -x Print commands and their arguments as they are executed. -- Thanks, Bijo |
I hard coded the selected file into the script and ran it with debugging and it worked, but it won't work as a Nautilus shell script.
I modified the script slightly and added the mv line at the end to attempt to force a name change after the conversion is done. The conversion works OK but the mv line is never executed. I'm flummoxed! #! /bin/bash FILE=$(echo "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | sed q) temp="temp.mp4" output="conv."$FILE ffmpeg -y -i "$FILE" -sameq -s hd720 "temp.mp4" mv $temp $output |
$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS returns the full path to the file so your output file name would be
conv./path/to/file/name.ext.mp4 Slashes are illegal characters in file names which is why your script does not work. If you desire to have your file named as conv.filename.mp4 then you need to strip the path and filename first and recombine it so it looks like /path/to/file/conv.base_file_name.mp4 http://linuxgazette.net/18/bash.html |
Quote:
Geoff |
All times are GMT -5. The time now is 08:07 AM. |