YAD and Zenity - Input Start/Stop Times to Trim Video
1
vote
2
answers
5272
views
I have a bash script and a php script that function in concert to [trim audio/video files using start/stop times](https://unix.stackexchange.com/questions/182602/trim-audio-file-using-start-and-stop-times) .
PHP script:
format('U') - $dt1->format('U');
// echo $dt3."\n";
$h = (int)($dt3 / 3600);
$dt3 %= 3600;
$m = (int)($dt3 / 60);
$dt3 %= 60;
$s = $dt3;
// Dump as H:M:S
echo $h . ":" . $m . ":" . $s;
?>
chopvideoaudio.sh script:
#!/bin/bash
INFILE=$1
START=$2
STOP=$3
OUTFILE=$4
OFFSET=
php TimeDiff.php "$START" "$STOP"
echo "Disecting $INFILE starting from $START to $STOP (duration $OFFSET)"
ffmpeg -ss "$START" -t "$OFFSET" -i "$INFILE" "$OUTFILE"
Usage:
./chopvideoaudio.sh [input.mp4] [startchop] [stopchop] [output.mp4]
Where [startchop] and [stopchop] are both absolute timestamps from the beginning of the track.
Example command to run this script:
./chopvideoaudio.sh input.mp4 00:01:20 00:01:45 output.mp4I want a [YAD (yet another dialog)](http://sourceforge.net/projects/yad-dialog/) script that will open up a dialog box(es) containing an input field to enter a custom file type (e.g. mp3, mp4, avi). Then input fields for the two timestamps, in which I can enter two custom timestamps. After pressing
OK
the script will run and extract the section from between the two timestamps.
I would also be interested in a solution using [Zenity](http://www.linux.org/threads/zenity-gui-for-shell-scripts.5567/) , but I prefer YAD.
Asked by whitewings
(2527 rep)
Feb 10, 2015, 07:00 AM
Last activity: May 12, 2023, 02:42 PM
Last activity: May 12, 2023, 02:42 PM