Page 1 of 1

Transcoding OGM and MKV files for XBOX 360

Posted: Mon Nov 23, 2009 7:35 pm
by agroman
I am trying to enable transcoding for MKV and OGM files so I can play them on my Xbox 360.

I have done the following.

[*] Edited the *.location files in /usr/local/twonkymedia/cgi-bin so the paths to each ffmpeg, mencoder, convert, mplayer, vlc are correct.
[*] Created /usr/local/twonkymedia/cgi-bin/mencoder-mkv-divx.desc which contains the following :

Code: Select all

# transcode video (mkv to divx)
exec: mencoder $infile -oac copy -ovc xvid -o $outfile
# capabilities
from=video/x-matroska
to=video/x-divx
asynchronous
I figure there is also some edits I need to make to /usr/local/twonkymedia/resources/clients.db and /usr/local/twonkymedia/resources/transcoding.db, however I have little documentation to work with on these two files besides the comments in them.

If someone already has this working, I'd appreciate your input. Additionally, if anyone can explain more about the transcoding.db and client.db files I would also appreciate that.

Thank you![*]

Re: Transcoding OGM and MKV files for XBOX 360

Posted: Mon Nov 23, 2009 9:59 pm
by agroman
After doing some more reading I think I have figured out how to do this.

The "to=" portion in your *.desc file needs to have a corresponding entry in the transcoding.db if one does not already exist. Since I have selected the video/x-divx mime-type I need to add one to the stock transcoding.db because that mime-type doesn't have an entry already. So I have added the following line to transcoding.db

Code: Select all

DIVX,avi,video/x-divx
Additionally, this means that TMS's "$outfile" variable passed to mencoder will have the .avi extension.

Also, since I will now need to present this file to my Xbox I have to add the DIVX name to the list of transcoding resources in my clients.db file. The stock entry for Xbox 360 is

Code: Select all

NA:XBOX 360
HH:Xbox
DD:Xbox
DX:WMC
XM:DLNANO
DB:FIX
TR:JPEG_HD
MT:aif,aiff audio/aiff
MT:avi,divx video/avi
MT:flac audio/flac
MT:lpcm,pcm audio/lpcm
MT:m4a,mp4.a,3gp.a,m4b audio/mp4
MT:mp1,mp2 audio/mpeg
MT:ts video/mpeg
MT:wav audio/wav
MT:mpg not-supported
DF:devicedescription-xbox.xml
I have added DIVX to the TR line for Xbox 360. It is now

Code: Select all

NA:XBOX 360
HH:Xbox
DD:Xbox
DX:WMC
XM:DLNANO
DB:FIX
TR:JPEG_HD,DIVX
MT:aif,aiff audio/aiff
MT:avi,divx video/avi
MT:flac audio/flac
MT:lpcm,pcm audio/lpcm
MT:m4a,mp4.a,3gp.a,m4b audio/mp4
MT:mp1,mp2 audio/mpeg
MT:ts video/mpeg
MT:wav audio/wav
MT:mpg not-supported
DF:devicedescription-xbox.xml
Since there is already a line for .avi extensions, I do not need to change the MT rules.

I am not at home yet to test this, but as soon as I get there I will give it a shot and post my results.

Thanks

Re: Transcoding OGM and MKV files for XBOX 360

Posted: Tue Nov 24, 2009 10:30 pm
by agroman
Wow. This has been a pain the ass to figure out. The documentation for transcoding is really terrible. I feel like I've just been grabbing at straws instead of making any progress. I think my hangup is figuring out what in the frig is going with clients.db, transcoding.db and the to=, from= parameters in the *.desc files.

I've had some problems with MKV so I've focused on OGM files. Here's what I've got, starting with the basics.

My mencoder.location file is correctly pointing to where I installed it from src, which is /usr/local/bin.

Code: Select all

$ which mencoder
/usr/local/bin/mencoder
$ pwd
/usr/local/twonkymedia/cgi-bin
$ cat mencoder.location 
/usr/local/bin
I have a file mencoder-ogm-avi.desc that contains
$ cat mencoder-ogm-avi.desc
# transcode video
#(c) 2008 by PacketVideo
exec: mencoder $infile -oac mp3lame -ovc copy -o $outfile
# capabilities
from=application/ogg
to=video/avi
asynchronous
priority=idle
I've added the following lines to transcoding.db

Code: Select all

$ grep OGG transcoding.db 
OGG,avi,video/avi
# background-transcoding-group:OGM=OGG
As I had suspected, the checkbox for enabling backround transcoding for OGM shows up in the web config screen for transcoding. It will be greyed out if the mencoder.location file isn't correctly pointing to the directory containing mencoder.

My clients.db has been modified for Xbox by changing the TR: rule to which I added OGG.

Code: Select all

>>
NA:XBOX 360
HH:Xbox
DD:Xbox
DX:WMC
XM:DLNANO
DB:FIX
TR:JPEG_HD,WMV,OGG
MT:aif,aiff audio/aiff
MT:avi,divx video/avi
MT:flac audio/flac
MT:lpcm,pcm audio/lpcm
MT:m4a,mp4.a,3gp.a,m4b audio/mp4
MT:mp1,mp2 audio/mpeg
MT:ts not-supported
MT:wav audio/wav
MT:mpg not-supported
DF:devicedescription-xbox.xml
Still, none of my .ogm files are being presented to my xbox.

What am I doing wrong????

Re: Transcoding OGM and MKV files for XBOX 360

Posted: Wed Nov 25, 2009 12:09 am
by agroman
Well, I think I've found out part of the reason why I'm not seeing my .ogm files presented... they aren't being picked up by TMS when I scan my content directories!!! However, my .mkv files are being picked up. :x

Code: Select all

$ sqlite3 /var/twonkymedia/db/twonky.db
SQLite version 3.6.20
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .tables
Item          PlayList      ResElem       SeekPoint   
Keyword       PlayListItem  SeekItem    
sqlite> .schema Item
CREATE TABLE Item (filename TEXT UNIQUE COLLATE NOCASE,class TEXT COLLATE NOCASE,title TEXT COLLATE NOCASE,artist TEXT COLLATE NOCASE,creator TEXT COLLATE NOCASE,actor TEXT COLLATE NOCASE,author TEXT COLLATE NOCASE,genre TEXT COLLATE NOCASE,album TEXT COLLATE NOCASE,albumartist TEXT COLLATE NOCASE,trackno INTEGER,date TEXT COLLATE NOCASE,keywords TEXT COLLATE NOCASE,rating INTEGER,transcodingpriority INTEGER,transcodingstatus INTEGER,onlineservicename TEXT COLLATE NOCASE,onlineservicetitle TEXT COLLATE NOCASE,playcount INTEGER,lastplayedtime TEXT COLLATE NOCASE,protocol TEXT COLLATE NOCASE,externalyinserted INTEGER,metadata TEXT,usermetadata TEXT,moddate TEXT COLLATE NOCASE,location INTEGER,item_id INTEGER PRIMARY KEY);
sqlite> select count(*) from Item where filename like '%ogm%';
0
sqlite> select count(*) from Item where filename like '%mkv%';
93