[mythtv-users] working MP4 transcode anyone? I keep getting a error with Mythbrake
Eric Sharkey
eric at lisaneric.org
Wed Nov 19 22:20:27 UTC 2014
On Wed, Nov 19, 2014 at 8:22 AM, Douglas Sargent <dbsargent at gmail.com> wrote:
> Hi, does anyone have a working script, that I can just copy paste?
I'm not sure exactly what you're looking for. This is a script I use
that may suit your needs:
------
#!/bin/sh
# MythTV user job to transcode a video to something appropriate for an android
# device with a 720p screen
SCREENX=1280
SCREENY=720
FILE=$1
TITLE=$2
OUTDIR=""
OUTRES=`ffmpeg -i ${FILE} 2>&1 | awk -v screenx=${SCREENX} -v
screeny=${SCREENY} '/Stream.*Video:/{
match($0, /([[:digit:]]+)x([[:digit:]]+) \[SAR
([[:digit:]]+):([[:digit:]]+) DAR ([[:digit:]]+):([[:digit:]]+)\]/,a);
inx=int(substr($0,a[1,"start"],a[1,"length"]));
iny=int(substr($0,a[2,"start"],a[2,"length"]));
dar=substr($0,a[5,"start"],a[5,"length"])/substr($0,a[6,"start"],a[6,"length"]);
sar=screenx/screeny;
if (dar>sar) {
if (inx>screenx) {
vx = screenx;
} else {
vx = inx;
}
vy = vx/dar;
} else {
if (iny>screeny) {
vy = screeny;
} else {
vy = iny;
}
vx = vy*dar;
}
print vx "x" vy;
}'`
nice ffmpeg -i "${FILE}" -strict -2 -y -acodec aac -ab 160k -ac 2 -s
${OUTRES} -threads 0 -vcodec libx264 -preset slow -profile:v baseline
-level 30 -maxrate 10000000 -bufsize 10000000 -f mp4
"${OUTDIR}${TITLE}.mp4"
------
Eric
More information about the mythtv-users
mailing list