View Full Version : h264enc for Linux
Pages :
1
2
3
4
5
6
7
[
8]
9
10
11
12
13
14
15
microchip8
12th September 2009, 13:28
ChangeLog for version 9.0.4
* Use only lowercase words in all case statements that deal with the input source
* Some small improvements to the exit info in the audio code
* Placed the -passlogfile option inside the PASSLOG variable
* Set psy_rd to 0.3 for the Anime presets
* Allow setting the H.264 level for the PC presets to "auto" so libx264 will decide itself which level to use based on options and resolution used
* Added support for 2-pass Nero AAC audio encoding. Note that 2-pass is only supported by ABR/CBR encoding and ensures that the
output quality is constant (like VBR) while also ensuring that a specified output bitrate is achieved (like CBR). Requested by punlo on doom9.org
PS: most of the openSUSE infrastructure/servers are down due to maintenance over the weekend in Nuerenberg. This also includes the build service servers so I can't package stuff right now and will be only able to do it on Monday when it comes back up. So those who get stuff from my repos will not be able to get latest h264enc from there right now so just use sourceforge or cli-apps.org :)
microchip8
16th September 2009, 17:16
ChangeLog for version 9.0.5
* Small bugfix: setting the H.264 level for the fghq preset wasn't possible
* Small bugfix: the counter in set_output_filename_func() didn't increase itself
* Added SOURCE, VIDEO_FILTERS, AUDIO_FILTERS_TRACK[1|2|3], ENCODER and X264_PARAMETERS entries to the mkvtags_func() function
microchip8
24th September 2009, 14:18
ChangeLog for version 9.0.6
* MP3 (MPEG1 Layer 3) only supports sample frequencies of 32, 44.1 and 48 kHz so restrict to those only in the audio_resample_func() function
* Set default for the pp7 deblocker to 3
* Fixed example typo in the DVD chapters code
* Insert the ilpack filter before the scaler to correctly align chroma channels when preserving interlacing
* Added AUDIO_CODEC_TRACK[1|2|3], AUDIO_LANGUAGE_TRACK[1|2|3] and H264ENC_PARAMETERS entries to the mkvtags_func() function
* Enabled adaptive transform for the AppleTV HQ preset (atvhq)
* Improved checking the availability of block devices
* Added option 'global_header' to the preset.cfg file
blaz
12th October 2009, 14:14
Doing some encoding with the newer versions of your software (9.0.1).
Got this error (after removing the null dump):
MPlayer dev-SVN-r29652 (C) 2000-2007 MPlayer TeamOption x264encopts:
Unknown suboption mbtree
But my x264 lib was 1:0.svn20090928-0.0 (mplayer/mencoder, libx264-76 and h264enc all come from Christian Marillat's debian Multimedia repository http://www.debian-multimedia.org) so it should support mbtree.
I contacted Christian, and he says that according to the x264 git tree changelog, mbtree is on by default. The only option is --no-mbtree.
So I manually removed the mbtree option from the command and it works, presumably using mbtrees?
As I haven't seen this changed in your more recent versions than mine (9.0.1), thought I'd mention it.
microchip8
12th October 2009, 14:39
Doing some encoding with the newer versions of your software (9.0.1).
Got this error (after removing the null dump):
MPlayer dev-SVN-r29652 (C) 2000-2007 MPlayer TeamOption x264encopts:
Unknown suboption mbtree
But my x264 lib was 1:0.svn20090928-0.0 (mplayer/mencoder, libx264-76 and h264enc all come from Christian Marillat's debian Multimedia repository http://www.debian-multimedia.org) so it should support mbtree.
I contacted Christian, and he says that according to the x264 git tree changelog, mbtree is on by default. The only option is --no-mbtree.
So I manually removed the mbtree option from the command and it works, presumably using mbtrees?
As I haven't seen this changed in your more recent versions than mine (9.0.1), thought I'd mention it.
Obviously, your mencoder is linked against an libx264 which does not have the mbtree option. Yes, mbtree is on by default so you may think it's redundant that I add it to the presets, but I have ~60 of them and for me it's easier to see which options a preset uses and which it doesn't and thus it's easier for me to control them (for some I disable mbtree for others I enable it)
I've never had a problem by adding mbtree to mencoder, ever since it got introduced into x264, so this must be something on your side
check to see to which libx264 mencoder is linked:
ldd /path/to/mencoder | grep x264
also version 9.0.1 isn't the newest, it's 9.0.6 ;)
blaz
12th October 2009, 16:17
hmmm, right you are.
Christian's mencoder for debian/testing is linked against a specific but older x264 lib. So even though my system's /usr/lib/libx264.so points to the correct newer version, that's ignored.
But his debian/unstable version does point to the newer lib and works fine. I guess these programs are so sensitive to the component lib versions that they specify them precisely.
Thanks for "pointing" me in the right direction.
microchip8
12th October 2009, 16:25
That's one of the reasons why I don't recommend depending on packaged mencoder/x264/etc when using h264enc, since my script follows very closely the development of these programs so when something is changed (options, filters, etc) I usually update it pretty fast to support the changes which can result in mencoder exiting with bad status, though if one wants to depend on packaged versions, then older versions of h264enc may work. Personally, I always compile myself mplayer/x264 and xvid and never use the packaged versions of my distro
blaz
12th October 2009, 16:33
since my script follows very closely the development of these programs so when something is changed (options, filters, etc) I usually update it pretty fast to support the changes
Yes, I noticed!
But this is a good thing, and I'll just have to be more careful next time.
microchip8
12th October 2009, 16:39
Yes, I noticed!
But this is a good thing, and I'll just have to be more careful next time.
Follow the ChangeLog closely. I always mention in there if one will need latest (or specific version) of these programs when I change/add something to the script
blaz
16th October 2009, 13:08
arrrgh. Getting an odd mbtree error right at the end of 2nd pass of full dvd encode:
x264 [error]: Incomplete MB-tree stats file
and mencoder hangs. This doesn't happen with just a chapter though.
Googled it and found a guy on handbrake irc with exact same problem/symptoms, and others. So for now am thinking of just dropping mbtree until this gets sorted out in a later version of x264.
I'm already editing your batchfile (adding -spualign, that would be a nice option to your script by the way), so think I'll try changing --mbtree to --no-mbtree?
microchip8
16th October 2009, 13:15
I haven't experienced any problems with mbtree, but then again I encode in CRF mode and don't do often 2-pass encodings. If it gives problems, just change mbtree to nombtree in the batch file and encode from there. This is also why I recommend people *always* save their settings to the batch file, in case a problem occurs (like bug in mencoder/x264 in some option, unexpected power loss, debugging purposes since I always ask to see the batchfile when one has a problem, etc). As for spualign, I'll add it in the next release
blaz
16th October 2009, 13:25
Hey, thanks!
Maybe I'll go back and try 1 pass again with mbtree, but I was having some jerkiness problems before ...
microchip8
16th October 2009, 13:32
Hey, thanks!
Maybe I'll go back and try 1 pass again with mbtree, but I was having some jerkiness problems before ...
No problems here. I sometimes find that SMPlayer itself creates jurkiness as strange as it may sound. Playing the same files, once with SMPlayer and once with MPlayer from console or using its native GUI, the latter always results in smooth playback while SMPlayer too often introduces jurkiness. I suspect it has something to do with the options it passes to MPlayer and looking at them, it really passes a lot of options just for a "normal" simple playback. I haven't investigated the problem closely so can't say much about what causes it
btw, if you disable mbtree, you might want to enable b_pyramid ;)
Also, may I ask why you use spualign? Are you hardsubbing or something?
blaz
16th October 2009, 13:41
Yes, I'm burning the subtitles in to send to the PS3.
I find the default spualign puts the subtitles too high up in the frame, too distracting, so I force them to the bottom.
And for 2.35:1 films, I enlarge the crop area a bit so there's a black band at the bottom for one line of the subtitles.
microchip8
16th October 2009, 13:47
Alright then. spualign will be present in next version ;)
microchip8
17th October 2009, 12:07
ChangeLog for version 9.0.7
* Added new function video_subtitles_align_func() for subtitle alignment control.
Requested by blaz on doom9.org forum.
* Added new x264 option 'constrained_intra' to the preset.cfg file.
* Added detection of VFR content (1000 fps as reported by MPlayer).
* Added X264_VERSION and MKVMERGE_VERSION entries to the mkvtags_func() function.
* Simplified a bit the audio exporting code for the first track.
blaz
18th October 2009, 16:29
Thanks, that works well. I also got 1-pass working without the jerkiness, and 1-pass seems to have solved my mbtree problem.
But I just realized that your script doesn't use the -e option with bash's read function.
That makes editing long pathnames quite painful.
microchip8
18th October 2009, 16:33
Thanks, that works well. I also got 1-pass working without the jerkiness, and 1-pass seems to have solved my mbtree problem.
But I just realized that your script doesn't use the -e option with bash's read function.
That makes editing long pathnames quite painful.
of course it does, read -e variable
and I use it all the time when I need to specify a path. /h<TAB>/n<TAB>/fil</TAB> and it completes it for me to /home/neutrino/filename
blaz
18th October 2009, 16:51
oh, I see.
You don't use -e when reading some short entries like "dvd" or "iso", and when my arrow keys didn't work there, I assumed they didn't work elsewhere.
But they do, and that's great especially with the tab/completion feature with long paths/filenames.
Sorry, false alarm.
microchip8
18th October 2009, 16:55
No, I use path completion only for when one needs to provide some file or set the path for something, this includes setting the path to DVD devices/ISOs and VIDEO_TS dirs, external subtitle paths, cover image paths, saving the batch file, etc . For stuff where you only need to answer with y or n or provide some menu value number, I don't use -e. It's pointless there
microchip8
19th October 2009, 14:15
ChangeLog for version 9.0.8
* Force stereo audio for Nero HE-AACv2 as it doesn't support anything else, thus it results in failure
if user tries to encode with more than two channels. This updates the audio_channels_func() function and
also adds a small new independent one called neroaac_hev2_func() which only sets the channels to two if the
channels array variables are empty, as is the case when the user did not set the channels
* Small improvements to the ABR/VBR default audio bitrates for the neroAacEnc encoder. Base the default bitrates
on the chosen AAC profile, i.e. if user chooses HE-AACv1, default bitrate will be 55 kbps or in case of quality-based
VBR encoding a value of 0.22. For LC-AAC and HE-AACv2, default bitrates and quality values will be 96 kbps or 0.35
and 25 kbps or 0.11, respectively. Note that this assumes the input audio is stereo so if it's anything else than that,
it's up to the user to decide on bitrates or quality values
* Set default to a capital letter in questions where one needs to answer with y or n
* Update to all presets: updated the b_pyramid option to use the new args none/strict/normal present in latest x264 revision.
Note that this requires both latest MPlayer from SVN and latest x264 revision from git
* Small b_pyramid update to the preset.cfg file
WalterK
20th October 2009, 17:24
Congrats froggy1 i see all three scripts have made it into 9.10 karmic koala's multiverse/universe repos with a maintainer
Although i wonder how is that working since the mencoder and x264 versions are a bit old although not as old as before.
microchip8
20th October 2009, 17:29
Congrats froggy1 i see all three scripts have made it into 9.10 karmic koala's multiverse/universe repos with a maintainer
Although i wonder how is that working since the mencoder and x264 versions are a bit old although not as old as before.
Yeah, they've been for some time in Ubuntu. I believe Alessio maintains those packages. As for the mplayer/x264 issues, it's not only Ubuntu that's "struggling" a bit. Also over at Arch Linux they have a similar situation, check the comments http://aur.archlinux.org/packages.php?do_Details&ID=12121
Henrikx
21st October 2009, 09:40
Although i wonder how is that working since the mencoder and x264 versions are a bit old although not as old as before.
Mplayer (https://launchpad.net/~rvm/+archive/testing)
The version is by rvm, author of SMPlayer.
You know how to compile x264/ffmpeg?
ggking7
26th October 2009, 21:02
Can h264enc create an image that can be burned to DVD so that the DVD can be played on regular home DVD players? If not, do you know of an app that can other than dvdstyler?
microchip8
26th October 2009, 21:24
h264enc can only create an ISO image when dumping from a DVD drive, with the -iso option. It can't create images from VIDEO_TS folders on disk. There are burning apps which can create such images, like k3b
ggking7
27th October 2009, 04:36
Thank you for the info. devede is stellar for this.
smok3
27th October 2009, 07:26
Mplayer (https://launchpad.net/~rvm/+archive/testing)
The version is by rvm, author of SMPlayer.
You know how to compile x264/ffmpeg?
any clues why ffmpeg & x264 would be old? (they were not hard to compile, even for a nix noob, but still...)
Henrikx
27th October 2009, 11:34
any clues why ffmpeg & x264 would be old?
Karmic
libx264-67
current = libx264-78
they were not hard to compile, even for a nix noob,
Most compilations end with
su (sudo) make install, or sudo checkinstall
How to build a proper Debian package, (Debian rules, control, etc) only few people know.
WalterK
27th October 2009, 23:10
yes that is very true if you want an example of that try building ffmpeg with all its libraries into deb packages.
kripz
28th October 2009, 12:17
Hello,
Im new to ripping/encoding, thank god for h264 for simplifying all the commands.
My current process is this:
Use my PS3 to rip blurays to my linux server as an iso.
Mount the ISO on my windows machine.
Decrypt it using AnyDVD onto the server.
Use h264enc on my server to encode it to a smaller MKV.
This is fine when i only have one m2ts. Now im that im trying a new BD i have run into some problems.
This movie is split into multiple m2ts files.
The first audio track is not the correct one.
How do i get the job done? Also, can i get rid of windows completely or do i still need AnyDVD?
microchip8
28th October 2009, 13:32
Have you tried concatenating these multiple m2ts files into one big one?
For the audio track, you can select which one by saying y to the "scan for multiple audio tracks" question (needs to be enabled in the config file of h264enc)
I think you still need AnyDVD for decrypting as the new libbluray project is not done yet
kripz
28th October 2009, 13:37
Hey froggy1,
Been googling since my post, i read about that somewhere. Someone might find this helpful, as the files are named 00001 to 0xxxx i used
cat $(printf "000%02d.m2ts " {1..40}) > output.m2ts
Ill be trying h264enc once it's done.
ggking7
28th October 2009, 15:15
Sometimes the needed m2ts files aren't in sequential order though. makemkv handles this very well, including decryption.
gongloo
29th October 2009, 06:13
I'm getting some issues with nob_pyramid in the x264encopts with mencoder -- mencoder refuses to encode at all. Removing said option (narrowed down by process of elimination) fixes the issue. Perhaps nob_pyramid is implied in recent builds of mencoder/x264?
Dark Shikari
29th October 2009, 06:15
I'm getting some issues with nob_pyramid in the x264encopts with mencoder -- mencoder refuses to encode at all. Removing said option (narrowed down by process of elimination) fixes the issue. Perhaps nob_pyramid is implied in recent builds of mencoder/x264?B-pyramid has never been on by default, ever.
microchip8
29th October 2009, 10:02
Also, in very recent builds of x264 and mencoder, there's no longer a nob_pyramid option but b_pyramid=none, b_pyramid=strict and b_pyramid=normal
When mencoder exits and refuses to encode, it usually displays at the very top which option(s) is/are causing this. Since it works here with recent builds of x264 & mencoder, it must be something on your side. further, h264enc has been updated to support the new b_pyramid and nob_pyramid is no longer in h264enc so it seems you're using an older version but with new x264 & mencoder which don't have nob_pyramid anymore but use the new one
kripz
29th October 2009, 23:16
Froggy1 joining the files using cat appears to have worked. The issue i have now is that i keep getting the wrong audio stream. How can i found out which is the english audio? I know there is one with english but it has commentary in it.
I still have the soundless avi and full mkv created by h264enc. Can i somehow only rip the correct audio from the joined m2ts and add it to the mkv?
This might be somewhat off topic and a general ripping question.
microchip8
29th October 2009, 23:30
kripz,
For TS files, h264enc can't tell you which audio stream has the specific language you're looking for since mplayer doesn't report language info for such files and only DVD input supports that.
You can try each stream with mplayer (using the -aid option each time) and find out manually the ID number of the language you want, then provide it to h264enc in the "scan for multiple audio streams" option. You may need to use the lavf demuxer (mplayer file.m2ts -demuxer lavf) for it to display all audio streams in the TS and their corresponding ID numbers
And yes, you can just encode the audio stream you want and then use mkvmerge to mux it with the mkv you already have. There are various ways you can do that, like dumping the audio to a wav file first, then encode it or using a named pipe and running the audio encoder in the background while mplayer directly dumps pcm audio to the pipe the encoder is reading from (which is the way I use in h264enc too, eliminates the need to dump to a physical file first)
gongloo
30th October 2009, 20:44
h264enc has been updated to support the new b_pyramid and nob_pyramid is no longer in h264enc so it seems you're using an older version but with new x264 & mencoder
Quite right. I used Gentoo's package manager to install the latest available versions of the aforementioned software. I have submitted an enhancement request on the Gentoo Bug Tracker, as they do not carry h264enc past version 9.0.6. I have since upgraded to 9.0.8 (latest at time of writing) and all my issues are remedied. Thanks!
kripz
1st November 2009, 01:42
Ive identified the correct audio track for english, everytime i choose it, it comes out as some other language? Im playing the m2ts in MPC using FFDshow.
microchip8
1st November 2009, 01:46
you should use mplayer, not mpc or ffdshow to get the IDs. As I said, run mplayer with -demuxer lavf and look at the top for the audio streams. You'll get something like below (just ran it on a TS file)
[lavf] Audio stream found, -aid 1
[lavf] Audio stream found, -aid 2
[lavf] Audio stream found, -aid 3
[lavf] Audio stream found, -aid 4
[lavf] Audio stream found, -aid 5
To select the specific stream, just provide its number to the -aid param, eg mplayer file.m2ts -aid 2 -demuxer lavf
EDIT: I may need to add a variable in the config file where the user can set a specific demuxer. At present, this can only be done for mplayer in the MPLAYEROPTS variable, but not for mencoder.
microchip8
1st November 2009, 02:23
btw, I just tested a bit here with a TS sample containing multiple audio streams and everything seems to work here, even without explicitly forcing the lavf demuxer... see screenshot below. It finds all audio IDs and when I specify one, it encodes the correct audio language
http://www.imagebam.com/image/9100f554337230
so what you need to do is, run h264enc, answer yes to the multiple audio stream scanning option, then it'll display all found streams and in another console, run mplayer file.m2ts -aid <number_of_stream_reported_by_h264enc>. Repeat this until you find the correct one and then provide it to h264enc
kripz
3rd November 2009, 23:23
My server does not have audio or a desktop. Any alternatives using windows to find the streams? Ive used programs such as bdinfo but seems to be incorrect.
nm
4th November 2009, 00:02
Use MPlayer on Windows. Here's one good build: http://mulder.dummwiedeutsch.de/home/?page=projects
microchip8
4th November 2009, 08:49
ChangeLog for version 9.0.9
* Replaced a few if conditionals with case statements in the neroaac_audio_func() function
* Sed a comma at the end of resolution detection in case we're dealing with TS files. The default TS
demuxer in MPlayer has a comma at the end of the resolution info which results in errorneous behavior in the bc calculation
* Simplified the resolution detection code
* Some small cleanups
smok3
4th November 2009, 09:22
My server does not have audio or a desktop. Any alternatives using windows to find the streams? Ive used programs such as bdinfo but seems to be incorrect.
mediainfo-cli ?
http://mediainfo.sourceforge.net/sl/Download
nm
4th November 2009, 13:31
mediainfo-cli ?
http://mediainfo.sourceforge.net/sl/Download
Does it always give correct language identification? I'd guess you need to hear the audio to recognize the correct track reliably.
microchip8
9th November 2009, 11:32
ChangeLog for version 9.1.0
* Implemented a simple telecine detector for NTSC DVDs. Currently it's a dumb solution which can't
distinguish between hard telecine and interlacing but it's enough to detect soft telecine and mixed progressive/telecine
content which is more common
* Simplified the FPS detection code
* Update to all presets: added new weightp x264 option. This requires latest x264 revision from git
* Updated the preset.cfg file. Added weightp option
* Small general code improvements and cosmetics
mrplow
13th November 2009, 21:57
would it be possible to add a xbox1 preset for the stand alone devices? its older hardware so it can't take too much. There is also a wiki with settings which are known to work. http://xbmc.org/wiki/index.php?title=HOW-TO_Encode_H.264_Videos_Compatible_With_XBMC_For_Xbox
However it would be nice to have this preset built into the program.
I've been using this preset which seems to work quite well.frameref=":frameref=8"
mixed_refs=":mixed_refs"
bframes=":bframes=6"
b_adapt=":b_adapt=2"
b_pyramid=":b_pyramid"
weight_b=":weight_b"
subq=":subq=7"
me=":me=umh"
me_range=":me_range=32"
cabac=":nocabac"
a8x8dct=":8x8dct"
partitions=":partitions=p8x8,b8x8,i8x8,i4x4"
fast_pskip=":nofast_pskip"
keyint=":keyint=240"
keyint_min=":keyint_min=24"
qcomp=":qcomp=0.5"
ratetol=":ratetool=4.0"
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.