10/08/2011, 03:07 PM
|
#1 (permalink) |
|
Member
![]() Join Date: Oct 2011
Posts: 42
Likes Received: 1
Thanks: 3
Thanked 1 Time in 1 Post
|
MEDIATOMB STREAMING *** playback not smooth,stop and seeking broken with 3.04 webOS update ***
*** 3.02 works fine, waiting for fix *** Warning: may be a bit technical for newbies. Mediatomb can be used for streaming HD content to the touchpad player with very good results. The idea is files with a compatible video codec may not need video transcoding, so we may only need to convert the audio. I have watched an hour and 30 minute movie on the touchpad using the setup described here. It has played 1080p quicktime trailers and downloaded youtube videos. It should essentially stream whatever can be played back locally on the TP. It is possible to use this method on MKV,AVI,TS etc and many other formats that are coded in an h.264 codec compatible to the touchpad player. Note that some mp4 and mov format files are played directly and so must have compatible sound codecs. The script will eventually be updated to examine the internal codecs and skip any unnecessary transcoding. In my case, most of my videos are 480p and 720p h.264 AC-3 ts format files. To stream them, I use ffmpeg to convert them to the mov container only converting the sound format to be compatible. The original files are not modified. Since only the sound is transcoded it takes only a few minutes to prepare a full-length movie to be streamed. There are occasional issues with sound syncing but in my tests this is due to a bug in the player itself (the same issue occurs when I play the file locally on the TP). Sometimes the sound sync will be perfect. Other times if I play another file first it will sync correctly. It may take more than that but remember you only need to prepare the file one. Once set up, this is all controlled by the touchpad using UPnP AV player. Note: Bhome free at the time of this writing is NOT compatible with mediatomb transcoding. Using this external command line for mediatomb: # use your own PATH here Code:
ffmpeg -i "$1" -vcodec copy -acodec pcm_s16le -ac 2 -y -f mov "$PATH1"/TVID.mov && (qt-faststart "$PATH1"/TVID.mov "$PATH1"/MP4VID.mov & (sleep 1;cat "$PATH1"/MP4VID.mov > "$2")) ----------------------------------------------------------------------------------- MEDIATOMB EXTERNAL TRANSCODE CONFIGURATION: Note that for the transcode the video_common proc is the key (probably all that is required). This script will start playback immediately after the transcode. It will still create the file so if you have sync issues there will be no need to transcode again. If you want to seek in the file, then you must playback the created MP4VID.mov directly. While the transcode is occurring one can minimize the card [and multitask] until you hear the audio begin! I have found it is best to test this stuff with smaller files and please be observant of the mediatomb logging info. mediatomb-transcode.sh: Code:
#!/bin/sh
# This script is used by MediaTomb for transcoding support.
video_common() {
trap "echo pkill cat;pkill qt-faststart;pkill ffmpeg" SIGPIPE # this seems to be ignored for some reason
PATH1="/media/tempStorage"
ffmpeg -i "$1" -vcodec copy -acodec pcm_s16le -ac 2 -y -f mov "$PATH1"/TVID.mov && (qt-faststart "$PATH1"/TVID.mov "$PATH1"/MP4VID.mov & (sleep 1;cat "$PATH1"/MP4VID.mov > "$2"))
}
# Basic function that will transcode any input file into the wav format
audio_common() {
local input="$1"
local output="$2"
ffmpeg -i "$input" -f wav -y "$output"
}
# Function to transcode matroska files to dvd compatible format
transcode_matroska() {
local input="$1"
local output="$2"
local alang="$3"
local slang="$4"
# Default to english if languages are not set
[ "$alang" ] || alang="eng"
[ "$slang" ] || slang="eng"
# Use mencoder if available, else fall back to using ffmpeg.
# Transcoding using ffmpeg will not include subtitles.
if which mencoder >/dev/null 2>&1; then
mencoder "$input" -oac lavc -ovc lavc -of mpeg -mc 0 -noskip \
-lavcopts vcodec=mpeg2video:vbitrate=6000:acodec=ac3:abitrate=448 \
-vf harddup -alang "$alang" \
-slang "$slang" -font 'Bitstream Vera Sans' \
-o "$output"
else
ffmpeg -alang "$alang" -slang "$slang" -i "$input" -target dvd \
-y "$output"
fi
}
# Our "main" function below.
USAGE="
This script is used by MediaTomb for transcoding support. It can also serve as
a script to transcode various files in a format suitable for streaming directly.
Synopsis:
mediatomb-transcode [TRANSCODE FUNCTION OPTION] [GENERIC OPTIONS]
Generic Options:
-h, --help Display this help message.
-i, --input Input file that is meant to be transcoded.
-o, --output Output file that will be read back by MediaTomb.
--audio-lang Specify ISO 639 language code to use for audio.
--subtitle-lang Specify ISO 639 language code to use for subtitles.
Transcode Function Options (one is required):
--video-common Perform generic video transcoding.
--audio-common Perform generic audio transcoding.
--transcode-matroska Used in transcoding matroska files.
"
while [ "$#" -gt "0" ]
do
case "$1" in
-i|--input)
INPUT="$2"
shift; shift;
;;
-o|--output)
OUTPUT="$2"
shift; shift;
;;
--video-common)
USE_VIDEO_COMMON=1
shift
;;
--audio-common)
USE_AUDIO_COMMON=1
shift
;;
--transcode-matroska)
USE_TRANSCODE_MATROSKA=1
shift
;;
--audio-lang)
ALANG="$2"
shift; shift;
;;
--subtitle-lang)
SLANG="$2"
shift; shift;
;;
-h|--help|*)
echo "${USAGE}"
exit 1
;;
esac
done
# Perform specified function
if [ $USE_VIDEO_COMMON ]; then
video_common "$INPUT" "$OUTPUT"
elif [ $USE_AUDIO_COMMON ]; then
audio_common "$INPUT" "$OUTPUT"
elif [ $USE_TRANSCODE_MATROSKA ]; then
transcode_matroska "$INPUT" "$OUTPUT" "$ALANG" "$SLANG"
else
# Must specify one transcoding function
echo "${USAGE}"
exit 1
fi
MEDIATOMB (config.xml) CONFIGURATION: This is the tricky part. Save your original files and substitute from mappings to end of file. Note: not all the mappings have been used or tested so editing may be required. Code:
<mappings>
<extension-mimetype ignore-unknown="no">
<map from="mp3" to="audio/mpeg"/>
<map from="ogg" to="application/ogg"/>
<map from="asf" to="video/x-ms-asf"/>
<map from="asx" to="video/x-ms-asf"/>
<map from="wma" to="audio/x-ms-wma"/>
<map from="wax" to="audio/x-ms-wax"/>
<map from="wmv" to="video/x-ms-wmv"/>
<map from="wvx" to="video/x-ms-wvx"/>
<map from="wm" to="video/x-ms-wm"/>
<map from="wmx" to="video/x-ms-wmx"/>
<map from="m3u" to="audio/x-mpegurl"/>
<map from="pls" to="audio/x-scpls"/>
<map from="flv" to="video/x-flv"/>
<map from="mkv" to="video/mpeg"/>
<map from="mka" to="audio/x-matroska"/>
<map from="ts" to="video/mpeg"/>
<map from="avc" to="video/mpeg"/>
<map from="avi" to="video/mpeg"/>
<!--<map from="mp4" to="video/mpeg"/> -->
<!-- Uncomment the line below for PS3 divx support -->
<!-- <map from="avi" to="video/divx"/> -->
<!-- Uncomment the line below for D-Link DSM / ZyXEL DMA-1000 -->
<!-- <map from="avi" to="video/avi"/> -->
</extension-mimetype>
<mimetype-upnpclass>
<map from="audio/*" to="object.item.audioItem.musicTrack"/>
<map from="video/*" to="object.item.videoItem"/>
<map from="image/*" to="object.item.imageItem"/>
<map from="application/ogg" to="object.item.audioItem.musicTrack"/>
</mimetype-upnpclass>
<mimetype-contenttype>
<treat mimetype="audio/mpeg" as="mp3"/>
<treat mimetype="application/ogg" as="ogg"/>
<treat mimetype="audio/x-flac" as="flac"/>
<treat mimetype="image/jpeg" as="jpg"/>
<treat mimetype="audio/x-mpegurl" as="playlist"/>
<treat mimetype="audio/x-scpls" as="playlist"/>
<treat mimetype="audio/x-wav" as="pcm"/>
<treat mimetype="audio/L16" as="pcm"/>
<treat mimetype="video/x-msvideo" as="avi"/>
<treat mimetype="video/mp4" as="mp4"/>
<treat mimetype="audio/mp4" as="mp4"/>
<treat mimetype="application/x-iso9660" as="dvd"/>
<treat mimetype="application/x-iso9660-image" as="dvd"/>
<treat mimetype="video/x-matroska" as="mkv"/>
<treat mimetype="audio/x-matroska" as="mka"/>
<treat mimetype="video/mpeg" as="mp4"/>
</mimetype-contenttype>
</mappings>
<online-content>
<!-- Make sure to setup a transcoding profile for flv -->
<YouTube enabled="no" refresh="28800" update-at-start="no" purge-after="604800" racy-content="exclude" format="flv" hd="no">
<favorites user="mediatomb"/>
<standardfeed feed="most_viewed" time-range="today"/>
<playlists user="mediatomb"/>
<uploads user="mediatomb"/>
<standardfeed feed="recently_featured" time-range="today"/>
</YouTube>
<Weborama enabled="no" refresh="28800" update-at-start="no">
<playlist name="Active" type="playlist" mood="active"/>
<playlist name="Metal" type="playlist">
<filter>
<genres>metal</genres>
</filter>
</playlist>
</Weborama>
<AppleTrailers enabled="no" refresh="43200" update-at-start="no" resolution="640"/>
</online-content>
</import>
<transcoding enabled="yes">
<mimetype-profile-mappings>
<transcode mimetype="video/x-flv" using="video-common"/>
<transcode mimetype="application/ogg" using="audio-common"/>
<transcode mimetype="audio/x-flac" using="audio-common"/>
<transcode mimetype="video/divx" using="video-common"/>
<transcode mimetype="video/x-matroska" using="transcode-matroska"/>
<transcode mimetype="video/mpeg" using="video-common"/>
</mimetype-profile-mappings>
<profiles>
<profile name="video-common" enabled="yes" type="external">
<mimetype>video/mp4</mimetype>
<accept-url>yes</accept-url>
<first-resource>yes</first-resource>
<accept-ogg-theora>yes</accept-ogg-theora>
<agent command="mediatomb-transcode.sh" arguments="-i %in -o %out --video-common"/>
<buffer size="14400000" chunk-size="5120000" fill-size="120000"/>
</profile>
<profile name="audio-common" enabled="no" type="external">
<mimetype>audio/wav</mimetype>
<accept-url>no</accept-url>
<first-resource>yes</first-resource>
<accept-ogg-theora>no</accept-ogg-theora>
<agent command="mediatomb-transcode" arguments="-i %in -o %out --audio-common"/>
<buffer size="50000" chunk-size="5000" fill-size="1000"/>
</profile>
<profile name="transcode-matroska" enabled="yes" type="external">
<mimetype>video/mpeg</mimetype>
<accept-url>yes</accept-url>
<first-resource>yes</first-resource>
<accept-ogg-theora>yes</accept-ogg-theora>
<agent command="mediatomb-transcode.sh" arguments="-i %in -o %out --transcode-matroska"/>
<buffer size="14400000" chunk-size="512000" fill-size="120000"/>
</profile>
</profiles>
</transcoding>
</config>
Last edited by levinite; 10/19/2011 at 01:24 PM. Reason: add new transcode script, general edits |
10/09/2011, 09:32 AM
|
#2 (permalink) |
|
Member
![]() Join Date: Aug 2011
Location: Moscow, Russia
Posts: 4
Likes Received: 0
Thanks: 1
Thanked 0 Times in 0 Posts
|
Can't start mediatomb with your config.xml
Code:
2011-10-09 18:29:18 INFO: Loading configuration from: /opt/etc/mediatombdb/mediatomb/config.xml 2011-10-09 18:29:18 ERROR: Error parsing config file: /opt/etc/mediatombdb/mediatomb/config.xml line 52: junk after document element what's wrong? upd: now it starts OK. but transcoding still not works for me with your cfg
Last edited by palmpreuser14; 10/09/2011 at 09:42 AM. |
10/09/2011, 10:23 AM
|
#3 (permalink) |
|
Member
![]() Join Date: Oct 2011
Posts: 42
Likes Received: 1
Thanks: 3
Thanked 1 Time in 1 Post
|
If you have used mediatomb before, I suggest starting with a new database because it appears the new data types are not updated properly. The item meme type should be "video/mpeg" without the quotes for transcoding to occur. This can be checked or changed using your browser to edit the database file (use the edit icon). I have a new transcode script that will start playback without the need to play the ttttt.mp4 file. I will update the original post shortly.
|
10/26/2011, 10:24 PM
|
#4 (permalink) | |
|
Member
![]() Join Date: Jan 2009
Posts: 104
Likes Received: 4
Thanks: 4
Thanked 4 Times in 4 Posts
|
Quote:
Thanks for the setups. It looks like the transcoding works for me, at least it shows up on the terminal stout however I am not seeing any results on TP BHome. I have also tried with Upnp and does not seem to work either. It says loading and stays there even after the transcoding is done on the server side. I am not sure really. Last edited by karun; 10/26/2011 at 10:33 PM. |
|
10/27/2011, 09:16 AM
|
#5 (permalink) | |
|
Member
![]() Join Date: Oct 2011
Posts: 42
Likes Received: 1
Thanks: 3
Thanked 1 Time in 1 Post
|
Quote:
|
|
![]() |
|
| Tags |
| mediatomb, streaming, video |
| Thread Tools | |
| Display Modes | |
|
|



