Thanks Markus.
I just got something working, I think, so I didn't have a chance to use your solution. What I did was use a program called MediaInfo for windows to see what the saved streams contained. They are:
Matroska container
1 video stream: 13.Mbps 1920*1080 (16:9) at 29.970 fps. MPEG Video (Version 2)
1 audio stream: English 384, 48 KHz 16 bits, 6 channels, AC-3
1 audio stream: Spanish 192 Kbps, 48.0KHz 16 bits, 2 channels AC-3
With this info and a video clip I had that worked well I modfied an avconv command to properly stripout and downsample the stream.
For this to work with mediatomb:
1) Enable trancoding (change the proper section to "yes") in /etc/mediatomb/config.xml
2) Add the following profile:
<profile name="transcode-video" enabled="yes" type="external">
<mimetype>video/x-matroska</mimetype>
<accept-url>yes</accept-url>
<first-resource>yes</first-resource>
<hide-original-resource>yes</hide-original-resource>
<accept-ogg-theora>yes</accept-ogg-theora>
<agent command="/opt/transcode-video" arguments="%in %out"/>
<buffer size="1048576" chunk-size="26214" fill-size="52428"/>
</profile>
Also add the following to your 'mimetype-profile-mappings' section:
<transcode mimetype="video/x-matroska" using="transcode-video"/>
<transcode mimetype="video/x-flv" using="transcode-video"/>
<transcode mimetype="video/x-quicktime" using="transcode-video"/>
<transcode mimetype="video/realmedia" using="transcode-video"/>
Then create a bash script (/opt/transcode-video) with the following:
#!/bin/bash
exec "/usr/bin/avconv" -threads 4 -i "$1" -c:v libx264 -profile:v high -level:v 41 -s 1280x720 -b 2953k -r 23.976 -map 0:v -map 0:a:0 -acodec ac3 -ar 48000 -ac 2 -ab 384000 -f matroska - > "$2"
This
* uses multiple cores (-threads 4, if you have the power, i think it's a bit much, and I'm going to try and drop this to 1)
* uses h264 codec with a main@l4.1 profile (I couldn't get the high profile to work) (-c:v libx264 -profile:v high -level:v 41
* downsamples the feed from 1080p (-s 1280x720)
* lowers the bandwidth from the (relatively) massive 13Mps (-b 4096k)
* drops the framerate to 25fps (-r 25)
* keep the video stream (-map 0:v)
* drops the second audio stream (spanish audio) (-map 0:a:0)
* passes the ac3 audio through with some minimal downsampling (-acodec ac3 -ar 48000 -ac 2 -ab 448000)
* wraps it all in a matroska container (-f matroska)
* the default for avconv is to encode with h.264 (for this command)
Tips for others doing something similar:
* Run your avconv command form the command line on a small file and check the output to see what it is saving it as
* I got some of this info from here:
http://forevercached.syphzero.net/2012/03/ps3-mediatomb-debian-configuration-cont.html
I'm using an android app called 'MX Player' but I also tried several others (BSPlayer). I like MX Player in that it allows you to swap from h/w to s/w (to 'h/w+' encoding) right from the ui with a single tap. H/W+ encoding seems to work on some streams not not on everything. I think part of it might that my tvheadend setup was in progress when these were recorded or that they are PBS streams and they are different in some way (not sure).
Thanks everyone for the help.