My favorites | Sign in
Project Logo
                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
function getffmpegchildids {
ps --ppid $$ | awk '$4=="ffmpeg" {print $1}'
}

function stop_encoding {
echo $$ > /tmp/proc_$$
echo
echo "now stopping"
echo
echo
PIDS="$(getffmpegchildids)"
for mypid in $PIDS; do
kill $mypid > /dev/null 2>&1;
done
sleep 2;
PIDS="$(getffmpegchildids)"
for mypid in $PIDS; do
kill -9 $mypid > /dev/null 2>&1;
done
}
trap stop_encoding TERM;
trap stop_encoding EXIT;

FPS=16
nice -n 1 ffmpeg -y -i "$1" -ar 44100 -ab 128k -b 400k -r $FPS -f flv -s 400x224 -ac 1 "$2" 2>&1 &

sleep 5

while [ -n "$(getffmpegchildids)" ]; do
sleep 1;
done
Show details Hide details

Change log

r67 by claude.claude.nl on Jan 19, 2008   Diff
FFMpeg shouldn't hang anymore, mplayer
shouldn't stop after 1 second anymore,
returned to mencoder being the default
encoding method again
Go to: 
Project members, sign in to write a code review

Older revisions

r60 by claude.claude.nl on Dec 16, 2007   Diff
ffmpeg encoding when possible
All revisions of this file

File info

Size: 597 bytes, 32 lines
Hosted by Google Code