Re: Sony Bravia - Aspect Ratio fixing
Illico wrote:On latest ffmpeg 0.8 changelog, I see :
- mpeg2 aspect ratio detection fixed
Don't know what this...any idea?
Downloaded ffmpeg via Git and compiled. Aspect ratio problem on some has gone away (namely 16:9 content). Anything else gets stretched. I worked around Serviio's (current) inability to pass custom options by renaming ffmpeg to something else and creating a new "ffmpeg" script (see below) that calls the original ffmpeg binary after some manipulation. At a minimum it allows me to remap my AC3 streams from track 2 to track 1 (works great, btw). I'm trying to force the aspect ratio using "setdar" and "-aspect" commands, but they're ignored somehow. I use this same exact script for MediaTomb and it works. Is there something at the DLNA protocol level that munges this? I've looked at the protocol exchange between TV and server using MT & Serviio, but don't see anything different.
#!/bin/bash
INPUT="$2"
DAR=`ffprobe -show_streams "${INPUT}" | grep -m 1 'display_aspect_ratio' | awk -F= '{ print $2 }'`
#SAR=`ffprobe -show_streams "${INPUT}" | grep -m 1 'sample_aspect_ratio' | awk -F= '{ print $2 }'`
#FPS=`ffprobe -show_streams "${INPUT}" | grep -m 1 'avg_frame_rate' | awk -F= '{ print $2 }'`
AC3_TRACK=`ffprobe -show_streams "${INPUT}" | grep ac3 -B10 | grep 'index=' | awk -F= '{ print $2 }'`
ASPECT_1=`echo $DAR | awk -F: '{ print $1 }'`
ASPECT_2=`echo $DAR | awk -F: '{ print $2 }'`
ASPECT_R=$(($ASPECT_1 / $ASPECT_2))
if [ $DAR != '' ]; then
ASPECT="-vf setdar=${DAR}";
else
ASPECT="-vf setdar=16:9";
fi
if [ ! $AC3_TRACK ]; then
AC3_TRACK=1;
fi
OPTS="${@//0:1/0:$AC3_TRACK $ASPECT}";
echo $OPTS > /tmp/serviio.txt
echo $AC3_TRACK >> /tmp/serviio.txt
echo $ASPECT_1 >> /tmp/serviio.txt
echo $ASPECT_2 >> /tmp/serviio.txt
echo $ASPECT_R >> /tmp/serviio.txt
echo $ASPECT_M >> /tmp/serviio.txt
ffmpeg.exe "${@//0:1/0:$AC3_TRACK $ASPECT}"