#!/bin/bash # #ffmpeg -- get mediafile length #ffmpeg -- get start time #ffmpeg -- get end time #end time = ###GET FILE LENGTH DURATION_FORMATTED='-sexagesimal' DURATION_LENGTH=$(ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 $DURATION_FORMATTED) DURATION=$($DURATION_LENGTH $INPUT_FILE) ##PRINT FILE LENGTH implement to kdialog kdialog --msgbox "$(ffmpeg -i %u 2>&1 |grep -E '(Duration)|(Stream)' )" echo -e $DURATION #Show media file duration in hours:minutes:seconds.microseconds $DURATION_FORMATTED='' echo -e $DURATION #Show media file duration in seconds #USER INPUT - DESIRED CUT (IN SECONDS) $START_TIME= $END_TIME= $INPUT_FILEFORMAT= +STRING=$(kdialog --icon=system-search --caption='Search string' --inputbox='Enter String to Search' 2> /dev/null) + +if [ "$?" != "0" ]; then + exit 1 +fi #0:03:14.921000 #tunti :: minuutti :: sekunti :: millisekunti #outputtaa näin: #if 0 hours, dont show the field if #if 0 minutes, don't show the field if #if 0 seconds, don't show the field if #if 0 milliseconds, don't show the field if #but final output can now be like #and >>> final output #ffmpeg -i -ss -to while [ $# -gt 0 ]; do INPUT_FILE=$1 OUTPUT_FILE=$(echo "$INPUT_FILE" | sed "s/\.\w*$/_cut.$INPUT_FILEFORMAT/") ffmpeg -i "$INPUT_FILE" -ss $START_TIME -to $END_TIME -y "$OUTPUT_FILE" shift done exit 0