Skip to content

Instantly share code, notes, and snippets.

@dericed
Created March 21, 2013 06:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dericed/5211109 to your computer and use it in GitHub Desktop.
Save dericed/5211109 to your computer and use it in GitHub Desktop.
testing method to mark in and out of video using ffplay to support an edit
#!/bin/bash
# edit
mknod /tmp/stats p > /dev/null 2>&1
trap 'rm /tmp/stats' 0
printf "Enter a file: "
read input
echo "OK will try to play it."
ffplay "$input" -vf "showinfo,scale=360:240,split=3[v1][v2][v3],[v1]pad=iw*3[pad],[v2]setpts=PTS-0.5/TB[d1],[pad][d1]overlay=w[pad2],[v3]setpts=PTS-1/TB[d2],[pad2][d2]overlay=w*2" 2>&1 | tr '\r' '\n' > stats &
echo "Should be playing now."
echo "
q, ESC Quit.
f Toggle full screen.
p, SPC Pause.
a Cycle audio channel.
w Show audio waves.
left/right Seek backward/forward 10 seconds.
down/up Seek backward/forward 1 minute.
page down/page up: Seek backward/forward 10 minutes.
mouse click in player window: Seek to percentage in file corresponding to fraction of width.
"
printf "Find an in point and then hit enter: "
read ok
in=`tail -n 100 stats | grep -o pts_time:[0-9.]* | tail -n 1 | cut -d: -f2`
echo "The in time is $in"
printf "Find an out point and then hit enter: "
read ok
out=`tail -n 100 stats | grep -o pts_time:[0-9.]* | tail -n 1 | cut -d: -f2`
echo "The out time is $out"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment