| View previous topic :: View next topic |
| Author |
Message |
Khannie
Joined: 25 Apr 2006 Posts: 27 Location: Dublin, Ireland
|
Posted: Wed Dec 13, 2006 11:13 pm Post subject: PMP AVC Mencoder for linux |
|
|
I altered mencoder / x264 (groundwork done by Jonny and Magik, thanks lads) to create PMP compliant AVC files. I made a statically linked binary, so it should work on any i386 based linux install without the need for codec installs, etc.
Edit: You should NOT replace your installed version of mencoder with this one, though 99.9% of the code is just the SVN code. :)
This is basically a hack that I put together myself because I was having sound synch issues and this fixes them. But because I mostly made it for myself, the scale filter is used to determine the width and height to write to the input file for pmp_muxer_avc.pl (I will fix it up over the coming while, but my main focus for now is on looking at adding ogg vorbis support to PMP Mod AVC). My encode script is below. You should use a similar methodology (i.e. encode with sound, extact video, extract audio, pmp mux them).
| Code: |
#usage <scriptname> inputfile outputfile
BITRATE=450
###########generated muxed video / sound##########
~/install/mencoder_psp/install/mencoder "$1" -vf scale=480:272 -ovc x264 -x264encopts bitrate=$BITRATE:pass=1:turbo=1:threads=2 -srate 44100 -oac mp3lame -lameopts vol=0:mode=0:cbr:br=128 -o /dev/null
~/install/mencoder_psp/install/mencoder "$1" -vf scale=480:272 -ovc x264 -x264encopts bitrate=$BITRATE:pass=2 -srate 44100 -oac mp3lame -lameopts vol=0:mode=0:cbr:br=128 -o "$2".temp
###########rename x264 file##########
mv x264file.txt "$2".264.txt
###########copy video out##########
~/install/mencoder_psp/install/mencoder "$2".temp -ovc copy -nosound -o "$2".264
###########copy sound out##########
~/install/mencoder_psp/install/mencoder "$2".temp -srate 44100 -oac copy -ovc copy -of rawaudio -o "$2".mp3
##########generate pmp file##########
~/install/pmpmux/pmp_muxer_avc.pl -v "$2".264 -a "$2".mp3 -o "$2".pmp -w 480 -h 272
#clean up:
if [ -f "$2".pmp ]
then
echo "Found PMP. Cleaning up temp files."
rm "$2".264.txt "$2".264 "$2".mp3 "$2".temp
exit 0
fi
echo "**********************************************"
echo "PMP file wasn't found. Temp files not deleted."
echo "**********************************************"
|
I have tested on ubuntu 6.06 and RHEL 4.
You can download version 0.0.1 here.
I'll make the source code available at some point over the next few days for those that wish to compile in their own codec support, etc.
One request: If anyone uses this, could they let me know by replying to this thread; It will determine whether or not I bother making updates publicly available. |
|
| Back to top |
|
 |
jockyw2001
Joined: 29 Sep 2005 Posts: 339
|
Posted: Thu Dec 14, 2006 12:16 am Post subject: |
|
|
| Khannie: did you use the current version of x264? If it is the same version as used in the new VLC 0.8.6 then it may save me some time to patch that for PMP VLC. I would be grateful if I can use your x264 diff files :) |
|
| Back to top |
|
 |
Khannie
Joined: 25 Apr 2006 Posts: 27 Location: Dublin, Ireland
|
Posted: Thu Dec 14, 2006 10:37 am Post subject: |
|
|
| Yeah, I used the svn version of x264. You're more than welcome to my source files / diff. I'll send you off a link tomorrow (bit late now) :). |
|
| Back to top |
|
 |
jockyw2001
Joined: 29 Sep 2005 Posts: 339
|
Posted: Thu Dec 14, 2006 9:29 pm Post subject: |
|
|
Wonderful !
Thx and take your time :) |
|
| Back to top |
|
 |
Khannie
Joined: 25 Apr 2006 Posts: 27 Location: Dublin, Ireland
|
Posted: Wed Dec 20, 2006 1:44 am Post subject: |
|
|
For what it's worth, I've done > 50 encodes with this now, all of which have been in sound synch, so it seems solid enough.
jockyw2001: I haven't forgotten to post the source....It's just been a bit mental lately in the run up to Christmas (also did an OS wipe the other day so I'm still getting up and running.). I have a decent break coming my way over the festive season so I'll get the source up and some changes made to clean things up.
I might try and clean things up (so as not to interfere with the original encode options) and add the changes to the x264 svn so that PSP AVC would be an encoding option with the svn version of mencoder (for example).
I'm also looking at adding ogg support to PMP Mod AVC, though I may have bitten off more than I have time for, I'll at least give it a stab. |
|
| Back to top |
|
 |
foo
Joined: 25 Sep 2006 Posts: 7
|
Posted: Mon Jan 07, 2008 3:34 pm Post subject: |
|
|
So did you ever get around to releasing the sources? If so, can you post a link to them? :)
Off topic, but does anyone have perl sources for the cooleyes' latest pmp muxer avc (20070606 apparently)? I can only find windows binaries of it :( |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Tue Jan 08, 2008 4:16 am Post subject: |
|
|
| foo wrote: | So did you ever get around to releasing the sources? If so, can you post a link to them? :)
Off topic, but does anyone have perl sources for the cooleyes' latest pmp muxer avc (20070606 apparently)? I can only find windows binaries of it :( |
In the main pmp muxer thread (toward the end), there is a long discussion about adding aac support to pmp, and all new muxers posted to add said support. Use the source for that. |
|
| Back to top |
|
 |
Matrixdub
Joined: 13 May 2005 Posts: 60
|
Posted: Tue Jan 08, 2008 7:23 am Post subject: |
|
|
| J.F. wrote: | | foo wrote: | So did you ever get around to releasing the sources? If so, can you post a link to them? :)
Off topic, but does anyone have perl sources for the cooleyes' latest pmp muxer avc (20070606 apparently)? I can only find windows binaries of it :( |
In the main pmp muxer thread (toward the end), there is a long discussion about adding aac support to pmp, and all new muxers posted to add said support. Use the source for that. |
I also read here that native hardware XviD decoding was being added to this project, but I haven't seen anything materialise, have I simply missed the update? |
|
| Back to top |
|
 |
foo
Joined: 25 Sep 2006 Posts: 7
|
Posted: Tue Jan 08, 2008 2:16 pm Post subject: |
|
|
| J.F. wrote: |
In the main pmp muxer thread (toward the end), there is a long discussion about adding aac support to pmp, and all new muxers posted to add said support. Use the source for that. |
Yeah, I already have a aac capable muxer, but the 20070606 release apparently added support for 48khz audio track which I'd like to use, but cooleyes only posted windows binaries of it on cngba... |
|
| Back to top |
|
 |
cooleyes
Joined: 18 May 2006 Posts: 125
|
|
| Back to top |
|
 |
foo
Joined: 25 Sep 2006 Posts: 7
|
Posted: Tue Jan 08, 2008 6:40 pm Post subject: |
|
|
| Ah great, thanks! |
|
| Back to top |
|
 |
Khannie
Joined: 25 Apr 2006 Posts: 27 Location: Dublin, Ireland
|
Posted: Sat Feb 02, 2008 12:37 am Post subject: |
|
|
| foo wrote: | | So did you ever get around to releasing the sources? If so, can you post a link to them? :) |
Humble apologies, but I got lazy. :) I actually rediscovered this thread after looking for an alternative mencoder that uses updated x264 libraries myself. I'll definitely get my finger out and release the sources, but they're horribly out of date now. My plan is to hack the same changes into the current x264 svn and use them as the threading support is far far better. |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Sat Feb 02, 2008 4:32 am Post subject: |
|
|
| Khannie wrote: | | foo wrote: | | So did you ever get around to releasing the sources? If so, can you post a link to them? :) |
Humble apologies, but I got lazy. :) I actually rediscovered this thread after looking for an alternative mencoder that uses updated x264 libraries myself. I'll definitely get my finger out and release the sources, but they're horribly out of date now. My plan is to hack the same changes into the current x264 svn and use them as the threading support is far far better. |
That would be cool. Looking forward to it. :) |
|
| Back to top |
|
 |
Khannie
Joined: 25 Apr 2006 Posts: 27 Location: Dublin, Ireland
|
Posted: Sun Feb 03, 2008 7:14 am Post subject: |
|
|
Hmmmm. Upon further reflection, the enhanced threading support in the newer x264 library would have no effect because using threading in the actual video encoding causes the resulting pmp to be unplayable (I remembered this from a conversation with Jonny and have been testing it out a bit myself this evening). I'm open to being corrected on this of course and would be happy to.
BUT....all is not lost. You can still avail of the improved x264 threading performance in the first pass of a 2 pass encode. I've altered my own conversion scripts quite a bit, and I regularly get 200fps in the first pass without turbo mode (turbo mode + threading doesn't seem to make any difference to me).
For what it's worth: I'm running gentoo. Latest x264 snapshot that the the OS installed mencoder is linked to was taken at 2007-09-24. I have a q6600 running at 2.7GHz.
My base conversion script looks like this:
| Code: |
BITRATE=650
TEMPDIR=/tmp
FILENAME=`echo $2 | cut -d/ -f6`
###########generated muxed video / sound##########
/usr/bin/mencoder "$1" -vf scale=480:272,harddup -ovc x264 -x264encopts bitrate=$BITRATE:pass=1:threads=5 -oac copy -o /dev/null
~/install/mencoder_psp/install/mencoder "$1" -vf scale=480:272,harddup -ovc x264 -x264encopts bitrate=$BITRATE:pass=2 -srate 44100 -oac mp3lame -lameopts mode=0:abr:br=128 -o "$2".temp
###########copy video out##########
~/install/mencoder_psp/install/mencoder "$2".temp -ovc copy -quiet -nosound -o $TEMPDIR/"$FILENAME".264
###########copy sound out##########
~/install/mencoder_psp/install/mencoder "$2".temp -quiet -srate 44100 -oac copy -ovc copy -of rawaudio -o $TEMPDIR/"$FILENAME".mp3
###########rename x264 file##########
mv x264file.txt $TEMPDIR/"$FILENAME".264.txt
##########generate pmp file##########
~/install/pmpmux/pmp_muxer_avc.pl -v $TEMPDIR/"$FILENAME".264 -a $TEMPDIR/"$FILENAME".mp3 -o "$2".pmp -w 480 -h 272
#clean up:
if [ -f "$2".pmp ]
then
echo "Found PMP. Cleaning up temp files."
rm $TEMPDIR/"$FILENAME".264.txt $TEMPDIR/"$FILENAME".264 $TEMPDIR/"$FILENAME".mp3 "$2".temp
exit 0
fi
echo "**********************************************"
echo "PMP file wasn't found. Temp files not deleted."
echo "**********************************************"
|
There is obviously quite a bit of custom stuff in there (I use /tmp for reading to the muxer because it's on a fast SSD), but the general jist should help people get faster 2 pass encodes. The first mencoder line is where the real performance improvement kicks in (i.e. using (num cores + 1) threads with the OS installed mencoder + recent x264 library).
If anyone needs help getting their own script working, shout and I'll try to help out. |
|
| Back to top |
|
 |
|