[mythtv-users] Best settings for transcoding HD content to save space?
Eric Sharkey
eric at lisaneric.org
Tue May 13 17:21:27 UTC 2014
On Mon, May 12, 2014 at 7:50 PM, Raymond Wagner <raymond at wagnerrp.com> wrote:
> On 5/12/2014 6:52 PM, Ben Kamen wrote:
>>
>> I've been looking at my drive space wondering if I can trim down
>> per/show usage by good transcoding settings.
>
> You're best off just performing lossless cutting and being done with it.
> Disk space is cheap. Transcoding takes time.
It's not really a one size fits all situation, from my point of view.
If you're typically watching stuff not too long after recording it and
doing it on a fully capable device and deleting it after watching it
once, then transcoding makes no sense. If it takes you years to get
around to watching something or you record something that you want to
watch multiple times or you want to watch it on a device which is not
capable of playing the recording in the format it was recorded in,
then transcoding may make sense for you.
> If you absolutely must
> transcode, you do not want to use the internal transcoder.
Can you clarify that statement? What's so bad about the internal
transcoder? I've not been using it, but I've been wondering if I
should.
I've been tweaking a script I've been using to transcode video to (at
most) 720p mpeg4. It produces files which are watchable from my phone
as well as any other device I have, although the quality degradation
is noticeable on a larger 1080p screen, but not too bad. If I try to
watch something on the phone using http live streaming I've never been
happy with the experience (the wait for the stream to start and great
difficulties in seeking within the stream are a problem).
This is what I use:
#!/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"
I'm not sure if all of those options are really still needed or not.
I don't seem to have libx264-slow.ffpreset anymore, but the script
still seems to work somehow.
Eric
More information about the mythtv-users
mailing list