NMT:firmware: Difference between revisions

From Lundman Wiki
No edit summary
mNo edit summary
Line 1: Line 1:
== Transcoding ==
== Sources for llink ==


Transcoding with llink is a relatively new features (as of llink-2.3.2) which still needs a fair bit of work. Each device will need its own settings, and tweaks.
Latest sources are here:


As an example, Playstation 3 can not play ''.mkv'' files (as of 3.70 anyway). So we ask llink to change any file ending with ''.mkv'' into a different format. Since it is streaming (not writing the whole encoded file on disk before sending) what we send to the PS3 has to be a format capable of streaming. Like that of MPEG-TS. So we convert the file into a ''.mpg'' file, or rather, ''.mkv.mpg''.
[http://www.lundman.net/ftp/llink/llink-2.3.1.tar.gz llink-2.3.1.tar.gz]


To detect that it is a PS3 that is talking to llink, and not a player that CAN handle ''.mkv'' files, we need to make some match rules. Usually, these operate on the ''User-Agent'' header in HTTP requests, or the ''SERVER:'' tag in UPNP's ''BrowseDirectChildren''.
If you want UPNP support, you also need to get clinkc-2.4 and clinkav-2.4. Until these are officially released, you can get them here:


To define where to find the transcode binary, I have been using ''ffmpeg'', but other programs could probably be used. In fact, one day one might be able to pass it to a "transcode -for ps3" program, wouldn't that be nice.
  [http://www.lundman.net/ftp/llink/clinkc-2.4.tar.gz clinkc-2.4.tar.gz]
  [http://www.lundman.net/ftp/llink/clinkcav-2.4.tar.gz clinkcav-2.4.tar.gz]


So, a '''TRANSCODE''' line might look something like:
If you are on a system where you can "make install", that is considerably easier and wont really need any extra ./configure magic. But if you can not install, and want to compile from the directories,
I would do something like:


  TRANSCODE|USERAGENT=*playstation*|ext=*.mkv|newext=.mpg|args=./ffmpeg -d -i "%s" -threads 4 -vbsf h264_mp4toannexb -f mpegts -acodec libmp3lame -ar 48000 -ab 64k -ac 2 -vcodec copy -async 2 -
  cd /your/compile/area/
tar -zxf clinkc-2.4.tar.gz
cd clinkc-2.4
./configure --enable-anyaddr
make
(make install - if you are root, or use the direct path in the following compiles)


In this case, we detect a PS3 if the ''User-Agent:'' tag contains "playstation" anywhere in it (case-insensitive).
cd /your/compile/area/
We only change files of ''.mkv'' type.
tar -zxf clinkcav-2.4.tar.gz
We will produce new files of ''.mpg'' type. (MIME type is then based on ''.mpg'' and becomes ''video/mpeg''.)
cd clinkcav-2.4
llink will execute
./configure CPPFLAGS=-I/your/compile/area/clinkc-2.4/include LDFLAGS=-L/your/compile/area/clinkc-2.4/lib/unix/ LIBS=""
make
(make install - if you want)
Here the CPPFLAGS and LDFLAGS are needed if you did not "make install". The LIBS="" part in the end will depend on your system. On OSX, I would use LIBS="-lexpat", on Linux LIBS="-lexpat -lpthread -luuid"


  '''./ffmpeg -d -i "http ://localhost:8001/path/to/video.mkv" -threads 4 -vbsf h264_mp4toannexb -f mpegts -acodec libmp3lame -ar 48000 -ab 64k -ac 2 -vcodec copy -async 2 -'''
  cd /your/compile/area/
tar -zxf llink-2.3.0.tar.gz
./configure --enable-clinkc --without-openssl CPPFLAGS="-I/your/compile/area/clinkc-2.4/include  -I/your/compile/area/clinkcav-2.4/include" LDFLAGS="-L/your/compile/area/clinkcav-2.4/lib/unix/.libs LIBS=""
make
Here the CPPFLAGS and LDFLAGS are needed if you did not "make install". The LIBS="" part in the end will depend on your system. On OSX, I would use LIBS="-lexpat", on Linux LIBS="-lexpat -lpthread -luuid"


The important parts here is '''-i "%s"''' would specify input file, in this case llink will replace '''%s''' with the actual URL to play. Note that ffmpeg appears to be very picky with argument order. Ie, specifying '''-i "%s"''' at the end will not work.


'''The final minus "-" is important. It tells ffmpeg to send the stream to stdout. Which is why you have to use ''-f mpegts'' to set the output format.''' Note that stderr would end up in the stream too, so with ffmpeg we use '''-d''' to make it completely silent.
<paypal></paypal>


If you wish to see what ''User-Agent:'' headers your device send, use


./llink -d -v 16
[skin] checking for matching transcoders to user-agent 'Platinum/0.5.3.0, DLNADOC/1.50'
[skin] matches '*latinum*' (ext '*.avi')


As far as transcoding goes, we do almost none. Video codec (h264) and audio of the ''.mkv'' file is copied without changing. We are just changing transport encapsulation from ''.mkv'' to ''mpeg-ts''. Very low CPU in this case.


Older sources:


To test your own transcoding argument, I would recommend running the command line yourself, like this:
[http://www.lundman.net/ftp/llink/llink-2.3.0.tar.gz llink-2.3.0.tar.gz]
[http://www.lundman.net/ftp/llink/llink-2.2.4.tar.gz llink-2.2.4.tar.gz]
[http://www.lundman.net/ftp/llink/llink-2.2.3.tar.gz llink-2.2.3.tar.gz]
[http://www.lundman.net/ftp/llink/llink-2.2.2.tar.gz llink-2.2.2.tar.gz]
[http://www.lundman.net/ftp/llink/llink-2.2.0.tar.gz llink-2.2.0.tar.gz]
[http://www.lundman.net/ftp/llink/llink-2.1.2.tar.gz llink-2.1.2.tar.gz]
[http://www.lundman.net/ftp/llink/llink-2.1.1.tar.gz llink-2.1.1.tar.gz]
[http://www.lundman.net/ftp/llink/llink-2.1.0.tar.gz llink-2.1.0.tar.gz]
[http://www.lundman.net/ftp/llink/llink-2.0.9.tar.gz llink-2.0.9.tar.gz]
[http://www.lundman.net/ftp/llink/llink-2.0.8.tar.gz llink-2.0.8.tar.gz]
[http://www.lundman.net/ftp/llink/llink-2.0.7.tar.gz llink-2.0.7.tar.gz]
[http://www.lundman.net/ftp/llink/llink-2.0.6.tar.gz llink-2.0.6.tar.gz]
[http://www.lundman.net/ftp/llink/llink-2.0.5.tar.gz llink-2.0.5.tar.gz]
[http://www.lundman.net/ftp/llink/llink-2.0.4.tar.gz llink-2.0.4.tar.gz]
[http://www.lundman.net/ftp/llink/llink-2.0.3.tar.gz llink-2.0.3.tar.gz]
[http://www.lundman.net/ftp/llink/llink-2.0.2.tar.gz llink-2.0.2.tar.gz]
[http://www.lundman.net/ftp/llink/llink-2.0.1.tar.gz llink-2.0.1.tar.gz]
[http://www.lundman.net/ftp/llink/llink-2.0.tar.gz llink-2.0.tar.gz]
[http://www.lundman.net/ftp/llink/llink-1.9.9.tar.gz llink-1.9.9.tar.gz]
[http://www.lundman.net/ftp/llink/llink-1.9.6.tar.gz llink-1.9.6.tar.gz]
[http://www.lundman.net/ftp/llink/llink-1.9.5.tar.gz llink-1.9.5.tar.gz]
[http://www.lundman.net/ftp/llink/llink-1.9.4.tar.gz llink-1.9.4.tar.gz]
[http://www.lundman.net/ftp/llink/llink-1.9.2.tar.gz llink-1.9.2.tar.gz]
[http://www.lundman.net/ftp/llink/llink-1.9.1.tar.gz llink-1.9.1.tar.gz]
[http://www.lundman.net/ftp/llink/llink-1.9.tar.gz llink-1.9.tar.gz]
[http://www.lundman.net/ftp/llink/llink-1.8.tar.gz llink-1.8.tar.gz]
[http://www.lundman.net/ftp/llink/llink-1.7.tar.gz llink-1.7.tar.gz]
[http://www.lundman.net/ftp/llink/llink-1.6.tar.gz llink-1.6.tar.gz]
[http://www.lundman.net/ftp/llink/llink-1.5.tar.gz llink-1.5.tar.gz]
[http://www.lundman.net/ftp/llink/llink-1.4.tar.gz llink-1.4.tar.gz]
[http://www.lundman.net/ftp/llink/llink-1.3.tar.gz llink-1.3.tar.gz]


./ffmpeg -i "http ://localhost:8001/path/to/video.mkv" -threads 4 -vbsf h264_mp4toannexb -f mpegts -acodec libmp3lame -ar 48000 -ab 64k -ac 2 -vcodec copy -async 2 - > test-encode.mpg


I removed the -d so you now get ''stderr'' output and can see any encoding errors. I keep the "-" to send to stream, and sent it to a file "> test-encode.mpg". This is to make sure you are using stream, and not doing formats that can not stream. (Like mp4).
Current testing sources:


Then simply test-play the file "test-encode.mpg" on your device to make sure it is ok.
[http://www.lundman.net/ftp/llink/llink-2.3.2.tar.gz llink-2.3.2.tar.gz]


In my tests, I am using:
CVS Version control


  ffmpeg version 0.8.4
  [[CVS]].
 
Below, insert any good transcoding options you might find.
 
=== Playstation 3 ===
 
Change MKV to MPG, appears to work for Scene standard tv.
TRANSCODE|USERAGENT=*playstation*|ext=*.mkv|newext=.mpg|args=./ffmpeg -d -i "%s" -threads 4 -vbsf h264_mp4toannexb -f mpegts -acodec libmp3lame -ar 48000 -ab 64k -ac 2 -vcodec copy -async 2 -
 
 
=== XBox 360 ===
 
 
=== Apple ipad ===
 
 
=== Apple ipad 2 ===
 
 
=== Apple iphone ===
 
 
=== Google Android ===
 
Tested with ''Softmedia Player Trial'' and ''Mirage''.
 
TRANSCODE|USERAGENT=*android*|ext=*.avi|newext=.mpg|args=./ffmpeg -d -i "%s" -acodec libmp3lame -ar 48000 -ab 128k -ac 2 -s 720x480 -vcodec libx264 -b 1200k -flags +loop+mv4 -cmp 256 -partitions +parti4x4+partp8x8+partb8x8 -subq 7 -trellis 1 -refs 3 -coder 0 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -bt 1200k -maxrate 1200k -bufsize 1200k -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 30 -aspect 16:9 -r 30 -g 90 -async 2 -f mpegts -
Almost works, plays fine for a while, but drops to 5 fps or so at times. Appears not to recover.
 
 
=== More here ===
 
EyeCon sends
User-Agent: Eyecon ControlPoint 2.0 | DMC/1.0
 
AcePlayer sends
Absolutely nothing :(
 
MLPlayer Lite
USER-AGENT: Darwin/11.0.0 UPnP/1.0 DLNADOC/1.50
 
PlugPlayer
USER-AGENT: iPad/4.3.2, UPnP/1.0, PlugPlayer/3.8.0
 
YXPlayer
User-Agent: Platinum/0.5.3.0, DLNADOC/1.50
 
Playstation 3
 
X-AV-Client-Info: av=5.0; cn="Sony Computer Entertainment Inc."; mn="PLAYSTATION 3"; mv="1.0";
User-Agent: UPnP/1.0 DLNADOC/1.50

Revision as of 00:40, 6 October 2011

Sources for llink

Latest sources are here:

llink-2.3.1.tar.gz 

If you want UPNP support, you also need to get clinkc-2.4 and clinkav-2.4. Until these are officially released, you can get them here:

 clinkc-2.4.tar.gz 
 clinkcav-2.4.tar.gz 

If you are on a system where you can "make install", that is considerably easier and wont really need any extra ./configure magic. But if you can not install, and want to compile from the directories, I would do something like:

cd /your/compile/area/
tar -zxf clinkc-2.4.tar.gz
cd clinkc-2.4
./configure --enable-anyaddr
make
(make install - if you are root, or use the direct path in the following compiles)
cd /your/compile/area/
tar -zxf clinkcav-2.4.tar.gz
cd clinkcav-2.4
./configure CPPFLAGS=-I/your/compile/area/clinkc-2.4/include LDFLAGS=-L/your/compile/area/clinkc-2.4/lib/unix/ LIBS=""
make
(make install - if you want)

Here the CPPFLAGS and LDFLAGS are needed if you did not "make install". The LIBS="" part in the end will depend on your system. On OSX, I would use LIBS="-lexpat", on Linux LIBS="-lexpat -lpthread -luuid"

cd /your/compile/area/
tar -zxf llink-2.3.0.tar.gz
./configure --enable-clinkc --without-openssl CPPFLAGS="-I/your/compile/area/clinkc-2.4/include  -I/your/compile/area/clinkcav-2.4/include" LDFLAGS="-L/your/compile/area/clinkcav-2.4/lib/unix/.libs LIBS=""
make

Here the CPPFLAGS and LDFLAGS are needed if you did not "make install". The LIBS="" part in the end will depend on your system. On OSX, I would use LIBS="-lexpat", on Linux LIBS="-lexpat -lpthread -luuid"


<paypal></paypal>



Older sources:

llink-2.3.0.tar.gz 
llink-2.2.4.tar.gz 
llink-2.2.3.tar.gz 
llink-2.2.2.tar.gz 
llink-2.2.0.tar.gz 
llink-2.1.2.tar.gz 
llink-2.1.1.tar.gz 
llink-2.1.0.tar.gz 
llink-2.0.9.tar.gz 
llink-2.0.8.tar.gz 
llink-2.0.7.tar.gz 
llink-2.0.6.tar.gz 
llink-2.0.5.tar.gz 
llink-2.0.4.tar.gz 
llink-2.0.3.tar.gz 
llink-2.0.2.tar.gz 
llink-2.0.1.tar.gz 
llink-2.0.tar.gz 
llink-1.9.9.tar.gz 
llink-1.9.6.tar.gz
llink-1.9.5.tar.gz
llink-1.9.4.tar.gz
llink-1.9.2.tar.gz
llink-1.9.1.tar.gz
llink-1.9.tar.gz
llink-1.8.tar.gz
llink-1.7.tar.gz
llink-1.6.tar.gz
llink-1.5.tar.gz
llink-1.4.tar.gz
llink-1.3.tar.gz


Current testing sources:

llink-2.3.2.tar.gz 

CVS Version control

CVS.