Hi,
+1 for vlc, more efficient, decoding is hardware-acelerated, and support subtitles.
I encountered the same problems, here is the bash script I use to avoid them (using a trap command). It almost always work. Tweak the cvlc command to your likings, but do not forget the "&".
Call it with (in subsonic) : vlc.sh %s %b %o %w %h
- Code: Select all
#!/bin/bash
function trap_cmd {
#echo $vlcpid 1>&2
sleep 2
kill $vlcpid
sleep 20
kill $vlcpid
exit
}
file=$1
bitrate=$2
start=$3
sizew=$4
sizeh=$5
subtrack=0
filenoext=`echo $file|sed -e "s/\.[^.]*$//"`
if [ -f "$filenoext".fr.* ] && [ -f "$filenoext".en.* ]
then subtrack=1
fi
/usr/bin/cvlc -I dummy "$file" -q --start-time=$start :sout="#transcode{venc=x264{profile=main,level=3,keyint=50,vbv-maxrate=$bitrate,vbv-bufsize=512,no-mbtree,no-mixed-refs,ref=2,subme=4,weightp=1,me=umh},vcodec=h264,vb=$bitrate,vfilter=canvas{width=$sizew,height=$sizeh,aspect=$sizew:$sizeh,padd},aenc=ffmpeg{aac-profile=low},acodec=mp4a,ab=64,soverlay}:standard{access=file,mux=ffmpeg{mux=flv},dst=-}" --sub-language="fr,any" --sub-track=$subtrack vlc://quit 2>/dev/null &
sleep 2
vlcpid=$!
echo "VLC pid is "$vlcpid
trap "trap_cmd" 0 1 2 3 4 5 6 7 8 10 12 13 14 15 20
wait $vlcpid
PS : however, something is still buggy here, and I would like to know what. Basically, subsonic often fail to kill vlc because it won't use the right pid for the script and/or the encoder process.