Xfce Forum

Sub domains
 

You are not logged in.

#1 2016-09-16 19:46:56

yurbev
Member
Registered: 2016-04-18
Posts: 54

Thunar Custom Action - Edit Audio/Video

This bash script is used to splice and save sequences from audio and video files. I'd like to improve the video editing component, because what I suspect it does is cut at keyframes and not precisely where I want the clip to be cut. When I use Blender in GUI mode I get precision cuts. Is there a setting in FFmpeg that will do what Blender does, and make precision cuts and ignore keyframes? Or it might be possible to use a Blender command instead of FFmpeg?

#!/bin/bash

INPUT=$(yad --width=600 --height=400 --file-selection --file-filter='*.mp3 *.mkv *.mp4 *.avi *.webm *.flv')

eval $(yad --width=400 --form --field=start --field=end --field=output:SFL "00:00:00.000" "00:00:00.000" "${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:v copy "$OUTPUT"

Offline

#2 2016-09-19 22:30:27

alcornoqui
Member
Registered: 2014-07-28
Posts: 832

Re: Thunar Custom Action - Edit Audio/Video

Check this answer in Stack Overflow.

If you want to cut precisely starting at a non-keyframe and want it to play starting at the desired point on a player that does not support edit lists, or want to ensure that the cut portion is not actually in the output file (for example if it contains confidential information), then you can do that by re-encoding so that there will be a keyframe precisely at the desired start time. Re-encoding is the default if you do not specify copy. For example:

ffmpeg -i movie.mp4 -ss 00:00:03 -t 00:00:08 -async 1 cut.mp4

Offline

Board footer

Powered by FluxBB