View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 10 posts ] 
Print view Previous topic   Next topic  
Author Message
Search for:
 Post subject: H.264 MPlayer HOWTO
PostPosted: Fri Sep 16, 2005 6:07 am 
BIG FAT DISCLAIMER!

CAUTION! THIS KNOPPMYTH H.264 MPLAYER HOWTO IS A FIRST DRAFT! I JUST GOT THIS TO WORK AND HERE IS WHAT I DID (I THINK).

THESE INSTRUCTIONS ARE *DRAFT* AND SUBJECT TO REVISION! IF YOU USE THEM AND YOUR COMPUTER EXPLODES DON'T BLAME ME!

YMMV!



1. update MPlayer using Graysky's instructions but substitute the MPlayer instructions for building from cvs.

http://www.mplayerhq.hu/homepage/design7/dload.html

http://mysettopbox.tv/phpBB2/viewtopic. ... 6564#26564

Graysky's instructions worked great (with the modification for cvs MPlayer). Thanks!
(note, using cvs MPlayer is mandatory if you want H.264)


2. Turn off the KnoppMyth installed MPlayer with this crude hack and use the newly installed MPlayer and MEncoder instead

#cd /usr/bin
#mv mplayer mplayer.bak
#ln -s /usr/local/bin/mplayer mplayer

then you also need to do the same hack to mencoder that you did to mplayer

#cd /usr/bin
#mv mencoder mencoder.bak
#ln -s /usr/local/bin/mencoder mencoder


3. Update your apt databases (this gets a bit scary as it updates "locales") and install subversion. Caution, using apt-get can potentially hose your system. Use caution and make a backup before proceeding.

#apt-get update
#apt-get install subversion


4. Next, to add in H.264 follow the instructions in paragraph "2.2.1.10.4. How can I encode videos using MEncoder and x264?" from

http://www.mplayerhq.hu/DOCS/HTML/en/codecs.html

Quote:


2.2.1.10.4. How can I encode videos using MEncoder and x264?
If you have the subversion client installed, the latest x264 sources can be gotten with this command:

svn co svn://svn.videolan.org/x264/trunk x264

MPlayer sources are updated whenever an x264 API change occurs, so it is always suggested to use CVS MPlayer as well. Perhaps this situation will change when and if an x264 "release" occurs. Meanwhile, x264 should be considered very unstable, in the sense that its programming interface is subject to change.

x264 is built and installed in the standard way: [ed note: cd to the x264 directory, presumably in /root/x264]

./configure && make && sudo make install

This installs libx264.a in /usr/local/lib and x264.h is placed in /usr/local/include. With the x264 library and header placed in the standard locations, building MPlayer with x264 support is easy. Just run the standard: [ed note: cd to the cvs MPlayer directory, presumably in /root/main]

./configure && make && sudo make install

The configure script will autodetect that you have satisfied the requirements for x264.




5. To do the transcoding, you need a script with the proper commands for MEncoder.

Quote:

# cat /usr/local/bin/mpg2avc


for file in $*
do
mencoder -ovc x264 -x264encopts pass=1 -nosound -o $file.x264.avi $file
mencoder -ovc x264 -x264encopts bitrate=2200:pass=2 -oac copy -o $file.x264.avi $file
done



Here is another script to transcode but using the xvid codec

Quote:
#cat /usr/local/bin/mpg2avi

for file in $*
do
mencoder -ovc xvid -xvidencopts pass=1 -nosound -o $file.avi $file
mencoder -ovc xvid -xvidencopts bitrate=2200:pass=2 -oac mp3lame -lameopts preset=medium -o $file.avi $file
done




The scripts pretty much work. Please note they are hardcoded to 2200 kbps.

Thats it. Follow these instructions and you can play H.264 and even transcode your video to H.264

POST INSTALL NOTES

to test the decoder but I did sort of a test by doing this... (/dev/video1 is a hauppauge PVR-250)

#cat /dev/video1 >test.mpg

#mpg2avi test.mpg

#mpg2avc test.mpg

to be honest, the H.264 quality is watchable but is not as good as the xvid at first review.

I suspect that I'd need to tweak this a bit to make better quality video.

I did try to download some samples like the WMV HD Serenity video and Robotica from MS but they either did play correctly. Serenity played corrupted (like it has DRM encryption) and the Robotica didn't play at all.

I tried transcoding with a nova.mpg recorded off the HD-3000 in SDTV format (704x480 MPEG-2 TS) and of course the xvid transcodes fine and the x264 transcodes fine as well (its not finished yet). The transcoded files appear to have identical video quality to the original nova.mpg. There is one big difference though and that is the time to encode. Xvid is near realtime even in the 2 pass configuration transcode but the x264 is W A A A A Y slow. That is to be expected since its so early and it is advertised as processor intensive encoding.

I can't post file sizes yet. I also ran into another problem and that is since Nova.mpg is a PBS SDTV digital broadcast for some reason the audio is not on the default track. Using the MythTV internal viewer I have to press '-' to get the audio to play. Of course when the file is transcoded the audio disappears entirely and I can't get it to appear at all. I can see the video though.

I have changed course and am now going to try this transcoding again with a LOST episode from Wednesday. It was recorded in HDTV and is 13 GB long. I suspect the transcode on that file will take for ever so I will post you when its done.

One thing that would really help me out would be some "reference" or sample H.264 videos posted somewhere. Not the movie trailers like Serenity, although it is H.264 encoded it requires a license from NBC to run so the file is likely encrypted and when you play it you get garbage.

I really need some objective independent H.264 sample to test out the H.264 capabilities of the MPlayer. If you have some or know where some are please post a link because I cannot find any I can get to work.



THANKS!

Andrew Lynch


Top
  
 
 Post subject:
PostPosted: Fri Sep 16, 2005 7:29 pm 
I have been converting some videos and things are going alright. The x264 codec has a limitation on encoding only videos with resolutions that are both horizontal and vertical multiples of 16 pixel resolutions. In other words, if you try to encode an HD capture at 1920x1080 it will fail due to the vertical resolution is not an even multiple of 16.

It works great for regular SDTV recordings though at 720x480 with pretty decent results. There is an improved quality setting as well I will be experimenting with.

The bad news is my x264 transcode of Lost did not work due to the resolution /16 issue. The xvid transcode did work OK though but the original source had some corruption which limited its usefulness.

Thats all for now. Good luck using H.264

Andrew Lynch


Top
  
 
 Post subject:
PostPosted: Sat Sep 17, 2005 7:28 am 
Well, hopefully making some progress here. I finally got a HD recording that the x264 codec would recognize. Its a Seinfeld recorded at 1280x720. it is transcoding now and hopefully it will show what the H.264 encoding is capable of.

One cool thing I found yesterday was that the Apple Quicktime *.mov files play natively using MPlayer, including the HiDef version of the Serenity trailer. Unfortunately the video lags the audio by seconds or at least a whole bunch. I will try again later but I think full blown HiDef play back of 1920X1080 may be pushing the envelope for MPlayer.

Thanks!

Andrew Lynch


Top
  
 
 Post subject:
PostPosted: Sat Sep 17, 2005 8:25 am 
Offline
Joined: Fri Apr 02, 2004 10:08 am
Posts: 1637
Location: Virginia, USA
Just FYI, I have a dual 2.5 GHz G5 at work, and it can't even play back the 1080p Serenity trailer at full speed. The audio and video are in sync but it's playing at more like 20 fps rather than 24.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 17, 2005 11:20 am 
OK, maybe the full HiDef Serenity trailer is a bit much. I can play it and the video looks beautiful but the audio lags so much its silly. Its off by at least several seconds just a little bit into the trailer.

I am running a 3.2 GHz Pentium 4 and an NVidia GF4 MX4000 so I'd think it has enough throughput to handle it but apparently not.

I did some experimenting with enabling MPlayer with XvMC and that works great for MPEG2 files but refuses to play anything else (like xvid or x264).

I take it that XvMC enabled MPlayer is not going to help playback of a H.264 file, right?

Is XvMC restricted to ONLY MPEG1 and MPEG2 playback? I think so but if someone would confirm, I'd appreciate it. Looking over the "man mplayer" pages seem to indicate only MPEG1, MPEG2, and VCR2 format are accelerated. Bummer!

Is there anyone else here experimenting with H.264 on their MythTV PVRs so we could compare some notes? There is very little on the forum.

Thanks!

Andrew Lynch


Top
  
 
 Post subject:
PostPosted: Sat Sep 17, 2005 11:36 am 
ceenvee703 wrote:
Just FYI, I have a dual 2.5 GHz G5 at work, and it can't even play back the 1080p Serenity trailer at full speed. The audio and video are in sync but it's playing at more like 20 fps rather than 24.


Are you running MacOS or PPC linux or ??? Are you using the Apple Quicktime 7 video player or some other? With dual PPCs, you should be blowing through practically anything like it wasn't there. Is there something wrong with the Serenity 1080p video?

Andrew Lynch


Top
  
 
 Post subject:
PostPosted: Sat Sep 17, 2005 12:29 pm 
Offline
Joined: Fri Apr 02, 2004 10:08 am
Posts: 1637
Location: Virginia, USA
OS X 10.4, 4 GB RAM, played off a RAID. It might not be the top-of-the-line video card, though; that's the only thing I can think of. And like I said, it's almost playing it back OK; everything's in sync, just dropping frames at times.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 17, 2005 1:00 pm 
Well, based on the experiments I have run, the x264 implementation of H.264 is definitely not ready for prime time yet. The developers have done a great job but it still has a long ways to go before it gives xvid any serious competition.

For the same bit rate, it creates larger files with no noticeable improvement in image quality. Transcodes take a V E R Y long time and it is generally very "sensitive" about what parameters are passed to it and what files it will encode into H.264.

Of course, they clearly warned the codec was in early development so please don't take these comments as criticisms, just that they are not ready yet as they clearly stated on their web page.

Its been fun and my curiousity is satisfied. Unless someone else comes up with some better reasons and/or solutions to push ahead with x264 I recommend giving them another year or two to smooth out the kinks in this codec.

MPEG4-part 10 AVC is the way of the future but it looks like its going to be a while before it gets here.

Thanks!

Andrew Lynch

PS, I am able to get the 1280x720p Serenity HiDef trailer to run smoothly so I suspect the 1920x1080p version is just beyond my machines capability. Hopefully with some time and improvements in the H.264 codecs, I eventually will be able to play the full HiDef version.


Top
  
 
 Post subject:
PostPosted: Sat Sep 17, 2005 5:48 pm 
ceenvee703 wrote:
OS X 10.4, 4 GB RAM, played off a RAID. It might not be the top-of-the-line video card, though; that's the only thing I can think of. And like I said, it's almost playing it back OK; everything's in sync, just dropping frames at times.


I went for a jog thinking about this and came up with an idea... transcode the H.264 file into a high bitrate xvid and see if that works. So I modified a script for a 16000 kbps xvid 2 pass transcode of the Serenity Hi Def trailer. The size of the file doubled but the playback was smooth and video and audio quality were simply awesome.

If there was any loss due to the transcode, I couldn't see it.

Serenity is going to rule. I cannot wait!

Andrew Lynch

PS, there may be some more utility in x264 than I have given it credit for. Even if it were only useful for transcoding in and out of the H.264 format, it would still give KnoppMyth users access to the format but not in a realtime display. Being able to translate in and out of H.264 certainly makes playing HiDef movie trailers a lot easier... I expect that the success of the apple HiDef trailers is going to make H.264 a lot more common in the upcoming months.


Top
  
 
 Post subject:
PostPosted: Thu Oct 13, 2005 8:47 am 
There have been a lot of improvements into the x264 svn to include the fix to support non mod16 resolutions. I have posted a script inthe HDTV > H.264 thread that works around the lack of interlaced video support.

So people, set up your H.264 Mplayer systems and start testing with MythTV!

Andrew Lynch


Top
  
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 


All times are UTC - 6 hours




Who is online

Users browsing this forum: No registered users and 16 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu