You are not logged in.
So I created this little one liner, to automatically crop a video while playing it.
mplayer -vf crop=`mplayer -quiet -vo null -vf cropdetect 1.avi -frames 100 | awk -F '[()]' '{sub(/^-vf crop=-/, "", $2); print $2}' | uniq | grep -Ev 'End of file' | tail -2` 1.avi
This does KIND of work, but it has a major problem: it starts from the beginning of the file, which most likely is black, resulting in negative numbers and non-working playback.
So I added the -ss 60 option to mplayer. This option makes mplayer start at 60 seconds of the clip. THATS ALL IT DOES.
And now look what happens in both cases:
➜ ~ mplayer -quiet -vo null -vf cropdetect 1.avi -frames 100 | awk -F '[()]' '{sub(/^-vf crop=-/, "", $2); print $2}' | uniq | grep -Ev 'End of file' | tail -2
640:-352:646:358
➜ ~ mplayer -quiet -ss 60 -vo null -vf cropdetect 1.avi -frames 100 | awk -F '[()]' '{sub(/^-vf crop=-/, "", $2); print $2}' | uniq | grep -Ev 'End of file' | tail -2
-vf crop=640:352:4:4
As you can see, as soon as I make mplayer start from a different position, the awk line fails. i have NO clue how this can even be possible tho
Last edited by Rasi (2012-03-20 20:49:42)
He hoped and prayed that there wasn't an afterlife. Then he realized there was a contradiction involved here and merely hoped that there wasn't an afterlife.
Douglas Adams
Offline
Ok... i simply used the whole output in the brackets now, which resulted in this:
#!/bin/sh
mplayer `mplayer -ao null -ss 60 -frames 100 -vf cropdetect -vo null "$1" | awk -F '[()]' '{print $2}' | uniq | grep -Ev 'End of file' | tail -2` "$1"
Last edited by Rasi (2012-03-20 20:52:20)
He hoped and prayed that there wasn't an afterlife. Then he realized there was a contradiction involved here and merely hoped that there wasn't an afterlife.
Douglas Adams
Offline
Thanks for the nice script
Offline