I use this script to cut media files at selected time:
#!/bin/bash
INPUT=$(yad --width=600 --height=400 --file-selection --file-filter='.m4a .ogg .mp3 .mp4 .avi .aac .flac .avi .mkv .mp4')
eval $(yad --width=400 --form --field=start --field=end --field=output:SFL "00:00:00" "00:00:00" "${INPUT/%.}-out.${INPUT##.}" | awk -F'|' '{printf "START=%s\nEND=%s\nOUTPUT="%s"\n", $1, $2, $3}')
[[ -z $START || -z $END || -z $OUTPUT ]] && exit 1
DIFF=$(($(date +%s --date="$END")-$(date +%s --date="$START")))
OFFSET=""$(($DIFF / 3600)):$(($DIFF / 60 % 60)):$(($DIFF % 60))
ffmpeg -ss "$START" -t "$OFFSET" -i "$INPUT" -c copy "$OUTPUT"
I have found it HERE initially and only changed the last line (to cut/copy without conversion).
But I am in KDE and would like to use kdialog
for a better interaction.
The first part, starting with INPUT=$(yad
can be adjusted like so, I guess:
INPUT=$(kdialog --getopenfilename ~/Videos/ '*.m4a *.ogg *.mp3 *.mp4 *.avi *.aac *.flac *.avi *.mkv *.mp4')
But then I don't find an alternative in kdialog
to the second part (starting with eval $(yad --width=400 --form --field=start --field=end --field=output:SFL "00:00:00" "00:00:00" ...
) so that it shows a window where the timestamp start and end could be entered:
(In case this is possible I would also like to have a progress bar or message and a "ok" message at the end. - Please feel free to suggest other solutions than kdialog if available for KDE.)