View Full Version : h264enc for Linux


microchip8
9th February 2008, 10:03
h264enc is a rather advanced shell script which can help you to encode video files or DVDs to the H.264 video format. It has built-in quality presets (34 so far), supports a lot of video (pre/postprocessing) filters and a few audio filters as well. Further it supports 9 different audio codecs and has a (limited) batch encoding capability. Muxing is also supported for the MKV, MP4 and OGM containers. h264enc by default outputs to AVI and then remuxes it to the chosen container. h264enc heavely relies on MEncoder and MPlayer as it uses both to do the whole setup/encoding

at http://h264enc.sourceforge.net is a FAQ about h264enc, so if anyone is interested, just go put up some coffee and read it through

h264enc is also available from my openSUSE build service repo

http://download.opensuse.org/repositories/home:/microchip8

Henrikx
9th February 2008, 16:35
Cool.
THX.
Simple translation and presentation.
http://www.movie2digital.de/thread.php?postid=467704&sid=7db8761c8b3c46967c45f34e48cede7d#post467704

microchip8
9th February 2008, 16:38
thanks for the German translation ;)

Henrikx
9th February 2008, 17:51
Presentation by Ubuntuusers.de too...:)
http://forum.ubuntuusers.de/topic/151475/?p=1220571#1220571

Adub
9th February 2008, 20:38
The only problem is, if you make one mistake, you have to start all over again.

microchip8
9th February 2008, 20:45
The only problem is, if you make one mistake, you have to start all over again.

then don't make a mistake and keep awake :P ... seriously, i've never made a mistake with it, especially when using the presets

Adub
10th February 2008, 05:43
No, I mean when entering the values. If you are not experienced with the script, and you enter a wrong value, you end up having to start all over again.

microchip8
10th February 2008, 06:15
yes this is true, but after some time one gets used to it. I think this is the same with all scripts that operate like h264enc, especially those that offer a variety of options

microchip8
16th February 2008, 10:54
ChangeLog for version 8.1.8

- Export testing condition to the batch file for the output of MEncoder
and for the output directory as well
- Changed FPS naming for Silent Speed to Silent Film
- Added support for automatic brightness/contrast control
- Bugfix: Only ask for deletion of the AVI file if the user has chosen
to remux it to one of the supported containers
- Removed duplicate $quiet variable in the video_deinterlace_func()
function when deinterlacing with a frame doubler
- Modified the -iso option to use 'pv' for DVD ISO dumping instead of
'dd'. 'pv' provides us with a nice progress bar which is useful as
it takes a long time to dump a DVD, so the user can follow the
progress. 'dd' provides no such thing.
- Updated the -iso option to support dual-layer DVD discs (~8.54 GB)
- Added support for setting the subtitle alignment
- Added support for setting the subtitle Gaussian variance strength
when hardcoding subtitles into the movie
- Use $IDXFILE variable for the MP4SUB and MKVSUB variables
- Tweaks to the HD presets. Increased VBV buffer size to 14475 and
set keyint to 14 and keyint_min to 2 for the SD/HD presets. Also
increased b-frames usage from 3 to 6
- Various small code improvements
- Updated the man page

microchip8
18th February 2008, 14:39
ChangeLog for version 8.1.9

- Updated the DVD chapters code to support the latest SVN version
of MPlayer/MEncoder
- Small improvements to the cropping code
- Fall back to 'dd' for ISO dumps if 'pv' is not available on
the user's system
- Set default noise pattern to be Luma + temporal instead of Luma & Chroma + temporal
- Added support for the lossless format of the Sonic audio codec
- Added the X-Men 3 matrix, Q matrix, Q2 matrix, Soulhunter V1
matrix, Soulhunter V2 matrix, MP4Guy's low bitrate matrix, Audionut
high bitrate matrix and Audionut general matrix to the package.
Thanks to Audionut, MP4Guy and Soulhunter
- Bugfix: the ivtc/telecine process should check for the $deintfilter
variable instead of the $deintfps one. ivtc/telecine is mutually
exclusive with deinterlacing
- Improvements to the MP4 muxing part when exporting the options to
the batch file. From now on, the FPS needed for MP4Box is directly
taken from the AVI file. This approach is much more reliable and the
user no longer needs to edit the FPS value for MP4Box when exporting
the options of NTSC content to the batch file.
- Added one Anime high-quality preset (anihq)
- Updated the presets_keyint_func() function
- Added support for the Tfields deinterlacer @ original frame speed
and Tfields + fast/medium/slow/slowest Mcdeint @ original frame speed
- Replaced a few 'if' conditionals with 'case' conditionals
- Updated the README.matrices file
- Typo fixes
- Updated the man page

Henrikx
18th February 2008, 14:59
Good news!

microchip8
20th February 2008, 10:16
Mainly a bugfix/code clean up release. ChangeLog for 8.2.0
- Fixed a bug in the deint_custom_fps_func() function. Variable
deintfsp for NTSC @ 59.94 fps should be deintfps
- Fixed a bug in option 8 of the $dfilter variable which was
using a invalid underscore. Should be -field-dominance 1
instead of -field_dominance 1
- Clean ups of old commented out code
- Reordered the deinterlacing menu. Separated the normal
deinterlacers from the frame doubling ones
- Small improvements to the audio_channels_func() function
- Renamed variable $ss to $softscale
- Added two iPod Classic presets for iPods that support
only H.264 @ Level 1.3 (icvp and ichqvp)
- Updated the README.h264enc file
- Updated the man page

microchip8
24th February 2008, 11:45
ChangeLog for version 8.2.1

- Removed the 'user defined' option from the deint_custom_fps_func()
function as it can confuse users who don't really know what to
enter there
- Added support for different audio resampling modes
- Added support for the 'lavcresample' audio resample filter
- Made the audio_resample_func() function to be menu driven
- Converted the MKV/MP4/OGM code to base its decision on
variable $audiocodec instead of variable $audcodec. Makes
the code less complicated
- Updated the 'preset.cfg' file. Custom presets now support
the following additional options: ratetol, vbv_maxrate, vbv_bufsize,
vbv_init and cqm and me_prepass
- Preparations for the motion estimation prepass patch
- Added support for automatic detection of the video aspect
- Don't continue if MEncoder exits with a non-zero status
- Added two Black & White/Gray presets for BW movies (bw and bwhq)
- Small improvements to the custom_matrix_func() function
- Small improvements to the DVD titles scanning code
- Small improvements to the check_diskspace_func() function. Patch
by Gunter Ohrner
- Updated the -sc option
- Variable renamings and clean ups
- Updated the man page

microchip8
27th February 2008, 10:44
ChangeLog for version 8.2.2
- Added support for calculating the video bitrate when encoding with
the NOSOUND audio option
- Added support for calculating the video bitrate when using the
PCM audio codec
- Converted the code for the bicubic software scaler parameters to
be menu driven
- Added one 'Insane High Quality' preset (ihq) which uses the
Hadamard-based motion estimation algorithm
- Enabled AAC audio support for the Matroska container. Please
upgrade your mkvtoolnix to the latest SVN version!
- Notify the user that the frame rate will change when using the
inverse telecine/telecine filters
- Clean ups in the MP4 muxing code
- Improvements to the batch exporting code
- Updated the man page

Henrikx
27th February 2008, 11:37
:thanks:
redirected automatically :)

microchip8
29th February 2008, 10:47
ChangeLog for version 8.2.3
- Added support for doing 60p -> 30p, 60p -> 24p and 50p -> 25p
FPS conversion. Useful for HD content that runs at 59.94 or 50 fps.
This option is mutually exclusive with interlacing and frame doubling
deinterlacing filters
- Added two Nokia S60 presets (nkvp and nkhqvp). Thanks to Matteo
Croce (mp4tools) for the device info
- Colorized automatic actions/info/menus
- Fixed a small bug in the manual codec configuration where calculating
of the keyint_min value fails
- Updated the man page

microchip8
1st March 2008, 10:41
ChangeLog for version 8.2.4
- Bugfix: forgot to add tinterlace before the detc filter for
60p -> 24p FPS conversion
- Removed the '-p help' option as it is not very useful. --help
displays everything one needs to know
- Added more 60p -> 24p FPS conversion filters and set default
filter to framestep=2,filmdint=fast=0 which gives the best
results
- Disabled colorspace conversion when interlacing, telecining or
when doing FPS conversion as some of the filters (most?) don't
like it. Also disabled colorspace conversion for the Nokia S60
presets
- Made the script to use unique temporary directories to store
the config/parsing files. That way, one can run multiple
instances of h264enc at the same time without interference
- Modified the batch exporting code to work with unique
directories
- Updated the man page

buzzqw
1st March 2008, 10:51
i will greedly study these scripts (just to start making some other guis :p )when i will move to linux!

and i hope to move soon!

thanks froggy1

BHH

microchip8
1st March 2008, 10:56
i will greedly study these scripts (just to start making some other guis :p )when i will move to linux!

and i hope to move soon!

thanks froggy1

BHH

you don't have to completely move to Linux, just dual-boot with Windows or run Linux inside a virtual machine in Windows... but it's true, if you want to get the full potential of Linux, then run it on its own :)

Henrikx
1st March 2008, 13:40
i will greedly study these scripts (just to start making some other guis :p )when i will move to linux!

and i hope to move soon!



Good news!! Very good news.

microchip8
2nd March 2008, 10:48
ChangeLog for version 8.2.5
- Added support for 30p -> 24p FPS conversion
- Added support for the decimate filter when doing 60p -> 24p
FPS conversion
- Small improvements to the crop preview code. Should come after
the user has entered the crop values
- Video file encodings: Use unique default output file based on
process ID
- Fixed a small bug where h264enc assumes that the $HOME/.h264enc
directory already exists but that might not be the case, so it
will fail at making an unique temporary directory. Reported by
Nathaniel Gray
- Added support for setting the quantization parameter for the
spp, uspp and fspp postprocessing filters

microchip8
3rd March 2008, 10:55
ChangeLog for version 8.2.6
- Removed option 2, 3, 4 and 5 of the 60p -> 24p FPS conversion menu
as these filter chains are not very reliable and often fail at doing
the conversion. Also removed support for the decimate filter so now
only framestep and filmdint are supported which give the best results
- Refined the filmdint filter parameters for 60p -> 24p FPS conversion
and set default filter to filmdint=fast=0/io=60:24
- Bugfix: missing ':' in the vbv_bufsize variable of the psphqvp preset.
Reported by Harry Gunnarsson

microchip8
4th March 2008, 11:47
A small release this time. ChangeLog for version 8.2.7
- Added two Flash Player 9 presets (f9 and f9hq)
- Remove config directory on non-zero exit status
- Implemented -sv option which scans an input video file and displays
information about it
- Some small code improvements
- Updated the man page

microchip8
5th March 2008, 14:05
ChangeLog for version 8.2.8
- Merged the -sv option with -scan
- Fixed an issue when scanning video files, especially TS ones, where
printing the video resolution could get misaligned
- Remove pointless removing of temp files. Since h264enc now uses
unique temporary directories to store temp files, there's no
point in removing them anymore as the unique directory will
be removed upon user interrupt or user fault
- Added support for the HE-AAC (aka AAC+) audio codec. This requires
neroAacEnc. When encoding to this codec, the AVI will be first encoded
with PCM audio. Then both the video and audio will be extracted from
the AVI, the audio will be encoded to AAC+ and will be muxed together
with the video to the mp4 and/or mkv container. Multichannel AAC+
audio is not supported yet as neroAacEnc for Linux doesn't seem to
support it at the moment
- Added support for the Vorbis audio codec. This requires oggenc.
Multichannel audio is supported
- Updated the batch code to support AAC+ and Vorbis audio
- Updated the README.h264enc file
- Updated the man page

microchip8
6th March 2008, 14:03
ChangeLog for version 8.2.9
- Video bitrate calculation: fixed the PCM part. It needs different
bitrates for different audio channels. Resampling is not taken into
account at the moment
- Added support for multichannel AAC+. Note that in VBR mode, you
must use a value of 0.37 or lower or else neroAacEnc will error out
with invalid SBR configuration!
- Added support for bitrate based ABR AAC+
- Added support for video bitrate calculation when using ABR AAC+
- Simplified the batch exporting code of the AAC+/Vorbis audio codecs.
This removes code duplication
- Removed the MP4SBR variable in the batch code of the AAC+ audio
codec. The value of this variable is now carried by the
AUDIOFILE variable. Also did a few small simplifications to this part
- Added support for exporting the MP4 muxing commands to the batch file
when using the NOSOUND audio option
- Updated the signal traps
- Replaced an 'if' conditional by a 'case' one in the video bitrate
calculation code
- Random clean ups

microchip8
7th March 2008, 10:52
Think I need a break :) - ChangeLog for version 8.3.0
- Simplifications and clean ups in the audio codecs code
- More simplifications to the video bitrate calculation code
- Fixed identification of AAC+ in the matroska muxing code. Should be
--aac-is-sbr 1:1 and not --aac-is-sbr 1
- Disable accurate rounding of the software scaler on 64-bit systems
since MEncoder has issues with it
- Simplifications to the Matroska batch exporting code. This removes
a lot of code duplication
- Only extract audio and video if we deal with the AAC+ or Vorbis
audio codec
- Simplifications to the Matroska muxing code
- Major simplifications to the MP4 muxing code. A lot of code duplication
is removed

Henrikx
7th March 2008, 13:33
Think I need a break

More than two/three/four/five days?
......don't make me afraid...:)

THX for your work!!

microchip8
7th March 2008, 13:52
More than two/three/four/five days?
......don't make me afraid...:)

THX for your work!!

maybe. I think the script is complete so you'll probably see only small changes over time and less frequent releases

buzzqw
7th March 2008, 14:46
hoe about to "auto" download needed package? (mencoder/mplayer...)

.. something like a "check update" .. both for script and dependencies

BHH

microchip8
7th March 2008, 14:54
hoe about to "auto" download needed package? (mencoder/mplayer...)

.. something like a "check update" .. both for script and dependencies

BHH

the script already checks for these things. It doesn't download and compile them as you'll need root permissions to install everything. h264enc has a -sc option (sanity check) and displays in a menu what is has found/no found on the user's system. It's up to the user to install the needed packages

buzzqw
7th March 2008, 20:10
... i need to pass to linux.. (just waiting q9450 cpu before buing new pc...)

BHH

microchip8
7th March 2008, 20:17
... i need to pass to linux.. (just waiting q9450 cpu before buing new pc...)

BHH

which distro are you going to choose? I'm on openSUSE (very slick and user friendly) but Ubuntu is very popular among ex-Windows fanboys. Its popularity comes mainly from Canonical's excellent marketing

buzzqw
7th March 2008, 20:50
i have actually downloaded
kubuntu, ubuntu 7.10
opensuse 10.3
mandrivia
debian 4.03 (etch ?)
freebsd and beos

... don't know .. i will try for some weeks with varius distro.. (mainly for compatibility and software usage) then decide...
as i already know *buntu (and don't like it).. my first try will be mandrivia, then opensuse

i have big aspectation from opensuse...

BHH

microchip8
7th March 2008, 20:55
excellent, you should definitely try out a few distros and pick the one you like the most. I started out with Mandrake (now Mandriva) back in the days, then switched over to SUSE... been on SUSE for 4 years now :)

Henrikx
7th March 2008, 20:59
@buzzqw
Good luck, and donīt forget
PcLinuxOS
Fedora

microchip8
8th March 2008, 20:07
ChangeLog for version 8.3.1
- Added checking for oggenc and neroAacEnc to the -sc option
- Disabled the scalable sample rate option of the FAAC menu
since it does not work. FAAC doesn't support HE-AAC
- Color optimizations
- Some minor code improvements
- Use named pipes (fifo) to encode to AAC+ or Vorbis audio. This
eliminates the audio dumping step and the required disk space
- Updated the batch code to support named pipes

microchip8
10th March 2008, 17:26
ChangeLog for version 8.3.2
- Pre/Postprocessing video filters are now grouped in one question
- Fixed a small bug. The Nokia S60 presets are not allowed in
fixed-quant mode since they have maximum allowed bitrate
restrictions
- Added autocompletion support. Patch by Nicolas Di Pietro
- Added a skip option to most of the menus
- Added support for AAC+ audio to the f9 and f9hq presets
- Clean ups in the audio codecs code

microchip8
13th March 2008, 10:58
ChangeLog for version 8.3.3
* Minor clean ups and code improvements
* Set default QP parameter to 0 for the spp, fspp and uspp postprocessing filters
* Added support for CBR AAC+ audio
* Made the CBR part of the audio codecs to be menu driven
* Fixed a bug where the FPS conversion menu and the Telecine/IVTC don't show
up due to missing interlaced variable. Bug was introduced during the grouping of
the pre/postprocessing video filters

microchip8
15th March 2008, 20:58
ChangeLog for version 8.3.4
* Removed niceness from the muxing commands
* Clean ups to the batch exporting code
* Added -nocache mplayer option to the AAC+/Vorbis muxing/exporting code
* Disabled muxing to MKV if the user is using the AAC+ or Vorbis audio codec.
The reason for this is that mkvmerge doesn't seem to honor the --default-duration
flag when importing RAW h264 streams and will because of this generate files
with major A/V sync issues. I've already filed a bug report. Until this is resolved
I will not enable MKV muxing when using the AAC+ or Vorbis audio codec!
* Replaced an 'if' conditional with a 'case' one in the AAC+/Vorbis batch exporting code
* Updated the AUTHORS file. Added Harry Gunnarsson as bug reporter/testing

microchip8
18th March 2008, 09:42
Small bugfix release. ChangeLog for version 8.3.4.1
* Bugfix for the PSP presets. Multi-threading was not enabled

microchip8
23rd March 2008, 10:49
ChangeLog for version 8.3.5
* Use -vf rectangle=<crop_values> when previewing the crop values. Will give us a nice outline of the crop values
* Removed accurate rounding of the software scaler since it does not work on a lot of systems
* Updated the VAQ code to support the final version of the variance adaptive quantization patch -> replaced aq_sensitivity with aq_mode
* Updated the preset.cfg file to support the new VAQ
* Changed sample rate of the f9 and f9hq presets from 48000 Hz to 22050 Hz
* Be silent when doing FPS conversion

microchip8
27th March 2008, 19:35
ChangeLog for version 8.3.6
* Use awk to get the current device when exporting DVD chapters information
* When encoding specific chapters, append the chapters info at the end of the output file
* Changed the nkvp and nkhqvp presets to nks60vp and nks60hqvp
* Removed support for manual video codec configuration. This reduces the code and
makes it less bloated. If a user wants to configure something manually, he can write his
own custom preset and load it in h264enc
* Removed support for MP3 high- and lowpass frequency settings. I'm sure many
people don't use these options and accept the defaults
* The threads option is now hard coded into the mencoder_opts() function
* Removed keyint and keyint_min from the HW compatible presets. Use the default
detected values for those
* Updated the preset.cfg file
* Updated the README.h264enc file. Added links for neroAacEnc and Vorbis
* Removed SD/HD Extended presets. They are useless
* Updated the man page

microchip8
8th April 2008, 11:50
ChangeLog for version 8.3.7
* Integrated the exit command into the rmconf() function
* Added aq_metric for those who want to test the VAQ2 patch
* Updated the preset.cfg file. Added aq_metric
* Small clean ups

microchip8
9th April 2008, 12:24
ChangeLog for version 8.3.8
* Updated the cropping code to support the latest SVN version of MEncoder
* Replace underscores from DVD title names with spaces

microchip8
15th April 2008, 02:22
ChangeLog for version 8.3.9
* Fixed the cropping code. NTSC content was problematic
* Added support for NTSC Double @ 60 fps

blaz
20th April 2008, 18:45
Just noticed that 5.1 AC3 audio gets reduced to just stereo aac in PS3 presets.

Ouch.

Can copy over the 5.1 -> 5.1 settings from the output of another preset, but am just not sure why you would want to do this as practically every PS3 is hitched up to some home theatre system.

microchip8
20th April 2008, 18:49
Just noticed that 5.1 AC3 audio gets reduced to just stereo aac in PS3 presets.

Ouch.

Can copy over the 5.1 -> 5.1 settings from the output of another preset, but am just not sure why you would want to do this as practically every PS3 is hitched up to some home theatre system.

I'm not sure if the PS3 supports AAC 5.1 and I don't have one here to test with, that's why I went for Stereo AAC audio. If you have one, then you can test and report if the PS3 plays MP4s with 5.1 AAC audio

blaz
20th April 2008, 19:00
OK, I'll see what I can do.

Sony *claims* that it supports AAC LC in mp4 and mpeg-2 PS video files, but I can't find anything specific about the # of channels.

microchip8
20th April 2008, 19:05
OK, I'll see what I can do.

Sony *claims* that it supports AAC LC in mp4 and mpeg-2 PS video files, but I can't find anything specific about the # of channels.

Sony claims a lot of things :) The PS3 presets in h264enc are directly taken from RipBot264 for Windows, I only modified a few things in them to get a bit higher quality

blaz
21st April 2008, 02:04
We can forget this as I can't test whether the PS3 decodes 5.1 aac anyway. And I can't play it even if it does.

My amp is not hdmi, so I use optical audio from the PS3. And under optical the PS3 can just send 2 channel pcm, or bitstream the Dolby Digital, DTS or aac (!) to the amp. But my amp cannot decode aac, just DD or DTS.

If I lie to the ps3 and tell it that the amp can decode aac, I get no sound from an mp4 that is supposed to have 5.1 aac audio, so the PS3 *may* be sending un-decoded 5.1 aac to the amp.

If I don't lie, the PS3 sends stereo which it must have decoded from the 5.1 aac, no? Theoretically, if I had an hdmi connection, the ps3 can send out up to 7.1 channels pcm, maybe including 5.1 channels of decoded aac!

But all that won't do me any good until I get a new amp, which isn't going to happen for a long time. So I'm back to converting my dvd's with subtitles to avi+divx+ac3, somehow.

Whew, what a journey.:rolleyes:

nm
21st April 2008, 08:12
I think I recall from the AVC forum that PS3 plays MPEG-TS files with H.264 video and AC3 sound.

blaz
21st April 2008, 13:05
I think I recall from the AVC forum that PS3 plays MPEG-TS files with H.264 video and AC3 sound.

Hmmm, thanks, I'll have to try this, especially, if we can't get beyond the 2gb limit for avi.

I did ask on the PS3 forum, and was told that the PS3 definitely decodes 5.1 aac, you just need hdmi to your amp to get it.

microchip8
21st April 2008, 13:19
Hmmm, thanks, I'll have to try this, especially, if we can't get beyond the 2gb limit for avi.

I did ask on the PS3 forum, and was told that the PS3 definitely decodes 5.1 aac, you just need hdmi to your amp to get it.

well if this is true, then I will enable multi-channel AAC audio for the PS3 presets so if some people have hdmi they can use the 5.1 sound :)

buzzqw
21st April 2008, 13:44
I did ask on the PS3 forum, and was told that the PS3 definitely decodes 5.1 aac, you just need hdmi to your amp to get it.

you can set ps2 to put aac 5.1 direct to your amp BUT your amp need aac support
IF your amp don't support aac, you ps3 you can set to decode to STEREO PCM

BHH

PS: i have a ps3, pal 60gb, fw 2.30.. and my amp cannot decode aac :(

microchip8
21st April 2008, 13:50
you can set ps2 to put aac 5.1 direct to your amp BUT your amp need aac support
IF your amp don't support aac, you ps3 you can set to decode to STEREO PCM

BHH

PS: i have a ps3, pal 60gb, fw 2.30.. and my amp cannot decode aac :(

good to know buzzqw, thanks for the info :)

microchip8
22nd April 2008, 22:27
ChangeLog for version 8.4.1
* Updated the keyframe auto detection
* Updated the audio_channels_func() function
* Updated the --help section
* Set the field dominance of the yadif deinterlacer to auto-detection. If the decoder
doesn't export the field order, it defaults to TFF (top field first)
* Enabled multi-channel AAC audio for the Sony PS3 presets
* Small update to the FPS conversion menu
* Fixed a typo in the color() function
* Small menu enhancements to the video_interlace_func() function
* Added support for video bitrate calculation when using 5 channels PCM audio
* Removed delay when exiting from user interrupt
* Updated the audio codecs menu
* Updated the README.encoding file

microchip8
25th April 2008, 19:35
ChangeLog for version 8.4.2
* Fixed a problem where the detected resolution based on the
crop values favored the values of the cropdetect filter instead of the
user provided values. Reported by blaz from the Doom9 forum
* Renamed resolution variable 'res' to 'vres'
* Added support for doing 25 -> 50 fps and 29.970 -> 59.940 fps conversion using simple frame duplication
* Updated the man page

nfm
28th April 2008, 04:19
Much appreciated work froggy1! Thank you very much for great knowledge, skill, and time.

I'm looking to convert DVD into H264 using x264. It's been a while since I've done it in GNU/Linux. I remember I used to pipe ffmpeg with x264 (source -> ffmpeg -> y4m | x264 mypreset). This way I was able to use preset from megui (hdslow) instead of confusing mencoder options. Does mencoder these days features all x264 features?

nm
28th April 2008, 08:30
I'm looking to convert DVD into H264 using x264. It's been a while since I've done it in GNU/Linux. I remember I used to pipe ffmpeg with x264 (source -> ffmpeg -> y4m | x264 mypreset). This way I was able to use preset from megui (hdslow) instead of confusing mencoder options. Does mencoder these days features all x264 features?
MEncoder calls libx264's parameter parsing code, so all parameters are always supported and the syntax is basically the same as in x264. Only x264 features that are not supported are the GTK+ GUI and Matroska and MP4 output since that part is handled by MEncoder. However, MP4 output should work with libavformat's muxer (-of lavf -lavfopts format=mp4).

microchip8
28th April 2008, 12:47
ChangeLog for version 8.4.3
* Clarify that the aspec ratio is the one for input sources
* Added MP4Box -ipod switch for the iPod/iPhone profiles
* Set the field order of the frame doubling yadif deinterlacer to auto detection
* Implemented source_fps_func() function to reduce code duplication. This function
automatically detects the FPS of the content and is shared between the deinterlace
and interlace functions
* Added support for applying denoising/deblocking on interlaced content. This is done
by deinterleaving the content with the il=d filter, applying the denoising/deblocking on
the deinterleaved content and interleaving it back with the il=i filter. That way we don't
break the interlacing
* Color enhancements to the -bpp and -bpb options

rberger
28th April 2008, 18:44
MEncoder calls libx264's parameter parsing code, so all parameters are always supported and the syntax is basically the same as in x264.

It even seems to be *exactly* the same up to a few parameters where mencoder has it's own version or plain wouldn't allow the x286 parameter because it could interfere with mencoders own operation, like -passfile for --stats or --progress leading to premature exit since it would mess with mencoders output.

Apart from those few, x264 parameters seem to be handed down by mencoder untouched. The reason they may have different names in the mencoder docs is because some options are implemented with several names in x264 itself, like --filter being the same as --deblock. Apparently, you can always look into common/common.c in the x264 source tree to find out what is what.

Only x264 features that are not supported are the GTK+ GUI and Matroska and MP4 output since that part is handled by MEncoder.

Seems to me all those were never part of x264 proper. It's just an encoder library with a CLI.

However, MP4 output should work with libavformat's muxer (-of lavf -lavfopts format=mp4).

I wouldn't recommend that. As of SVN-r26492, mencoder's MP4 muxing is once again - and likely always has been - broken. It even warns about that.

There's always the possibility to encode video and audio separately with mencoder and mux with gpac/mp4box. This generally works pretty well with PAL sources, but the moment you do IVTC on NTSC material or other frame juggling filtering, you might run into A/V sync problems. In these cases, it really matters what options you feed to mencoder, and it becomes a kind of a trial and error situation.

See e.g. sections 14.1.9 and 14.1.12.1 here:
http://www.mplayerhq.hu/DOCS/HTML/en/menc-feat-dvd-mpeg4.html

and how people already have run into sync troubles
http://forum.doom9.org/showthread.php?t=122018
http://thread.gmane.org/gmane.comp.video.mplayer.user/48954
http://thread.gmane.org/gmane.comp.video.mplayer.user/49206

That's one of the reasons encoding on Linux still sucks, that while mencoder seems to be the most advanced full feature transcoding frontend (transcode being another) and often enough working quite well right out of the box, it might always unexpectedly fail in some only slightly subtle situation. MP4 muxing definitely seems to be one of those.

nm
28th April 2008, 21:27
Seems to me all those were never part of x264 proper. It's just an encoder library with a CLI.
Well, they are part of x264, but not the core library (libx264). GUI and MP4 support need to be enabled when configuring the build (and they need external libraries, of course). Matroska output support is built-in to the CLI.

I wouldn't recommend that. As of SVN-r26492, mencoder's MP4 muxing is once again - and likely always has been - broken. It even warns about that.
Ok, I was actually thinking whether I should say that it might work or if it should work, and I opted for the latter since there were rumors that it now works. I wouldn't recommend using it either if there is doubt.

That's one of the reasons encoding on Linux still sucks, that while mencoder seems to be the most advanced full feature transcoding frontend (transcode being another) and often enough working quite well right out of the box, it might always unexpectedly fail in some only slightly subtle situation. MP4 muxing definitely seems to be one of those.
Avidemux is also worth trying, although it's more GUI-oriented. At least it can output MP4 properly :)

rberger
29th April 2008, 01:34
Avidemux is also worth trying, although it's more GUI-oriented. At least it can output MP4 properly :)

Right, thanks for the reminder. I looked at avidemux at one point during the past weeks, but wasn't that much impressed, don't ask me why.

Also, I silently assumed it would link against ffmpeg libraries anyways and hence offer no real functional advantage compared to mplayer. Doesn't seem to be the case though, albeit I'm not yet completely sure about that. If they really maintain own muxers working better than the ffmpeg variants, that would definitely be great (although I have a distinct feeling that linking against gpac would be the best thing all these projects could do, as it appears to be the most advanced and robust mp4 muxer).

Considering avidemux offers a CLI, which escaped me the other day, and they advertise scriptability, I'm almost ready to get a little excited.

If anybody shared their avidemux experiences, especially regarding AVC/AAC coding and MP4 muxing, I would sure appreciate it.

nfm
29th April 2008, 02:45
With ihq (Insane High Quality) preset mencoder crashes, uhq preset works fine. @nf and @rberger, thanks for good info, I dumped mp4 in favor of mkv in linux, although I still choose mp4 in windows.

Edit: Looks like mencoder crashes with custom x264 settings too:
#!/bin/bash
#

mencoder "/media/vol05/DVD Rips/MainMovie/INSIDE MAN/VIDEO_TS/VTS_01_2.VOB" -o /dev/null -fps 30000/1001 -ofps 24000/1001 -frames 1000 -vf pullup,crop=720:352:0:64,softskip,harddup -af volnorm=2 -oac faac -faacopts mpeg=4:br=110:object=2 -ovc x264 -x264encopts pass=1:bitrate=1000:ref=5:mixed-refs:no-fast-pskip:bframes=5:b-pyramid:b-rdo:bime:weightb:direct=auto:filter=-2,-1:subme=6:trellis=2:partitions=p8x8,b8x8,i4x4,i8x8:8x8dct:me=umh:threads=auto:thread-input:progress:no-dct-decimate:no-psnr:no-ssim -passlogfile ./h264.stats 2>/dev/null

mencoder "/media/vol05/DVD Rips/MainMovie/INSIDE MAN/VIDEO_TS/VTS_01_2.VOB" -o ./ouput.avi -fps 30000/1001 -ofps 24000/1001 -frames 1000 -vf pullup,crop=720:352:0:64,softskip,harddup -af volnorm=2 -oac faac -faacopts mpeg=4:br=110:object=2 -ovc x264 -x264encopts pass=2:bitrate=1000:ref=5:mixed-refs:no-fast-pskip:bframes=5:b-pyramid:b-rdo:bime:weightb:direct=auto:filter=-2,-1:subme=6:trellis=2:partitions=p8x8,b8x8,i4x4,i8x8:8x8dct:me=umh:threads=auto:thread-input:progress:no-dct-decimate:no-psnr:no-ssim -passlogfile ./h264.stats 2>/dev/null
Screw mencoder, looks like I have do try the old way, ffmpeg | x264.

rberger
29th April 2008, 06:38
Throw out 'thread-input' and 'progress', then try again (I mentioned the issue with progress above already).

nm
29th April 2008, 06:59
Also, I silently assumed it would link against ffmpeg libraries anyways and hence offer no real functional advantage compared to mplayer. Doesn't seem to be the case though, albeit I'm not yet completely sure about that. If they really maintain own muxers working better than the ffmpeg variants, that would definitely be great
They use the lavf MP4 muxer, which works just fine AFAIK. The problem seems to be in MEncoder and its b-frame handling.

(although I have a distinct feeling that linking against gpac would be the best thing all these projects could do, as it appears to be the most advanced and robust mp4 muxer).
I doubt it would improve the situation in this case. GPAC is also a bitch to compile.

If anybody shared their avidemux experiences, especially regarding AVC/AAC coding and MP4 muxing, I would sure appreciate it.
Never had a problem with it for these purposes and this seems to be what most people are now using it for. Personally I prefer MEncoder, but that's because I already know the tricks to make it work.

nm
29th April 2008, 07:16
Edit: Looks like mencoder crashes with custom x264 settings too:
In addition to rberger's solution, there are a few other things to change:
When trying new stuff, don't redirect error messages to /dev/null. That is, remove "2>/dev/null" from the end of the command.
Now you missed the helpful message "Option x264encopts: Unknown suboption progress" because of this.
Use turbo=1 or turbo=2 for the first pass (or just use CRF instead of bitrate modes)
Only use AVI output for H.264 if that's the last option. Try encoding audio and video separately (use -of rawvideo for H.264 ES output) and mux the resulting streams with mkvmerge or MP4Box.
Screw mencoder, looks like I have do try the old way, ffmpeg | x264.
How do you intend to do IVTC in that workflow? I'd replace ffmpeg with MEncoder for better filtering, even if you insist on calling x264 separately.

rberger
29th April 2008, 09:12
They use the lavf MP4 muxer, which works just fine AFAIK. The problem seems to be in MEncoder and its b-frame handling.

Which means the same muxer as mencoder. And the latter failed on me with the only x264 option specified being crf, which means zero b frames. Maybe it's mencoder, but frankly it'd surprise me.


Never had a problem with it for these purposes and this seems to be what most people are now using it for. Personally I prefer MEncoder, but that's because I already know the tricks to make it work.

Thanks for the feedback. In the meantime, I checked again and found once more that avidemux is not really what I want, effectively being too gui bound. The quest continues.

nfm
29th April 2008, 09:15
I got it to work, taking out 'thread-input' and 'progress' did the trick. Pardon me but I'm very much newbie in encodings, always will be :p
Regrading the "2>/dev/null", that' why I didn't see errors, now I understand that the standard output was redirected to /dev/null.
Use turbo=1 or turbo=2 for the first pass (or just use CRF instead of bitrate modes) Will do nm, thanks.
I tried matroska container "-o output.mkv -of lavf" there's no audio when faac is used, there's a problem with audio resampling rate. I still haven't got gpac to compile. I'm no doom9 guru, but isn't there a problem storing b-frames within an avi? Is mencoder affected by this? I think I will go about encoding audio and video separately, and mux them into mkv. Again, nm and rberger, big thanks.

rberger
29th April 2008, 09:31
Don't apologize, I'm pretty much new to the subject myself, and we all have to start somewhere and somehow.

Regarding muxing into Matroska (mkv), I believe its not supported by mencoder. It only has a demuxer (i.e. it can read) for that container type, but not a muxer (can not write). If it had one, your command line would anyway look like this "-o output.mkv -of lavf -lavfopts format=mkv". But as said I'm pretty much sure that's not supported.

Look at the output of your mencoder run. At some point early on it likely tells you that it muxes into avi (the default output container format) since your options make no sense to mencoder. That's also likely the cause your sound isn't muxed in, because avi doesn't support AAC.

Regarding b frames and avi I don't know, being not that proficient with this format myself.

nm
29th April 2008, 09:39
Which means the same muxer as mencoder. And the latter failed on me with the only x264 option specified being crf, which means zero b frames. Maybe it's mencoder, but frankly it'd surprise me.
Yes, MEncoder uses the same libavformat MP4 muxer, but it does work fine when used through ffmpeg and Avidemux. People use it all the time.

Thanks for the feedback. In the meantime, I checked again and found once more that avidemux is not really what I want, effectively being too gui bound. The quest continues.
Well, the only scriptable tool that is better than MEncoder for handling telecine and variable framerate scenarios is AviSynth (since its IVTC filters support writing timecode files). I'd suggest using it through Wine if you have an x86 system.

nm
29th April 2008, 09:54
I'm no doom9 guru, but isn't there a problem storing b-frames within an avi? Is mencoder affected by this?
Yes, there are problems. If the audio is AVI-compliant, it can be muxed with H.264 video but the A/V sync may be off a little. This depends on how many B-frames the encoder uses in the first batch that it inserts, IIRC. AVI output may be the last option if you have otherwise problems keeping the sync when encoding hybrid NTSC sources (part 24000/1001 fps film, part 30000/1001 fps video).

buzzqw
3rd May 2008, 12:53
@froggy1

just a simple request

would be possible to start h264enc (and btw xvidenc/divxenc) with only specify the input file ?

just start asking only the input file, then start asking pass/preset/audio/fps.. and so on
would be a little easier

one more: the script can check if a new version is released and download id

thanks

BHH

microchip8
3rd May 2008, 14:22
@froggy1

just a simple request

would be possible to start h264enc (and btw xvidenc/divxenc) with only specify the input file ?

just start asking only the input file, then start asking pass/preset/audio/fps.. and so on
would be a little easier

one more: the script can check if a new version is released and download id

thanks

BHH

unfortunately this is not possible at the moment as i'll have to rewrite a lot of stuff and i'm a bit lazy at the moment to do that... as for checking for a newer version, i think i can add this

buzzqw
3rd May 2008, 17:25
thanks for your answer, i will glady wait :P

BHH

Lokean
5th May 2008, 03:12
I looked at avidemux at one point during the past weeks,

Also, I silently assumed it would link against ffmpeg libraries anyways and hence offer no real functional advantage compared to mplayer. Doesn't seem to be the case though, albeit I'm not yet completely sure about that.
Avidemux uses an internal copy of the ffmpeg libraries (i.e. it doesn't link to the system ffmpeg).

blaz
21st May 2008, 01:28
froggy1's programs use dd or pv to create iso's from a dvd.

I've never heard of pv and am running into walls searching for it.

Can someone (froggy1?) point me to it (on the web ?) and maybe provide any advice as to whether it is preferable to dd.

One problem I'm having is copying older scratched dvds.

microchip8
21st May 2008, 09:38
well, i don't know which distro you use, but on openSUSE, pv is in the Packman repository. A search on rpmfind, finds this utility http://rpmfind.net/linux/rpm2html/search.php?query=pv

pv is an alternative to dd and displays a nice progress bar when making an ISO image out of a DVD. As for scratched DVDs, there's little I can do about it, it's beyond my control

blaz
21st May 2008, 14:04
Hmmm, I had looked at the pv package on debian but somehow: "PV ("Pipe Viewer") is a tool for monitoring the progress of data through a pipeline" didn't seem like what I was looking for.
But now on installing it and reading the man page, I see that it does a lot more than that.
Will give it a try. Thanks again.

microchip8
30th May 2008, 13:28
ChangeLog for version 8.4.4
* Small menu enhancements to the FPS settings
* Fixed wrong explanation for the temporal denoiser
* Removed support for the Sonic and SonicLS audio codecs since they
are experimental and far from complete for daily use
* Updated the man page

microchip8
4th June 2008, 16:41
ChangeLog for version 8.4.5
* Fix for the sdb, sdm, sdh, hdb, hdm and hdh presets. These presets are only
supported in 1-, 2-, or 3-pass mode since they use VBV maxrate and VBV bufsize
with is not compatible with QP/CRF encoding modes

microchip8
12th June 2008, 15:06
ChangeLog for version 8.4.6
* Merged checking of the encoding modes for the specific presets that need it
* Removed the Black & White presets since they are useless and the only difference
in them from the others is that they don't use chroma motion estimation
* Updated the man page

palpyhat
15th June 2008, 13:22
Does the script support selecting SAR or PAR to be input directly into the MPEG-4 video stream (not the container)?

The same question also applies to xvidenc.

microchip8
15th June 2008, 18:23
not at the moment.

microchip8
18th June 2008, 19:09
ChangeLog for version 8.4.7
* Added support for inclusion of external subtitles when encoding video files.
The external subtitle will be hard coded into the encode
* Updated the man page

WalterK
19th June 2008, 03:39
Thanks for the update info on all three, time for an update of all three been putting it off for months now.

microchip8
23rd June 2008, 13:42
ChangeLog for version 8.4.8
* Disabled the use of unique temporary directories to store temporary
configuration files. This fixes an MP4Box crash on newer systems

microchip8
26th June 2008, 12:09
ChangeLog for version 8.4.9
* Bugfix: don't leave config files upon user interrupt
* Removed reference to the Sonic audio codec in the -sc option as this codec is no longer supported

microchip8
1st July 2008, 00:05
ChangeLog for version 8.5.0
* Added support for using the neroAacEnc AAC audio encoder with LC, HE and HEv2 profiles
* Function renaming: aacplus_audio_func() -> neroaac_audio_func()
* Variable renaming: aacplusbr -> neroaacbr
* Audio codec renaming: AAC+ -> neroAAC

microchip8
3rd July 2008, 14:59
ChangeLog for version 8.5.1
* Added support for using the neroAacEnc AAC audio encoder when using the
portable device presets icvp, ichqvp, ivp, ihqvp, ipvp, iphqvp, avp, ahqvp, nks60vp,
nks60hqvp, pspvp, psphqvp, ps3vp, ps3hqvp, zvp, zhqvp, xvp and xhqvp
* Bugfix: when using the f9 or f9hq preset with the neroAAC audio codec, -oac pcm was
not passed to the MEncoder options
* Changed default unsharp mask / gaussian blur matrix to chroma & luma 5x5 as it provides
a better balance than the 3x3 matrix

microchip8
5th July 2008, 11:57
ChangeLog for version 8.5.2
* Feature request: add the possibility to specify the path to MEncoder.
Useful if the user has two or more versions of MEncoder but wants to use a
specific one for the encoding
* Check to see if destination directory is writable by writing a small file to it.
* Updated the README.h264enc file
* Updated the man page

microchip8
7th July 2008, 21:21
ChangeLog for version 8.5.3
* Feature request: add the possibility to disable MEncoder's A/V sync
algorithm when encoding video files. This can be used to fix input video files with
bad A/V sync in them, however there are no guarantees that this will actually fix the problem
* Added initial support for the TS container. This requires tsMuxeR and MP4Box
(for audio/video dumps). When muxing to the TS container, only the FAAC AAC and
AC3/copy audio codecs are supported. Read the README.h264enc file which provides
more information on where to get tsMuxeR.
* Updated the -sc option, added tsMuxeR to the list
* Enabled back the use of temporary directories based on process ID to store config files
* Fixed a bug in the check_audio_codec_func() function. Variable MENOCDER should be MENCODER
* Updated the requirements part in the README.h264enc file
* Small clean ups
* Updated the man page

blaz
8th July 2008, 21:53
In your latest script:
- Not sure how to specify ac3 pass through for eventually muxing into an mpeg ts stream
- I get the following error message:

-> Utility 'tsMuxeR' or 'MP4Box' is missing!
-> Skipping AVI to TS conversion!

But I can envoke both at the command line. For example:
SmartLabs tsMuxeR. Version 1.7.3(b) http://www.smlabs.net
Usage: (and so on)

microchip8
8th July 2008, 22:06
this is strange as it works here. Are you sure that tsMuxeR is in your path? eg in /usr/local/bin or similar? the script just checks with the "which" command if tsMuxeR and MP4Box are in your path, nothing else

the TS container is only supported with AAC, AC3 or copy of the AC3 stream. I'm adding support for DTS at the moment

talen9
9th July 2008, 00:39
h264enc was reviewed on Linux.com (here (http://www.linux.com/feature/140081)) :)

microchip8
9th July 2008, 11:34
h264enc was reviewed on Linux.com (here (http://www.linux.com/feature/140081)) :)

hehehehe, nice. Didn't expect a review from Linux.com :D

blaz
9th July 2008, 14:41
OK, thanks. I was prepending "~/bin" to the path and exporting that.
Which works in the bash shell, but not with "which" or your script.
But everything works when I prepend the full path (not "~").

As for copying ac3 audio, this is what h264enc is giving me:

-> Scanning for audio streams...

Audio stream: 0 Format: AC3 (5.1) Language: en ID: 128.
Audio stream: 1 Format: AC3 (stereo) Language: en ID: 129.
Audio stream: 2 Format: AC3 (stereo) Language: fr ID: 130.
Audio stream: 3 Format: AC3 (stereo) Language: en ID: 131.

Specify the DVD Audio Stream ID [default is 128]:
Specify the Audio Codec [AAC/neroAAC - default is AAC]:

When I take the dfault (128) there isn't an option to just copy the ac3 over?
I'm using options: -1p -p ps3hqvp

Thanks ...

microchip8
9th July 2008, 14:56
Ah yes, I haven't updated the PS3 profiles yet - try now http://www.mediafire.com/?hyzthemjcj7

microchip8
9th July 2008, 15:47
@ blaz
on a further not, are you sure that the PS3 can handle H.264 TS files? All I could find on the Net was that it can play MPEG2 TS and PS files but not H.264 TS ones

blaz
9th July 2008, 16:30
@ blaz
on a further not, are you sure that the PS3 can handle H.264 TS files? All I could find on the Net was that it can play MPEG2 TS and PS files but not H.264 TS ones

Yes, but only if i first massage the h264 with h264info.
I've got a thread here about it: http://forum.doom9.org/showthread.php?t=137517

I was hoping that your script would include some missing mencoder options that would eliminate that h264info step.

Haven't got that far yet, but that new version does run with ac3 copy and the ps3 options.

Will not be looking at this for another week (gotta travel now), but will get back to you eventually if it works with the PS3.

microchip8
9th July 2008, 16:46
Yes, but only if i first massage the h264 with h264info.
I've got a thread here about it: http://forum.doom9.org/showthread.php?t=137517

I was hoping that your script would include some missing mencoder options that would eliminate that h264info step.

Haven't got that far yet, but that new version does run with ac3 copy and the ps3 options.

Will not be looking at this for another week (gotta travel now), but will get back to you eventually if it works with the PS3.

you think I should add the insertSEI and contSPS option to tsMuxeR when creating TS files for the PS3? Maybe that's what h264info is doing?

blaz
9th July 2008, 22:37
you think I should add the insertSEI and contSPS option to tsMuxeR when creating TS files for the PS3? Maybe that's what h264info is doing?

Wish I knew. Maybe that would be a good place to start?

Anyway, can't help testing until I get back to my PS3 next week.

microchip8
11th July 2008, 10:17
ChangeLog for version 8.5.4
* Added support for DTS, MP3 and MP2 audio for the TS container
* Optimizations to the TS container batch exporting code
* iPod optimizations to the MP4 muxing code
* Enabled neroAAC and Vorbis audio support for the Matroska container
* Updated the audio part of the PS3 presets. Added audio copy support so a
user can just copy the AC3 stream and later on mux it into a TS transport stream.
Note that I'm not sure if the PS3 can play H.264 TS files since the PS3 doc only
mentions MPEG2 TS and PS
* Added tsMuxeR options "insertSEI" and "contSPS" as default when muxing to the TS container
* Small tunings to the ps3vp preset. Made it main profile instead of high profile -> ps3hqvp is already
high profile so no need for ps3vp to also be high profile
* Disabled weight_b for the anime presets. According to Dark Shikari (an x264 developer) it decreases
the effectiveness of multiref while providing no benefit
* Do not ask for FPS conversion or pullup/pulldown if the user forces an output frame rate

nm
11th July 2008, 20:54
* Updated the audio part of the PS3 presets. Added audio copy support so a
user can just copy the AC3 stream and later on mux it into a TS transport stream.
Note that I'm not sure if the PS3 can play H.264 TS files since the PS3 doc only
mentions MPEG2 TS and PS
It can play H.264 in both TS and PS, as far as I know. Transport and Programs Streams are specified in MPEG-2 Part 1 (PS is also in MPEG-1 Systems), so that's why the documentation mentions MPEG-2. They can carry various video formats, including H.264 and VC-1.

microchip8
11th July 2008, 21:03
Thanks for the info. I'm still doing a bit of research here. As I don't have a PS3 myself, I'm basically tapping in the dark and trying to guess which options are good for the PS3 and which break playback on it... :/

blaz
18th July 2008, 16:08
you think I should add the insertSEI and contSPS option to tsMuxeR when creating TS files for the PS3? Maybe that's what h264info is doing?

Well, I'm back and tried the latest h264enc TS options with h264 and AC3. Everything went smoothly, except the PS3 doesn't like the result, as usual.

But if I go back to the raw h264 created, and run it though h264info, and rebox it with the ac3 copy using tsMuxeR, the PS3 plays it fine.

It's something about the h264 files coming out of mencoder that h264info changes. No idea what it is though.

microchip8
18th July 2008, 16:15
well, i have no idea what exactly to change so the PS3 can accept the files. There must be something that h264info is doing that i cannot reproduce here. I can only hope that a future firmware for the PS3 will make it more compatible

blaz
18th July 2008, 23:55
well, i have no idea what exactly to change so the PS3 can accept the files. There must be something that h264info is doing that i cannot reproduce here. I can only hope that a future firmware for the PS3 will make it more compatible

yup. The ps3 is way too picky for my taste. And being proprietary there's nothing you can do about it. Did try booting linux on it, but the linux audio drivers are only 2 channel so no surround sound.

By the way, I see you are running 64 bit linux.
Any idea how much 64 bit speeds up h264 encoding over 32 bit?
Mencoder's is running both cores on my cpu but it's still just a 32bit debian os.

nm
19th July 2008, 08:57
Any idea how much 64 bit speeds up h264 encoding over 32 bit?
About 10%

noblewolf
22nd July 2008, 01:14
Hi Everyone,
First off, the h264enc is awesome. It has helped me save lots of space on my file server. I am having one problem though and I keep getting a segmentation fault. Let me explain what I had to do. A friend of mine came for a visit and brought their camcorder along. I had problems getting to work with linux, so had to use windoze to get the files over. The only program I had was nero vision for the dv input. Since time was an issue, I just captured every tape to its own file. And would edit later. The files were HUGE. I have one for almost 22 gigs for 1.8 hrs of video. The files end in .avi but I believe there is some kind of nero encoding with them, that none of my editing software for linux can use. I get segmentation faults for almost every program I try, and both xine and mplayer can not play the audio. Is there a special script for h264enc to take that file and make it into a format I can edit with linux (i.e. openmovie editor, cinellera, etc.)

My machine specs are as follows:
E6600 (soon to be switched to a Q6600)
8 gigs of ram
500 gigs of HD space.

Any help on where to go from here? I am lost as to even look for a solution.

Thanks

noblewolf
22nd July 2008, 01:15
Silly me, I'm running Suse 10.3 x64 as my OS.

Rasi
16th August 2008, 17:23
Am I right that if i want to have a final mkv with 2 (or 3) audio streams + 2 (or 3) subtitles, i will have to rip those manually, substract their filesize from final size in order to use h264enc?

If so - How can i archieve encoding the audio streams with them having the right delay and all?

microchip8
16th October 2008, 16:44
ChangeLog for version 8.5.5
* Presets updates: most presets have been updated to reflect the recent
changes made to the subme system in libx264. The options 'bime' and 'brdo' have
also been removed as they are no longer available as separate options in libx264.
'bime' is automatically enabled if a preset uses subme >= 5, brdo has been included
into the subme system. Please upgrade your libx264 to the latest version if you
encounter problems when using the presets.
* Updated the 'preset.cfg' preset skeleton file
* Separated the 'normal' deinterlacers from the frame doubling ones
* More optimizations to the TS container code
* Disabled b_pyramid for the PS3 presets. Should increase compatibility with the PS3 a bit more
* Added Vorbis audio support for the OGM container
* denoise3d & hqdn3d: increased default denoising values to 3:2:3:2
* Removed path specification for MEncoder
* Cosmetics & cleanups

microchip8
19th October 2008, 15:00
ChangeLog for version 8.5.6

* Updated the 'preset.cfg' skeleton file. Added support for psy_rd, Psychovisual optimization
* Improved subtitle handling for video file encodings. Now the user can select to hardcode a given
subtitle into the movie or import it into the MP4 and/or MKV container. Only two subtitle formats are
supported and have been tested: VobSub and SRT
* Added support for sample encoding and previewing. When encoding samples, one can specify the
start position and the duration in seconds for the sample. Sample encoding respects encoding passes
meaning if you execute h264enc in two-pass mode and want to encode a sample before the real encoding
starts, then the sample will also be encoded in two-pass mode with all the options and filters selected by
the user. Sample encoding can further be used to encode only specific parts of a video file or a DVD. In
regards to DVDs, sample encoding does not respect selected DVD chapters meaning the given start position
for the sample will overwrite the selected DVD chapter(s). This is a mencoder problem and there's nothing I can do about it.
* Presets update: most presets for portable devices have been renamed. Please read the man page or
execute 'h264enc --help' for more information
* Added two QuickTime presets - qt and qthq
* denoise3d & hqdn3d: implemented weak/medium/strong denoising presets
* Removed quantization parameters for the spp, uspp, fspp and pp7 deblockers
* Updated the crop preview code. Instead of sleeping for 15 seconds and then killing the PID value of mplayer,
use the -endpos option
* Updated the man page

microchip8
24th October 2008, 22:44
Am I right that if i want to have a final mkv with 2 (or 3) audio streams + 2 (or 3) subtitles, i will have to rip those manually, substract their filesize from final size in order to use h264enc?

If so - How can i archieve encoding the audio streams with them having the right delay and all?

Yes, you are right. At the moment, h264enc supports only one audio stream. If you want more, you'll have to add them manually. The same goes for more than one subtitles.

as for the right delay/synchronization, this can be a touch one. mkvmerge has an option to sync tracks (--delay). You may want to try that one. Sorry for late answer.

Rasi
26th October 2008, 08:40
Yes, you are right. At the moment, h264enc supports only one audio stream. If you want more, you'll have to add them manually. The same goes for more than one subtitles.

as for the right delay/synchronization, this can be a touch one. mkvmerge has an option to sync tracks (--delay). You may want to try that one. Sorry for late answer.

hmmm... i have to do it afterwards? *sigh*

I remember all the windows tools added the delay in mp3's filenames, so it was pretty easy to do this...

microchip8
28th October 2008, 15:42
ChangeLog for version 8.5.7

* Improved DVD handling. Now there's a menu where the user can select the
input type: ISO image, VIDEO_TS folder or DVD drive
* Presets updates: updated the b_adapt option. It supports parameters. Also updated
the standard presets to use level 4.1 instead of 5.1 and enabled psy_rd (psychovisual
optimization) for all presets that use subq 6 or higher
* Added two Archos 605 presets (ar and arhq). The presets are directly lifted from AutoMKV
(thanks buzzqw) but are a bit modified to get a somewhat higher quality
* Added two Blackberry 9000 presets (bb and bbhq)
* Added two Blu-ray presets (bd and bdhq). When using these presets, h264enc can create
a Blu-ray disc structure if tsMuxeR is available on the user's system. Latest tsMuxeR version
for Linux is 1.7.3(b) which has a bug when creating a Blu-ray structure. h264enc has a workaround
for this
* Added access unit delimiters (aud) for the PS3, Blu-ray and HW compatible presets
* Set the field order of the tfields filter to auto detection
* Bugfix: when using the presets for the iPod/iPhone, h264enc didn't set the SAR to 1:1 when remuxing
to MP4. Bug was introduced due to renaming of the portable device presets
* Removed AAC object type complexity menu. AAC (FAAC) is best used in low complexity mode
* Small improvement to the TS container code. Always write the FPS value to the meta file when
muxing to TS. Also use mencoder/mplayer instead of MP4Box to extract video and audio
* Added extra strong denoising preset for the denoise3d & hqdn3d filters
* Implemented configuration file support. As of this version, h264enc automatically generates a config
file in its configuration directory. The config file can be used by the user to modify/set the paths to
various programs. This can be useful if the user has multiple executables of the same program(s) but
wants to use a specific one for the job. It can also be used to set the correct path to a program if the
program in question is not located in a standard location and cannot be found by the system. The configuration
file cannot be used to store encoding settings or other parameters! It is only meant for the tools needed for
the correct operation of h264enc. The config file will be generated in /home/user_name/.h264enc/config.
The config file has its own versioning system and will be automatically updated in case something changes
in future versions of h264enc
* Added -r option to reset the config file in case the user has made any changes to it and wants to restore
the original values of the config file
* Updated the man page

microchip8
10th November 2008, 16:26
ChangeLog for version 8.5.8
* Added support for the aacplusenc AAC+ audio encoder from Matteo Croce
* Updated the MP4 & MKV batch exporting and muxing code to support the aacplusenc encoder
* Display elapsed time when encoding samples
* Added NAL HRD to the Blu-ray presets. This requires a patched x264 with the NAL HRD patch.
The patch along with install instructions can be downloaded from http://h264enc.sourceforge.net/download.html
* Added option nal_hrd to the 'preset.cfg' skeleton file
* In some cases it is possible for h264enc to leave its unique temp directory. Find those directories
and remove them if they are 15 or more days old
* Added support for deinterlacing at half frame rate. Useful for interlaced content that's running
at 50 or 59.940 fps (100i/120i)
* Updated the source_fps_func() function
* Removed support for the MP2, WMA and ADPCM audio codecs. No one uses these codecs in
combination with H.264 video
* Removed support for MPEG-2 AAC audio
* Reduced some code duplication in the set_output_filename_func() function by moving path
and extension checking into its own function
* SSIM and PSNR statistics are now enabled by default
* Removed the noise filter. No real use for it
* Updated the audio_resample_func() function
* Updated the check_audio_codec_func() function
* Updated the genconfig_func() function
* Updated the man page
* Updated the README.h264enc file

Rasi
13th November 2008, 11:11
Hmm... i did this:

i dumped the subtitles and audio tracks i wanted and converted audio to vorbis.

I looked how big those files are together and substracted it from 1400
(1400 - 238 = 1162)

I said yes in h264enc when it asked for a certain fileseize and entered "1162"

After muxing the resulting file was 1300MB instead of 1400... is there a bug?

microchip8
13th November 2008, 14:49
Hi Rasi,

Can you please give me the video length of the movie? I'm not really sure why this is happening. h264enc calculates the target filesize when encoding without audio as follows: TARGET_SIZE_IN_MB * 8192 / VIDEO_LENGTH_IN_SEC

The above formula will calculate the bitrate needed for the given target filesize. I have never seen it miss its target filesize.

Rasi
13th November 2008, 15:01
The movie is 01:59:23...

The numbers above were guesses: Here are the real numbers i used:

262 mb for audio/subtitles - resulting in 1138 mb for video.
The lenth of 1:59:23 results in:
1138 * 8192 / 7163 = 1301.4 - which is ~100 MB less.

microchip8
13th November 2008, 15:35
Hi Rasi,

I think you are doing something wrong here, or maybe misinterpreting. h264enc calculates the video bitrate for a target filesize. You give it a target filesize in Megabytes and it gives you a bitrate value which will reach this target filesize.

so in your case, you want 1138 MB (this is your target filesize) * 8192 / 7163 (the movie length in seconds) and h264enc has calculated a video bitrate of 1301 kbps and presented to you so you can keep or change it. If you keep it, the 1301 kbps value will reach the requested 1138 MB filesize. Why? because if you calculate the target filesize from the the video bitrate (1301 kbps in this case) and movie length it comes at about 1137.5 MB, eg

1301 * 7163 / 8192 = 1137.5 MB

below is the formula

VIDEO_BITRATE * MOVIE_LENGTH_IN_SEC / 8192

so in this case, the calculated video bitrate (1301 kbps) by h264enc is correct.

Rasi
13th November 2008, 15:43
Hi Rasi,

I think you are doing something wrong here, or maybe misinterpreting. h264enc calculates the video bitrate for a target filesize. You give it a target filesize in Megabytes and it gives you a bitrate value which will reach this target filesize.

so in your case, you want 1138 MB (this is your target filesize) * 8192 / 7163 (the movie length in seconds) and h264enc has calculated a video bitrate of 1301 kbps and presented to you so you can keep or change it. If you keep it, the 1301 kbps value will reach the requested 1138 MB filesize. Why? because if you calculate the target filesize from the the video bitrate (1301 kbps in this case) and movie length it comes at about 1137.5 MB, eg

1301 * 7163 / 8192 = 1137.5 MB

below is the formula

VIDEO_BITRATE * MOVIE_LENGTH_IN_SEC / 8192

so in this case, the calculated video bitrate (1301 kbps) by h264enc is correct.


I cant check now, since the logs have been deleted, but i simply hit return when it asked me for bitrate (which was prefilled with the calculated one) - iirc

microchip8
13th November 2008, 15:59
Well, I cannot see anything wrong with the way h264enc calculates this (or maybe I'm just retarded at math and need to go to math class). Like I said before, I always get the correct target filesize when I let h264enc do the calculation, whether I encode with or without audio, it doesn't matter.

Rasi
13th November 2008, 23:33
Ok.. i tried it again and i made sure that i tell h264enc to use the 1301 bps.
After adding my audio and subtitles to the movie, the file is still 1.3 GB...


Same with another movie, here i accidently told h264enc to hit 1,4 GB with no sound and no subtitles checked. It told me to use around 1850 bps. I realised that i told h264enc the wrong filesize (since i had to substract my audio files) and calculated the bitrate manually. I told h264enc my new bitrate and the resulting file was AGAIN 1.3 GB

My versions:

x264 0.60.0+891 2ca4593
MEncoder 1.0rc2-4.3.2
h264enc 8.5.4


*edit* actually its not THAT bad. dolphin just says 1.3GB. The actual file size is:

1438024127 bytes which is
1371.4 megabytes

But still this is 28.6 MB off my desired filesize

Rasi
14th November 2008, 01:23
Another try, this time i will let you know what i am doing by providing a shot :)

http://img99.imageshack.us/img99/9426/movielo2.th.png (http://img99.imageshack.us/my.php?image=movielo2.png)http://img99.imageshack.us/images/thpix.gif (http://g.imageshack.us/thpix.php)


In the lower right you see the files that will be added to the final mkv file. As you can see they are 223MB big, which means my final video file has to be 1177MB

This *should* give me a video that is ~1177MB, right? I will update this post tommorow.



*edit* and here is the result, AGAIN, 26MB smaller:

http://img511.imageshack.us/img511/5671/movie2mq4.th.png (http://img511.imageshack.us/my.php?image=movie2mq4.png)http://img511.imageshack.us/images/thpix.gif (http://g.imageshack.us/thpix.php)

microchip8
14th November 2008, 12:13
Hi Rasi,

Yes, I see it. I don't know why this is happening though. I also did a few tests myself yesterday and compared h264enc's calculation method to the one used in Avidemux. For a test sample (without audio) of 299 seconds (00:04:59) and target filesize of 1177 MB, h264enc gave me 32247 kbps while Avidemux gave me 32883 kbps - that's 636 kbps higher than h264enc. I have no idea how Avidemux calculates the values, but if you do 32883 * 299 / 8192 = 1209 MB, which is higher than the requested. If you take h264enc's value and do 32247 * 299 / 8192 = 1176 MB which almost hits the requested filesize. Also keep in mind that if the bitrate is high enough, depending on the movie, the encoder may not need to use the full bitrate thus lowering it which results in smaller filesizes.

I do not know any other formula to calculate the target filesize, besides the one used in h264enc. If you know a better one, please tell me. If you keep getting files which are 20-30 MB smaller than the requested, try compensating for this by providing a target filesize which is 20-30 MB higher than the one you want. Also most people will be happy that their files end up being smaller than intended. In your case it is 26 MB smaller, is that such a huge problem?

Rasi
14th November 2008, 12:24
It's no problem at all.. Mainly i wanted to report a possible bug :)

Plus that i am used to hit exactly the filesize i want from megui :)

microchip8
14th November 2008, 12:27
Will have to look how MeGUI is doing it, if the author provides the source code of course...

microchip8
15th November 2008, 01:07
@ Rasi

been trying all day long with various formulas (my head hurts lol), none of them seems to hit the exact target size. I asked buzzqw (dev of AutoMKV) for his formula and the calculated bitrate comes extremely close to the one in avidemux (within 10-20 kbps). However, even this formula misses the target by 25 MB ( requested size: 1177 MB, got 1152 MB with is 25 MB less than requested). I think you'll have to compensate for that, sorry :/

buzzqw
15th November 2008, 17:13
on h264enc are you encoding to h264 or directly to mp4/mkv ?

also.. mkv/mp4 and have a less overhead then avi (the 24bytes*frames).. you can rise the bitrate * 1.005

good work froggy1!

BHH

microchip8
15th November 2008, 17:18
Hi buzzqw :)

h264enc outputs directly to AVI, then remuxes it to mkv/mp4. I'm still doing some tests here. Will see how it turns out

microchip8
20th November 2008, 16:12
ChangeLog for version 8.5.9
* Rewrote the DVD part of the video_subtitles_func() function. It now supports
dumping two subtitles to disk
* Updated the MP4/MKV muxing code to support importing of two subtitles
* Dramatically simplified the MP4/MKV/OGM batch exporting code. This reduces a
lot of code duplication
* Bugfix in the video_subtitles_func() function for SRT subtitles for video files. Wrong variable used
* When encoding samples, make sure to take care of any subtitles that might have been dumped to disk
* Don't exit if the user provides a floating point value for the Vorbis audio codec. Instead warn
and use the default value.
* New formula to calculate the video bitrate for a target filesize. The previous formula, which was
directly taken from the ripdvd project, incorrectly calculates the bitrate which often results by
missing the target filesize by as much as 30 MB. The new formula also uses floating point precision
and has been tested agains the calculators of MeGUI and Avidemux
* Removed support for me-prepass
* Removed neroAacEnc quality-based encoding mode. It is incompatible with video bitrate calculation
for a target size and I cannot find any info on quality -> average bitrate mappings.
* Updated the HW compatible presets. Changed H.264 Level for the SD presets from 3.1 to 3.0 and
for the HD presets from 4.1 to 4.0. Also updated the vbv_maxrate values according to Level specs
* Restructured the Blu-ray presets. Now there are four different Blu-ray presets available: bd40, bdhq40,
bd41, bdhq41. bd40 is Main profile @ Level 4.0, bdhq40 is High profile @ Level 4.0, bd41 is Main
profile @ Level 4.1 and bdhq41 is High profile @ Level 4.1
* Allow CRF encoding to be used with some device presets (ps3, xbox360, appletv)
* Updated the man page
* Some cleanups

mocham
22nd November 2008, 09:22
froggy,

I kind of talked to you in another thread about mencoder batch GUIs/scripts, and the lack thereof under Linux. Your script is the most useful frontend for mencoder on Linux, but really only friendly to single file jobs. I wanted to ask you if you considered adding any features to make batch encoding with your script more flexible? I was thinking if it could do something like encode all the files located in a specified directory, tell h264enc I want to encode a "directory" of files, go though the y/n options, accept those as the default for all the files to be encoded, resulting file names will just be the original file names with appropriate extensions, then to avoid any problems with duplicate file names or overwriting just put all the encoded files into a "h264enc" sub-directory of the directory that was chosen. Is this a doable feature request with your script? Thanks.

microchip8
22nd November 2008, 14:36
froggy,

I kind of talked to you in another thread about mencoder batch GUIs/scripts, and the lack thereof under Linux. Your script is the most useful frontend for mencoder on Linux, but really only friendly to single file jobs. I wanted to ask you if you considered adding any features to make batch encoding with your script more flexible? I was thinking if it could do something like encode all the files located in a specified directory, tell h264enc I want to encode a "directory" of files, go though the y/n options, accept those as the default for all the files to be encoded, resulting file names will just be the original file names with appropriate extensions, then to avoid any problems with duplicate file names or overwriting just put all the encoded files into a "h264enc" sub-directory of the directory that was chosen. Is this a doable feature request with your script? Thanks.

Hi,

I have no idea if this is doable in the code itself at the moment (I think it may be possible). I will have to look though. BUT you can already do such a thing by modifying the batch file and use a "for loop". For example, you configure one of the files you want to encode. Save the settings to the batch file, open it up and add a loop to so it will look something like this


################### START OF COMMANDS ###################

# Change to dir with video files
cd /path/to/dir/with/video/files

# Make an output dir inside the dir with video files
mkdir -p h264enc

for i in *.avi; do

test -d "/home/microchip" || mkdir -p "/home/microchip"
mkdir -p "/home/microchip/.h264enc/$i"
test -e "/home/microchip/H264-20485.avi" && mv -f "/home/microchip/H264-20485.avi" "/home/microchip/H264-20485.avi.old"

/usr/local/bin/mencoder "$i" -o /dev/null -vf softskip,harddup -oac faac -faacopts mpeg=4:br=110:object=2 -ovc x264 -x264encopts bitrate=1000:me=umh:me_range=24:nodct_decimate:nointerlaced:8x8dct:nofast_pskip:trellis=1:partitions=p8x8,b8x8,i8x8,i4x4:mixed_refs:keyint=250:keyint_min=25:psy_rd=0.5,0.3:frameref=4:bframes=16:b_adapt=1:b_pyramid:weight_b:direct_pred=auto:subq=7:chroma_me:cabac:deblock:level_idc=41:threads=auto:ssim:psnr

/usr/local/bin/mencoder "$i" -o "h264enc/$i" -vf softskip,harddup -oac faac -faacopts mpeg=4:br=110:object=2 -ovc x264 -x264encopts bitrate=1000:me=umh:me_range=24:nodct_decimate:nointerlaced:8x8dct:nofast_pskip:trellis=1:partitions=p8x8,b8x8,i8x8,i4x4:mixed_refs:keyint=250:keyint_min=25:psy_rd=0.5,0.3:frameref=4:bframes=16:b_adapt=1:b_pyramid:weight_b:direct_pred=auto:subq=7:chroma_me:cabac:deblock:level_idc=41:threads=auto:ssim:psnr -passlogfile "/home/microchip/.h264enc/$i/h264.log"

sleep 3

test -e "/home/microchip/H264-20485.mkv" && mv -f "/home/microchip/H264-20485.mkv" "/home/microchip/H264-20485.mkv.old"
/usr/local/bin/mkvmerge "$i" -o "h264enc/$i.mkv"
sleep 3

/usr/local/bin/MP4Box -aviraw video "$i" -out "/home/microchip/.h264enc/$i/h264.h264"
/usr/local/bin/MP4Box -aviraw audio "$i" -out "/home/microchip/.h264enc/$i/aac.raw"
mv -f "/home/microchip/.h264enc/$i/*.raw" "/home/microchip/.h264enc/$i/audio.aac"
test -e "/home/microchip/H264-20485.mp4" && mv -f "/home/microchip/H264-20485.mp4" "/home/microchip/H264-20485.mp4.old"
/usr/local/bin/MP4Box -fps $(/usr/local/bin/mplayer "$i" -identify -nosound -vo null -nocache -frames 1 | grep '^ID_VIDEO_FPS' | tail -1 | awk -F= '{print $2}') -tmp /home/microchip/.h264enc -add "/home/microchip/.h264enc/$i/*.h264" -add "/home/microchip/.h264enc/$i/*.aac" "h264enc/$i.mp4"

sleep 3

rm -rf "/home/microchip/.h264enc/$i"

done

#################### END OF COMMANDS ####################


This is an example of a two-pass encoding with mkv/mp4 remuxing. Everything set in bold is modified/changed to work with a "for loop". The example also assumes that you stick to using a MEncoder audio codec instead of using an external audio encoder like neorAacEnc or oggenc or aacplusenc. It also assumes that all the files you want to encode in the directory are AVI files (though you can add very easily others to the loop too)

The output of each file will be stored in the h264enc directory inside the directory with video files you want to encode. If remuxing to mkv/mp4 the mkv's or mp4's will be named something like file.avi.mkv or file.avi.mp4 so you'll have to remove the .avi extensions yourself

If this is too much, you can always configure one file, save the options to the batch file and post it here. I will modify it for you

Also make sure you have enough disk space if you're also going to remux to mp4/mkv/whatever

The above is just and example and I have not tested it, but it should work

mocham
22nd November 2008, 22:40
This is what I was thinking of, a for loop. I just thought it could be implemented within the script. I'll give this a try. Thanks.

microchip8
22nd November 2008, 22:45
It may be possible to implement this, however I have to look since I deal with a lot of audio codecs and container formats, so it won't be that easy... and I need a little break too, been working on h264enc for the past one and a half week :p

you may also want to try Autox264 from buzzqw, which IIRC has a Queue where you can add jobs

microchip8
23rd November 2008, 15:19
ChangeLog for version 8.6.0
* Bugfix: add the $ofps variable to MEncoder when dumping a second subtitle.
Also enable pcm as audio to maintain sync with the video. A small performance hit but it's worth it
* Added support for dumping one more subtitle. This brings it to a total of 3 subtitles that can be dumped
to disk and imported into the MKV and/or MP4 container
* Dramatically simplified the TS/Blu-ray muxing code
* Implemented initial real batch support for files. As of now, one can encode a bunch of video files in a
directory and automatically remux them to MKV/MP4/OGM. The TS container is not supported yet due
to me being lazy. The user only needs to configure one of the files in a given directory, and all the settings
will apply to the other files as well
* Moved the DVD device detection code into its own function to reduce some code duplication
* Made the encoding priority level global. It now applies to audio/video dumping, audio encoding, subtitles
dumping and container muxing

mocham
25th November 2008, 08:47
ChangeLog for version 8.6.0
* Implemented initial real batch support for files. As of now, one can encode a bunch of video files in a
directory and automatically remux them to MKV/MP4/OGM. The TS container is not supported yet due
to me being lazy. The user only needs to configure one of the files in a given directory, and all the settings
will apply to the other files as well

Cool! Seems to be working on some test files I did. Thanks!

microchip8
25th November 2008, 13:59
ChangeLog for version 8.6.1
* Empty variables cleanups
* Bugfix: the vobsubout3 variable was not tested in the MKV/MP4 muxing code. This leads
to the third subtitle not being imported into these containers
* Added support for TS/Blu-ray muxing when batch encoding files in a directory
* Small improvements for batch encoding of video files in a directory
* New formulas to calculate the video bitrate for a target filesize. The user can choose between
MeGUI's formula, h264enc's refactored MeGUI formula and the old h264enc/ripdvd formula

WalterK
26th November 2008, 01:07
froggy1 just about to try h264enc on a dvd and using the latest version i just ran a sanity check to see if i had everything needed installed this is what i got back

h264enc -sc

-> Checking for 'MPlayer'..................... OK
-> Checking for 'MEncoder'.................... OK
-> H.264 video support in MEncoder............ YES
-> AAC (FAAC) audio support in MEncoder....... YES
-> MP3 (LAME) audio support in MEncoder....... YES
-> AC3 (lavc) audio support in MEncoder....... YES
-> FLAC (lavc) audio support in MEncoder...... YES
-> PCM audio support in MEncoder.............. YES

-> Checking for 'bc'.......................... OK
-> Checking for 'pv'.......................... FAILED! [no support for DVD ISO dumps]
-> Checking for 'dd'.......................... OK
-> Checking for 'neroAacEnc'.................. OK
-> Checking for 'aacplusenc'.................. FAILED! [no support for AAC+ audio]
-> Checking for 'oggenc'...................... OK
-> Checking for 'less'........................ OK
-> Checking for 'lsdvd'....................... FAILED! [no support for DVD title scans]
-> Checking for 'dvdxchap' (from ogmtools).... FAILED! [no support for DVD chapters export]
-> Checking for 'mkvmerge' (from mkvtoolnix).. OK
-> Checking for 'ogmmerge' (from ogmtools).... FAILED! [no support for the OGM container]
-> Checking for 'MP4Box' (from gpac).......... OK
-> Checking for 'tsMuxeR'..................... FAILED! [no support for the TS container]

I know ogmtools is installed version 1.5
I know lsdvd is installed version 0.16

I don't know what pv is and well aacplusenc is not installed.
My distro is ubuntu linux 8.10 all installs from the official repos, no custom compiles.

Edit :

Turns out i needed to reset the configuration file but this time i am missing 'pv' what is that?

microchip8
26th November 2008, 01:28
@ WalterK

h264enc simply checks with the "which" command for the programs it requires. If they are not in a standard PATH it won't find them. You may want to check in a console and see if you get something in return

which lsdvd
which dvdxchap
which ogmmerge

if you get nothing, then these programs are not in a valid PATH so the system won't find them. However, if you're sure they are installed and you know their location, you can set the path to these programs in the config file of h264enc which is located in /home/your_username/.h264enc/config

note the . (point) above, it's a hidden directory. Simply open the config file with a text editor and set the paths to the programs.

pv is "pipeviewer" and you can get it from here: http://h264enc.sourceforge.net/links.html (last link in the list)

WalterK
26th November 2008, 02:00
Ok fixed all that everything is found.
Now i get this error after configuring for the rip then encode.

Would you like to save the MEncoder options to a file? [y/n]: y
Where to store the options? [default is /home/corry/batchfile]: /home/walterk/batchfile_h264dvdrip
Would you like to convert the final encode from AVI to MKV? [y/n]: y
Would you like to convert the final encode from AVI to MP4? [y/n]:
Would you like to convert the final encode from AVI to TS? [y/n]:

-> Starting to encode the DVD in 2-pass mode
-> Using "Extreme High Quality" preset
-> Will use '/dev/null' as output for the first pass
-> Will use '/home/walterk/ts/Exchange_Club.avi' as output file for the second pass

Starting to encode in: 5 4 3 2 1
MEncoder 2:1.0~rc2-0ubuntu17+medibuntu1 (C) 2000-2007 MPlayer Team
CPU: AMD Athlon(tm) 64 X2 Dual Core Processor 6000+ (Family: 15, Model: 107, Stepping: 2)
CPUflags: Type: 15 MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 1
Compiled with runtime CPU detection.
Option x264encopts: Unknown suboption psy_rd
There are 3 titles on this DVD.
There are 22 chapters in this DVD title.
There are 1 angles in this DVD title.
audio stream: 0 format: ac3 (stereo) language: aid: 128.
number of audio channels on disk: 1.
number of subtitles on disk: 0
success: format: 2 data: 0x0 - 0x8e329000
MPEG-PS file format detected.
VIDEO: MPEG2 720x480 (aspect 3) 29.970 fps 7500.0 kbps (937.5 kbyte/s)
[V] filefmt:2 fourcc:0x10000002 size:720x480 fps:29.97 ftime:=0.0334
==========================================================================
Opening audio decoder: [liba52] AC3 decoding with liba52
Using SSE optimized IMDCT transform
Using MMX optimized resampler
AUDIO: 48000 Hz, 2 ch, s16le, 224.0 kbit/14.58% (ratio: 28000->192000)
Selected audio codec: [a52] afm: liba52 (AC3-liba52)
==========================================================================
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
Opening video filter: [harddup]
Opening video filter: [softskip]
==========================================================================
Opening video decoder: [mpegpes] MPEG 1/2 Video passthrough
VDec: vo config request - 720 x 480 (preferred colorspace: Mpeg PES)
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
The selected video_out device is incompatible with this codec.
Try appending the scale filter to your filter list,
e.g. -vf spp,scale instead of -vf spp.
VDecoder init failed :(
Opening video decoder: [libmpeg2] MPEG 1/2 Video decoder libmpeg2-v0.4.0b
Selected video codec: [mpeg12] vfm: libmpeg2 (MPEG-1 or 2 (libmpeg2))
==========================================================================
VDec: vo config request - 720 x 480 (preferred colorspace: Planar YV12)
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
[swscaler @ 0x883f410]SwScaler: using unscaled yuv420p -> yuv420p special converter
FATAL: Cannot initialize video driver.

Exiting...
-> MEncoder has exited with a none-zero value!
-> Exiting in function: mencoder_exit()
I see an X264 error (unknown option psy_rd) and a video error, must be how its trying to rip the dvd disc , so i will first rip to my hd and as an ISO, get the latest svn X264 and compile (its been a while since an update) and see if theres any more troubles with the encode.

microchip8
26th November 2008, 02:03
Please upgrade your x264 library to a more recent version. h264enc uses psy_rd is almost all of its presets. Your x264 is too old and that's why it halts mencoder. You can get the latest x264 from git

git clone git://git.videolan.org/x264.git

PS: I see you have saved the options to a batch file, so you don't need to configure anything anymore. After you're done with x264, just load the batch file with h264enc -b /home/corry/batchfile_h264dvdrip

WalterK
26th November 2008, 03:30
Well now the x264 error is gone and now it seems a colorspace error

MEncoder 2:1.0~rc2-0ubuntu17+medibuntu1 (C) 2000-2007 MPlayer Team
CPU: AMD Athlon(tm) 64 X2 Dual Core Processor 6000+ (Family: 15, Model: 107, Stepping: 2)
CPUflags: Type: 15 MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 1
Compiled with runtime CPU detection.
There are 3 titles on this DVD.
There are 22 chapters in this DVD title.
There are 1 angles in this DVD title.
audio stream: 0 format: ac3 (stereo) language: aid: 128.
number of audio channels on disk: 1.
number of subtitles on disk: 0
success: format: 2 data: 0x0 - 0x8e329000
MPEG-PS file format detected.
VIDEO: MPEG2 720x480 (aspect 3) 29.970 fps 7500.0 kbps (937.5 kbyte/s)
[V] filefmt:2 fourcc:0x10000002 size:720x480 fps:29.97 ftime:=0.0334
Input fps will be interpreted as 29.97 instead.
==========================================================================
Opening audio decoder: [liba52] AC3 decoding with liba52
AUDIO: 48000 Hz, 2 ch, s16le, 224.0 kbit/14.58% (ratio: 28000->192000)
Selected audio codec: [a52] afm: liba52 (AC3-liba52)
==========================================================================
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
Opening video filter: [harddup]
Opening video filter: [softskip]
Opening video filter: [pullup]
==========================================================================
Opening video decoder: [mpegpes] MPEG 1/2 Video passthrough
VDec: vo config request - 720 x 480 (preferred colorspace: Mpeg PES)
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
VDecoder init failed :(
Opening video decoder: [libmpeg2] MPEG 1/2 Video decoder libmpeg2-v0.4.0b
Selected video codec: [mpeg12] vfm: libmpeg2 (MPEG-1 or 2 (libmpeg2))
==========================================================================
VDec: vo config request - 720 x 480 (preferred colorspace: Planar YV12)
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.

Exiting...
-> MEncoder has exited with a none-zero value!
-> Exiting in function: mencoder_exit()


So i'll be trying with the svn version of mplayer/mencoder to see whats up.

microchip8
26th November 2008, 13:02
configure everything, save to batchfile and upload it to pastebin or here so i can see what's going on

WalterK
26th November 2008, 14:16
Well i compiled the latest svn mplayer and the colorspace error is no longer an issue now its encoding to X264 MKV.
So i guess it was the standard medibuntu version of mencoder that was the problem.

mocham
29th November 2008, 09:19
froggy1,

I just used vers 8.6.1 to batch convert a directory with 93 MPEG2-TS files to MP4's, your script worked great! Exactly what I was looking for! Thanks.

microchip8
29th November 2008, 14:18
mocham,

Glad you like it and it works for you. I've significantly improved the directory encoding code. I'll release a new version tonight, then up to the next challenge (if only I can get this thing to work)

WalterK
29th November 2008, 17:19
Your script works great froggy1 but i think you should make a special note for ubuntu users that they need to update three of the dependencies before use.
Specifically X264, mencoder and mkvtoolsnix, if they decide to create files in the mkv container.
The versions in the ubuntu repos are too old even on 8.10.
At least thats what i found.

microchip8
29th November 2008, 17:28
@ WalterK,

I really don't care for Ubuntu and its issues. Packagers who package ancient and outdated software (mplayer 1.0rc2, mkvtoolnix 2.0.0, etc) are morons in my eyes. Though I will update the h264enc Web site and add version information to the Links page

microchip8
29th November 2008, 18:28
ChangeLog for version 8.6.2
* Replaced the -fq option by -qp and -crf for consistency with x264
* Replaced --help with -help for consistency with the other options
* Added support for importing up to three subtitles (VobSub or SRT) into the MKV/MP4
containers when encoding a video file or a directory with files. Also hardcoding a subtitle
is now possible for directory encodings
* Lots of empty variables and code cleanups
* Reduced a lot of code duplication in the batch exporting code by using only one variable
to carry the output file
* Optimized the MKV/MP4/OGM/TS/Blu-ray muxing code for directory encodings
* Simplified the MKV/MP4 subtitles importing code. The new code is a bit ugly, but is much
smaller and works quite well. It's basically a small loop which tests the subtitle variables for
not being empty, and if so, it appends the values to the MKVSUBS/MP4SUBS variables
* When encoding to neroAAC/AAC+/Vorbis audio and muxing to MKV, take the video directry
from the AVI file instead of dumping it to disk. That way we can skip the dumping process and
don't have to pass the FPS value of the raw video to mkvmerge since it takes it directly from
the AVI. This also makes the code a bit more simple. When also muxing to MP4, MP4Box always
dumps the video so we're safe here. Same thing for the TS container
* Added support for detecting the audio codec of the video file/DVD when using audio stream copy.
Based on the detected audio codec, decision is made if we allow or disallow muxing to MKV/MP4/TS/OGM
* Updated the man page

* Also today is h264enc's second public anniversary. On the 29th of November 2006, I released the
first version (version 1.5) on SourceForge. Since then, h264enc has developed from a primitive and
limited shell script to something more mature. When I looked back at the old code of version 1.5, I
really had to laugh and wonder at the same time. I did a lot of stupid things back then

buzzqw
1st December 2008, 11:53
fist of all this is a great (and professional) script!
what i would like is more simple "start"
on launch i have to specify too much parameters
just write "h264enc inputfile"
and then ask about parameters/preset/pass

also.. a "live update" options could be handy :D

thanks!

BHH

microchip8
1st December 2008, 11:57
fist of all this is a great (and professional) script!
what i would like is more simple "start"
on launch i have to specify too much parameters
just write "h264enc inputfile"
and then ask about parameters/preset/pass

also.. a "live update" options could be handy :D

thanks!

BHH

Hi, buzzqw

This is not possible due to the way the script is written. And what do you mean by "too much parameters"? Is is so difficult or annoying to do, for example, h264enc -crf -p vhq

I don't know if "live" update will be possible

buzzqw
1st December 2008, 12:06
one more (sorry to bother)

on launch of h264enc (and your other scripts), don't write simply (example)

Usage: divxenc [-1p|-2p|-3p|-fq|-b|-sc|-scan|-sv|-iso|-bpp|-bpb|-v|--help] [-p <preset>]

but a little more detailed usage (not the full man) that give the first input how concatenate the options
and write some example of command line (with specification/information)

:helpful:

BHH

EDIT: about update
put in your site a "version.txt", write here the last version
allow your script to download the file, parse it, check the version, offer to download

microchip8
1st December 2008, 12:17
one more (sorry to bother)

on launch of h264enc (and your other scripts), don't write simply (example)



but a little more detailed usage (not the full man) that give the first input how concatenate the options
and write some example of command line (with specification/information)

This is a standard way for almost every command line UNIX/Linux application. If you call a program without parameters, it displays its basic options/how to use it. I can reduce it a bit though so if one just writes h264enc without parameters, it will just print "No options specified, use: h264enc -help for info" or something like that, or maybe I can change it display:

h264enc <options>
Use -help for more information


EDIT: about update
put in your site a "version.txt", write here the last version
allow your script to download the file, parse it, check the version, offer to download

I can make it write a small version file in its config dir then compare the version of that file to the version available on sourceforge, then display information if new version is available. I'll see how to do it in another release

buzzqw
1st December 2008, 13:09
i don't understud why you could give a little more "help" if script is launched without arguments

anyway.. thanks for your attention :)

BHH

microchip8
1st December 2008, 13:14
i don't understud why you could give a little more "help" if script is launched without arguments

anyway.. thanks for your attention :)

BHH

Why would I want to do that? :) All the help, WITH preset usage examples, is available through the -help option. I don't want to write stuff twice, once when the script is called without parameters and then when the user uses -help

If the explanation is not clear enough to someone when using -help, then that one should either go fix his brain, or stop using computers at all :D :P

buzzqw
1st December 2008, 13:55
If the explanation is not clear enough to someone when using -help, then that one should either go fix his brain, or stop using computers at all :D :P

that's for sure! :p (or stop using command line interface...)

BHH

microchip8
1st December 2008, 13:57
that's for sure! :p (or stop using command line interface...)

BHH

Yes, that too :D :sly:

yeye69
1st December 2008, 18:15
I have error "segmentation fault" in second pass, after updating system from Fedora 9 to Fedora 10. I tried to encode with mencoder from distro (dev-SVN-r27514-4.3.2 - rpmfusion) and latest from svn ( dev-SVN-r28054-4.3.2) - the same result. I'm using the scripts elaborated by h264enc, versions 8.5.x and 8.6.2, 2-pass encoding with preset hdh(by the way, in old version of preset the idc level is 41, in new one - 40). On F9 everything was ok. What's wrong now? Which options in mencoder caused this error?

Old script (second pass):
/usr/bin/mencoder -demuxer lavf -ss 00:15:01 -endpos 20 "file.m2ts" -o "file-aaa.avi" -passlogfile /home/min/.h264enc/h264enc_32690/h264.log -ofps 25 -vf softskip,harddup -aspect 1.7778 -aid 3 -af volnorm=2 -srate 44100 -channels 6 -oac faac -faacopts mpeg=4:br=110:object=2:tns -ovc x264 -x264encopts pass=2:bitrate=5000:me=umh:me_range=24:nodct_decimate:nointerlaced:8x8dct:nofast_pskip:trellis=1:partitions=p8x8,b8x8,i8x8,i4x4:mixed_refs:keyint=250:keyint_min=25:frameref=3:bframes=3:b_adapt:nob_pyramid:weight_b:direct_pred=auto:subq=7:chroma_me:cabac:deblock:nossim:nopsnr:vbv_maxrate=25000:vbv_bufsize=14475:level_idc=41:threads=auto

New script:
/usr/local/bin/mencoder "file.m2ts" -o "01122008-1.avi" -vf softskip,harddup -aspect 1.7778 -aid 4354 -channels 6 -oac copy -ovc x264 -x264encopts pass=2:bitrate=7000:me=umh:me_range=24:nodct_decimate:nointerlaced:8x8dct:nofast_pskip:trellis=1:partitions=p8x8,b8x8,i8x8,i4x4:mixed_refs:keyint=240:keyint_min=24:psy_rd=0.5,0.3:frameref=3:bframes=3:b_adapt=1:nob_pyramid:weight_b:direct_pred=auto:subq=7:chroma_me:cabac:deblock:vbv_maxrate=25000:vbv_bufsize=14475:aud:level_idc=40:threads=auto:ssim:psnr -passlogfile /home/min/.h264enc/h264enc_15973/h264.log

microchip8
1st December 2008, 19:03
Hi,

try updating x264 to the latest Git version. I don't see anything wrong with the options and the hd presets work here with mencoder so there must be something wrong with either your mencoder or x264

buzzqw
1st December 2008, 20:20
one more request : why i have to specify BOTH width and height, when you already know the aspect reatio (and crop values) ?

ask me only width and compute the height (or ask for both, but let an option to automatically compute height)

BHH

microchip8
2nd December 2008, 00:20
one more request : why i have to specify BOTH width and height, when you already know the aspect reatio (and crop values) ?

ask me only width and compute the height (or ask for both, but let an option to automatically compute height)

BHH

yeah, i'm lazy to fix it, though you can already let mencoder compute that for you. If you provide something like 720:-2 or 720:-3 mencoder will scale the height accordingly

EDIT: @ All

as of now, I'll be posting the changelog info by modifying the first post and placing it there

buzzqw
2nd December 2008, 08:25
720:-2 or 720:-3
sorry , already tryed. you application throw an error when parsing values...

BHH

microchip8
2nd December 2008, 09:50
sorry , already tryed. you application throw an error when parsing values...

BHH

Huh? I just tried it. I used when asking for resolution 720x-2 and it works. The second time, I used 720:-2 and while it throws error while computing the BPP/BPB values, it works fine too. MEncoder goes on to encode the content in both cases using a resolution of 720x406

buzzqw
2nd December 2008, 10:31
I used 720:-2
me too, i will use "720x-2"

thanks

BHH

yeye69
2nd December 2008, 11:17
after removing x264-devel distro package and recompiling x264-git library and recompiling mplayer/mencoder, it work. It's strange because on F9 x264 oldest than on F10 one. It seems to be buggy mencoder or x264 library

microchip8
2nd December 2008, 11:22
@ yeye69

Glad it works. I don't know why you get such problems with the packaged x264 from Fedora. There must be something wrong with it. That's why I always recommend to use a self-compile x264 and mencoder from SVN

buzzqw
2nd December 2008, 11:36
i am using Fedora 10 64bit and got no problem compiling ffmpeg/mplayer/mencode/x264

just for info

EDIT: i have that on bad path of input file (input file not found) the program exit...

BHH

microchip8
2nd December 2008, 11:39
i am using Fedora 10 64bit and got no problem compiling ffmpeg/mplayer/mencode/x264

just for info

BHH

buzzqw,

yes it shouldn't be a problem compiling it. The problem of yeye was with the packaged x264 of Fedora. Maybe it is outdated and crashes mencoder for some reason. Or maybe there was a problem with the packaged mencoder for Fedora

buzzqw
2nd December 2008, 11:45
just tryed "656x-2" and in batch file got
"scale=656:-2:0:0"

with a mencoder error..

BHH

microchip8
2nd December 2008, 11:51
just tryed "656x-2" and in batch file got
"scale=656:-2:0:0"

with a mencoder error..

BHH

I have no problem with that, I just tired it and it works here. Here's a snippet of the filter settings from my batch file

-vf softskip,scale=656:-2:0:0,harddup

mencoder encodes at 656x370

Henrikx
2nd December 2008, 12:08
Maybe it is outdated and crashes mencoder for some reason.
....configured with shared ?

x264 :
./configure --enable-shared --enable-mp4-output --enable-pthread --enable-visualize

Mplayer/mencoder

No configuration for --enable-x264 , only --disable-x264,--disable-x264-lavc .

(./configure --help)
Configuration Mplayer/mencoder works automatically for x264, if x264 is configured with shared.

proper sequence..
1.Configure/compile/install Gpac
2.Configure/compile/install x264
3.Configure/compile/install ffmpeg
4.Configure/compile/install mplayer/mencoder

buzzqw
2nd December 2008, 13:14
I have no problem with that, I just tired it and it works here. Here's a snippet of the filter settings from my batch file

maybe due to ssh, i am in putty connection.. and got a "Fatal: cannot inizialize video driver"

i will try at home

BHH

yeye69
2nd December 2008, 14:02
....configured with shared ?

x264 :
./configure --enable-shared --enable-mp4-output --enable-pthread --enable-visualize

Mplayer/mencoder

No configuration for --enable-x264 , only --disable-x264,--disable-x264-lavc .

(./configure --help)
Configuration Mplayer/mencoder works automatically for x264, if x264 is configured with shared.

proper sequence..
1.Configure/compile/install Gpac
2.Configure/compile/install x264
3.Configure/compile/install ffmpeg
4.Configure/compile/install mplayer/mencoder

Yes, x264 configured with shared. Mencoder configured with --disable-x264-lavc, nothing else.

But I'm confused with your:

3.Configure/compile/install ffmpeg

- for what reason in this sequence?

Henrikx
2nd December 2008, 14:35
reason = up to date svn Version, with up to date x264

svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk

Example: (Debian Lenny)
./configure --enable-gpl --prefix=/usr --libdir=/usr/lib --enable-shared --enable-x11grab --enable-pthreads --enable-libdc1394 --enable-libfaac --enable-libfaad --enable-libgsm --enable-libmp3lame --enable-libvorbis --enable-libtheora --enable-libxvid --enable-libx264 --enable-nonfree --enable-muxer=matroska --enable-muxer=mp4

ffmpeg uses x264
Mplayer uses ffmpeg


cd /svn_mplayer
./configure

Checking for FFmpeg libavutil ... yes (static)
Checking for FFmpeg libavcodec ... yes (static)
Checking for FFmpeg libavformat ... yes (static)
Checking for FFmpeg libpostproc ... yes (static)
Checking for FFmpeg libswscale ... yes (static)
Checking for libamr narrowband ... yes
Checking for x264 ... yes (in libavcodec: yes)

yeye69
2nd December 2008, 14:42
ffmpeg uses x264
Mplayer uses ffmpeg


cd /svn_mplayer
./configure


Checking for x264 ... yes (in libavcodec: yes)

Maybe I'm wrong but mplayer uses ffmpeg via libavcodec, last one is in mplayer's tree? So, no need to compile the external ffmpeg to get working x264 in mplayer/mencoder.

Rasi
2nd December 2008, 15:26
Some people like their ffmpeg setup to be non-internal, so other apps can use it too :)

buzzqw
2nd December 2008, 19:16
found my issue: you use the /usr/bin/mencoder
i compile to /usr/local/bin

and the mencoder build (in /usr/bin) is outdated...

BHH

microchip8
2nd December 2008, 19:21
found my issue: you use the /usr/bin/mencoder
i compile to /usr/local/bin

and the mencoder build (in /usr/bin) is outdated...

BHH

I don't use anything. I let the "which" command find where mencoder is stored on a user's system. You can change the paths in the config file of h264enc, which is in /home/username/.h264enc/config

buzzqw
2nd December 2008, 20:12
you misurestud me

i don't want to blame your application :)

just to point a possible issue for users

BHH

microchip8
2nd December 2008, 20:26
you misurestud me

i don't want to blame your application :)

just to point a possible issue for users

BHH

ah yes, and that's the purpose of the config file, if you read the text at the top of it, you'll know what it's used for. So you can manually set paths to a program in case you have multiple versions but want to use a specific one :)

buzzqw
2nd December 2008, 20:40
already done! thanks

BHH

Henrikx
2nd December 2008, 20:56
@froggy1
Good News!!!
h264enc is available via debian multimedia.org :):cool:
http://debian-multimedia.org/dists/testing/main/binary-i386/package/h264enc.php

microchip8
2nd December 2008, 22:47
@froggy1
Good News!!!
h264enc is available via debian multimedia.org :):cool:
http://debian-multimedia.org/dists/testing/main/binary-i386/package/h264enc.php

I already know that but it seems the maintainer doesn't update it that much, 8.5.4 is pretty old :/

buzzqw
3rd December 2008, 08:55
(live update!!!)

BHH

microchip8
3rd December 2008, 13:09
ChangeLog for version 8.6.3
* Small bugfix: IVTC/Telecine was still asked if user has selected to do FPS conversion using
frame duplication (25 -> 50 fps, 50 -> 100 fps). This is due to wrong variable being tested: $fpsfilter instead of $frc
* Use MEncoder to dump the video when remuxing to MP4 as MP4Box can crap out in certain cases.
I'm tired of fixing MP4Box' problems :/ but the alternative (mp4creator) is a piece of crap too and is no
longer maintained. It doesn't support VobSub subtitles either, nor chapter files AFAIK
* Made the Insane High Quality (IHQ) preset more insane. The IHQ preset is my baby so it gets very
special treatment, haha! Increased frameref from 8 to 16, increased me_range from 64 to 128, enabled
all partitions instead of using only p8x8,b8x8,i8x8,i4x4 and set trellis to 2. I hope the Japs are happy now :D
* Added support for providing a custom factor value when using the video bitrate calculation formulas
* Added initial support for a second audio track for DVD encodings. Below is a list of what currently
works and what doesn't:
* PCM audio is not supported yet. It's not a priority for me
* If you're looking for second audio track in AVI, don't waste your time. I will never support it.
Use the MKV/MP4/TS/OGM containers
* Audio filters are supported for both tracks
* Audio codecs and audio filters apply to both tracks. One can't
use, for example, Vorbis audio for first and AAC audio for second
track. One also can't set audio bitrate independently for each track
* Audio stream copy is supported by the MKV/TS/OGM containers. For the MKV/TS containers
one can copy AC3 + AC3 or AC3 + DTS audio. For OGM only AC3 + AC3 is supported since it
knows nothing about DTS audio. If DTS audio is selected, it will be ignored
* I use (very?) dirty tricks to maintain A/V sync when one uses frame
altering video filters, like bobbing, interlacing, ivtc/telecine,
FPS conversion
* Updated the video bitrate calculation code to support a second audio track
* Updated the MKV/MP4/TS/OGM containers code to support a second audio track
* Better explanation about what the -r option does/is used for
* Implemented audio_exit_func() function. This function kicks in effect if the audio encoding with an
external audio encoder didn't succeed. If this is the case, the function will be called with the appropriate
parameters and will force an exit to prevent container conversion. This is because if the audio encoding
fails for some reason, container conversion will automatically fail too since the muxing programs will complain
about the missing audio file and will exit, thus there is no point in continuing and displaying conversion failing messages
* Reduced the amount of options displayed when one calls the script without any parameters. From now on it will just display:
Usage: h264enc <options>
Use 'h264enc -help' for more information
* Better wording in the preset.cfg skeleton file
* Some old comments cleanups
* Updated the man page

yeye69
3rd December 2008, 15:12
Nice work, thanks!

Since nvidia included the support of hardware decoding by videocard in his recent drivers, what do you think about a presets like in megui (dxva presets)? They quite similar to hdh preset in your script.

For examples:

dxva_hd_hq=" --level 4.1 --ref 4 --mixed-refs --bframes 3 --b-adapt 2 --weightb --direct auto --filter -1:-1 --subme 7 \
--trellis 2 --partitions p8x8,b8x8,i4x4,i8x8 --8x8dct --vbv-bufsize 50000 --vbv-maxrate 50000 --me umh --threads auto --thread-input --progress --no-psnr \
--no-ssim"

dxva_hd_eq=" --level 4.1 --ref 4 --mixed-refs --bframes 3 --b-adapt 2 --weightb --direct auto --filter -1:-1 --subme 8 \
--trellis 2 --partitions p8x8,b8x8,i4x4,i8x8 --8x8dct --vbv-bufsize 50000 --vbv-maxrate 50000 --me umh --threads auto --progress \
--no-psnr --no-ssim"

dxva_hd_insane=" --level 4.1 --ref 4 --mixed-refs --no-fast-pskip --bframes 3 --b-adapt 2 --weightb --direct auto --filter -1:-1 --subme 9 \
--trellis 2 --partitions p8x8,b8x8,i4x4,i8x8 --8x8dct --vbv-bufsize 50000 --vbv-maxrate 50000 --me tesa --merange 32 --threads auto --progress \
--no-dct-decimate --no-psnr --no-ssim"

microchip8
3rd December 2008, 15:38
@ yeye69

Will be added in next release. Thanks for the options since I don't have Windows and can't run MeGUI to see the options used

yeye69
5th December 2008, 08:52
Playing with your hdh, hq and vhq presets for hardware decoding by a videocard showed that the files encoded with:
1. hdh preset's options - ok.
2. hq and vhq presets's options - some twitching, like previous frame(s) repeated again. In these options there is "b_pyramid", switching last one to "nob_pyramid" showed smooth playing of file(s). By the way, the discussion about this problem hidden somewhere in "x264 Known Hardware accelleration problems and solutions" - http://forum.doom9.org/showthread.php?t=132924.

microchip8
5th December 2008, 10:13
@ yeye69

yes, I know about the b_pyramid problems on hardware. It is disabled in the new VDPAU/DXVA presets that I'm adding :)

Rasi
5th December 2008, 10:13
oh.. i missed the release date.. i guess its time to do a test tonight :)

microchip8
5th December 2008, 11:03
ChangeLog for version 8.6.4
* Request from yeye69: add three VDPAU/DXVA presets (vdhq, vdehq and vdihq)
* Changed b_adapt=1 to b_adapt=2 for all presets that use 6 b-frames or less
* Improved dealing with LPCM audio on DVDs. If the user has selected to encode a second audio
track and that track uses LPCM as audio, the encoding will fail since -oac copy will not be able to
copy LPCM in AVI. For this reason, h264enc will check to see if the second audio track is LPCM
audio and will use -oac pcm instead of -oac copy
* DVD channels settings can be now independently controlled for each audio track
* Added support for AC3 in MP4. This requires latest gpac version 0.4.5 compiled with liba52 support!
* Disabled AQ for the anime presets
* Updated the man page

yeye69
5th December 2008, 13:52
At the same time:

http://www.nvnews.net/vbulletin/showthread.php?t=123095&page=16

Stephen Warren:
Good news: The next driver release will fix the H.264 reference frame limits. We will support level 4.1 (or very close to it) in all cases[1]. The decision of how many reference frames to actually allocate is up to the client application (a minor VDPAU API change). We'll naturally release updated MPlayer patches to go with this change.

[1] Some very unusual resolutions on some subset of GPUs will end up supporting 1 less reference frame than full 4.1 conformance requires. In practice, you're quite unlikely to spot this limitation in the field. Fixing this will take some more work, although it may happen eventually.

microchip8
5th December 2008, 14:03
heh, so basically the new VDPAU/DXVA presets I added are useless, since the hdh preset is already compatible with VDPAU/DXVA... oh well :/

yeye69
5th December 2008, 14:23
heh, so basically the new VDPAU/DXVA presets I added are useless, since the hdh preset is already compatible with VDPAU/DXVA... oh well :/

Of course, I tested it and writed about 2 post before :). But in hdh-preset subme=6, in dxva-presets 7 and more...

microchip8
5th December 2008, 14:31
Of course, I tested it and writed about 2 post before :). But in hdh-preset subme=6, in dxva-presets 7 and more...

hdh uses subq=7 :)

the differences between hdh and vdhq for example, are that hdh uses lower maxrates/buffer sizes, lower level and less framerefs. This should be more compatible with stand-alone HW players

yeye69
5th December 2008, 14:53
Sorry, it's my fault. However, will try and use all of them. :)

Rasi
6th December 2008, 02:37
Enabled optional drivers:
Input: ftp pvr tv-teletext tv-v4l2 tv-v4l tv cddb cdda libdvdcss(internal) dvdread(internal) vcd dvb smb network
Codecs: x264 xvid libdv libavcodec qtx real xanim win32 faad2 faac musepack libdca libmpeg2 liba52(internal) mp3lib libtheora speex tremor(internal) libmad liblzo gif


but still h264enc says:

[carnager@freebox mplayer-nogui-svn]$ h264enc -2p -p vhq
-> Checking for libx264 support in MEncoder... FAILED!

microchip8
6th December 2008, 11:47
Do you have two mencoder versions on your system? One with and one without x264 support? if so, either remove the one without x264 support, or modify the config file of h264enc and set the correct path to the mencoder version with x264 support. The config is in /home/username/.h264enc/config

also have a look at the -r option.

microchip8
6th December 2008, 12:07
ChangeLog for version 8.6.5
* Huge bugfix to the audio part of the portable device presets. Variable audiocodec2 was
missing resulting in the second audio track being ignored. Everyone who uses these presets
and wants a second audio track should upgrade ASAP
* Offer nosound audio option for the portable device presets
* Don't exit if the user has not added the .avi extension for the output file. Instead automatically add the extension to it

Rasi
6th December 2008, 17:15
Do you have two mencoder versions on your system? One with and one without x264 support? if so, either remove the one without x264 support, or modify the config file of h264enc and set the correct path to the mencoder version with x264 support. The config is in /home/username/.h264enc/config

also have a look at the -r option.

No.. only one mplayer installed... freshly from svn with x264 from svn too...

Resetting the config file didnt help

microchip8
6th December 2008, 17:18
what does mencoder -ovc help say? do you see x264 in there? I'm surprised that it doesn't find it since this code in h264enc hasn't been touched in a year and works without a problem here

microchip8
12th December 2008, 12:38
ChangeLog for version 8.6.6
* Added support for the software equalizer video filter (eq2)
* Removed signal SIGTSTP from the trap list. The user can now suspend the encoding process
with CTRL+Z and continue later on by typing fg in the terminal
* Small loop modifications in the video_subtitles_func() function
* Set default AAC profile when using neroAacEnc to LC instead of HE
* Added support for VCD/SVCD encodings. Yeah, yeah (S)VCD is crap and old but nevertheless
I'll support it. It's a small change to the codebase of h264enc anyways
* Add option -ipod to the MP4Box muxing parameters. This removes the need of running MP4Box
again after muxing just to rewrite the file for the iPod/iPhone
* Added a condition to check if MP4Box is compiled with the PSP patch and if so, the -psp option will
be added to the parameters when using the Sony PSP presets. The PSP patch along with install instructions
can be downloaded from h264enc's site at http://h264enc.sourceforge.net/download.html
* Small loop modifications to the get_dvd_devices_func() function
* Small modifications to the install script
* Updated the man page

Selur
15th December 2008, 15:14
Just tested some of the deinterlacer methods used in h264enc, namely the onces with yadif and mcdeint.
Problem is they all crash for me when mcdeint is not set to 0 (fast) can anyone confirm this, or is this just a problem with the mplayer/mencoder builds I use? (happens for me on windows&linux)

microchip8
15th December 2008, 15:17
Just tested some of the deinterlacer methods used in h264enc, namely the onces with yadif and mcdeint.
Problem is they all crash for me when mcdeint is not set to 0 (fast) can anyone confirm this, or is this just a problem with the mplayer/mencoder builds I use?

Yes, I can confirm that. Problem is with MEncoder. mcdeint uses some of the Snow codec code to do iterative searches and as we all know, Snow is not finished yet so you get a high chance of mcdeint crashing when you use with values > 0

EDIT: just tested mcdeint=0, mcdeint=1, mcdeint=2 and mcdeint=3 they all work here. I had crashes with values > 0 some time ago though

kozaki
1st January 2009, 20:04
@ froggy1, am so glad to discover h264enc :D Finally I find a powerfull script that promise much more fun than copy/paste and mencoder profiles (using mplayer/mencoder since 2001) :D

But am still frustrated as my configuration looks incomplete yet.
Would someone be able to help me check this pliz ?

Dependancies look OK : h264enc -sc shows everything's OK/YES but aacplusenc.

Launched h264enc to transcode a DVD ISO chapter with "-2p -p anihq" and then going on without any fancy (no crop, no subtitles, ..)

There I hit the same error than WalterK 3 pages up (http://forum.doom9.org/showpost.php?p=1217216&postcount=143) with Option x264encopts: Unknown suboption psy_rd

Might be due to old software versions or to a uncleaned system before.
Installed latest x264-snapshot-20081231-2245, but that did not help.
I might as well have forgotten to clean the system before installing it.

system is a Mandriva 2009 x86_64 with "contrib" and "backports" repos
softwares :
- mencoder/mplayer-1.0-1.rc2.18.1plf2009.0
- x264-snapshot-20081231-2245 (sources)
- rpm -qa | grep 264
lib64x264_65-0.65.2245-1plf2009.1
lib64x264_59-0.59.2245-1plf2009.0
- updatedb && locate x264 | grep /usr
/usr/lib64/libx264.so.59
/usr/lib64/libx264.so.65
/usr/lib64/vlc/codec/libx264_plugin.so
/usr/local/bin/x264
/usr/local/include/x264.h
/usr/local/lib/libx264.a
/usr/local/lib/libx264.so
/usr/local/lib/libx264.so.65
/usr/local/lib/pkgconfig/x264.pc
- gpac-0.4.4-0.rc2.1plf2009.0
- tsMuxeR_1.7.3 (sources)

microchip8
1st January 2009, 20:11
@ kozaki

I think your mencoder is still linked to the older libx264 library, even though you have the new one installed. What you do in this case is remove any instances of the old x264 packages, compile/install the new x264 and recompile mplayer to pick it up. Also your mencoder is pretty old (1.0rc2 - 2 years old), grab SVN if you can

Further check the output of ldd $(which mencoder) | grep libx264* and you can see to which library it is linked. If it is to libx264.so.59 then do the steps above

kozaki
1st January 2009, 23:49
It's libx264.so.59, yes you guessed it right froggy1. Thank you v much :)
I think I'll reinstall Arch linux on my desktop rather playing with rpm --nodeps, sources & subversion on Mandriva.
Would be nice to get a poweruser friendly station where i can test & use bleeding edge stuff like h264enc, and Arch is just great on that. But last time i tried to install it, it did not like my raid+lvm. And since Mandy let me do my work without too much of hassle even if with less fun...

microchip8
2nd January 2009, 04:24
@ kozaki

Well, I'm on an rpm based Linux too (openSUSE 11.0) and I don't have any problems with it. I never use mplayer and x264 from the repo's and always compile them myself. I don't have any problems with that on my system and can always use the latest of these programs. I don't know how Mandriva does it since the last time I used it, they were called Mandrake and I used version 8.1 which is many years old.

microchip8
4th January 2009, 16:35
ChangeLog for version 8.6.7
* Added two AVCHD presets (avchd and avchdhq)
* Removed tsMuxeR options insertSEI, contSPS and --vbv-len when using the
Blu-ray and AVCDHD presets
* Use 'source' instead of '.' for importing files into the script. Makes it easier for
me to read when my eyes are tired
* Moved the CONFIGDIR variable to the configuration file. This allows the user to set
a custom temporary directory for storing temp files for encoding/remuxing. If the variable is
unset in the config file, h264enc defaults to $HOME/.h264enc/h264enc_<PID>. This change
updates the config file to version 3. Requested by Matyas Sustik
* Improvements to the audio_resample_func() function. Automatically detect the audio sample
rate of the content and display it. Also, moved the resample filters into a function called
audio_resample_filters_func(). This change allows for comparing the detected with the selected
sample rate and if both are the same, resampling will be skipped
* For directory encodings, offer an option to automatically delete the AVI file after remuxing to the
other containers. This can considerably reduce disk space usage, especially when encoding a
directory with a lot of files in it.
* Replaced all 'tail -1' commands with 'tail -n 1' since 'tail -1' is made obsolete as stated by the info page of tail
* Lowered psy trellis by 0.1 for all presets that use it. Seems 0.3 can cause weak mosquito noise
on some content, even at such low values
* Use a weak AQ strength of 0.5 for the anime presets to reduce blocking in dark areas
* Added -channels option when scanning a video file for its audio properties
* Updated the man page

kozaki
6th January 2009, 14:20
yeah nice :)

froggy1, which mplayer (mencoder) version do you use on OpenSuse?
Actualy, i used to compil it back in 2001-2003 (mplayer was commonly uninstallable as a package back then). After what i got used to the install-package-and-it-simply-works, and didn't went further than lookin for the most up-to-date rpm/.tar.gz version for my distro. Especialy as a bunch of other packages rely on mplayer.
But both on Arch and Mandriva the latest i've seen is 1.0rc2.xx (svn's available on Arch but i have yet to bypass an issue with init 5 on this distro before i can try it)

microchip8
6th January 2009, 16:02
I use self-compiled SVN versions of mplayer. I usually grab once a month from SVN and compile it.

ggking7
13th January 2009, 05:54
Has anyone used this to encode a video that can be played back with audio on a Nokia N82 (or similar) cell phone? I'm having trouble finding something in Linux that works reliably.

microchip8
13th January 2009, 06:00
not sure, it does have a Nokia S60 preset, you can try it but I don't know if it'll work for the N82

ggking7
13th January 2009, 17:54
Thanks froggy1, I'd like to give it a try but there doesn't seem to be an ebuild for Gentoo available anywhere.

microchip8
13th January 2009, 18:20
why do you need ebuild? h264enc is just a shell script, copy it to any location and use it

microchip8
14th January 2009, 08:10
ChangeLog for version 8.6.8
* Calculate and display the amount of frames when scanning a video file. Also display seconds in
addition to minutes for the runtime
* Replaced MB and GB with MiB and GiB
* Updates to the hq, vhq, ehq, ihq, ani and anihq presets: lower b-frames from 16 to 5 for the hq, ani and
anihq, from 16 to 6 for the vhq, from 16 to 7 for the ehq and from 16 to 8 for the ihq presets and use b_adapt=2
instead of b_adapt=1. These changes increase encoding time a bit but are worth it quality-wise
* Updated QP range, add 0 for lossless mode

ggking7
14th January 2009, 19:09
Thank you, I did that, but a sanity check (-sc) tells me:

-> Checking for 'neroAacEnc'.................. FAILED! [no support for AAC+ audio]
-> Checking for 'aacplusenc'.................. FAILED! [no support for AAC+ audio]
-> Checking for 'MP4Box' (from gpac).......... FAILED! [no support for the MP4 container]

The audio needs to be in AAC format to work in S60, but I get the following:

$ tar -xzf aacplusenc_0.17.1.tar.gz
gzip: stdin: not in gzip format

The container needs to be MP4 to work in S60 and I do have gpac installed, but I get the MP4 error.

Do you know how to fix these problems?

microchip8
14th January 2009, 19:19
if you have installed something AFTER h264enc has created its config file, it won't find it. The reason why is explained in the -r option which you should read and run to recreate the config file. Also aacplusenc is only for HE-AAC (aka AAC+) audio, if you need LC-AAC, use neorAacEnc or FAAC, though nero also supports HE and HEv2

if you still get problems, you can set the paths to the programs manually by opening the config file which is located in

/home/username/.h264enc/config

ggking7
15th January 2009, 21:17
It works great! Thank you!

I'm wondering about the aspect ratio. My video ends up being stretched to fit the entire screen. Is there a way to have it preserve whatever aspect ratio the movie has without having to manually specify it each time?

Is there a way to have h264enc encode a video in the same way each time so I don't have to go through the interactive choices?

microchip8
15th January 2009, 21:26
It works great! Thank you!

I'm wondering about the aspect ratio. My video ends up being stretched to fit the entire screen. Is there a way to have it preserve whatever aspect ratio the movie has without having to manually specify it each time?

I think this is normal when mplayer plays the video, but I'll look into it. Can't promise anything.

Is there a way to have h264enc encode a video in the same way each time so I don't have to go through the interactive choices?

you can save the settings to the batch file. If you want to encode multiple video files inside a directory with the same settings, use "dir" instead of "file" when asked for source. this way the script operates in full batch mode

ggking7
15th January 2009, 22:06
I think this is normal when mplayer plays the video, but I'll look into it. Can't promise anything.

I should have said it fills the 320x240 Nokia screen, not with mplayer. It must need the top and bottom black bars. Can that be set automatically?

microchip8
15th January 2009, 22:11
I should have said it fills the 320x240 Nokia screen, not with mplayer. It must need the top and bottom black bars. Can that be set automatically?

I have no idea how Nokia displays video and honestly I don't know if I can implement such a thing. Doesn't the Nokia's have some aspect adjustments for video?

ggking7
15th January 2009, 22:15
It doesn't seem like a Nokia thing, I think it's in the encoding. Didn't h264enc expand the movie's aspect ratio to fill 320x240 when I specified that resolution? In the past I used an unreliable ffmpeg script to encode a different movie and it preserved the aspect ratio with black bars on the top and bottom.

microchip8
15th January 2009, 22:25
It doesn't seem like a Nokia thing, I think it's in the encoding. Didn't h264enc expand the movie's aspect ratio to fill 320x240 when I specified that resolution? In the past I used an unreliable ffmpeg script to encode a different movie and it preserved the aspect ratio with black bars on the top and bottom.

h264enc doesn't do any expanding, it only supports forcing input aspect ratio. Though the expand filter is automatically added by mencoder each time encoding starts. If you show me the ffmpeg settings you used maybe I can add something, though again no guarantees here

microchip8
15th January 2009, 22:32
do you want me to add support for the expand filter so one can tweak the settings?

ggking7
16th January 2009, 01:30
h264enc doesn't do any expanding, it only supports forcing input aspect ratio.
Does "forcing input aspect ratio" mean forcing it to preserve the original aspect ratio? That's exactly what I want to do.

do you want me to add support for the expand filter so one can tweak the settings?
You're great. I can't say I'm totally sure how the problem is being caused, but if you think that's what's necessary to preserve the aspect ratio, then yes please.

microchip8
16th January 2009, 01:41
Does "forcing input aspect ratio" mean forcing it to preserve the original aspect ratio? That's exactly what I want to do.


You're great. I can't say I'm totally sure how the problem is being caused, but if you think that's what's necessary to preserve the aspect ratio, then yes please.

I'm no expert on aspect ratios but forcing the input ratio is useful when the file/dvd has an incorrect aspect. I've found quite a few DVDs that are 16/9 but when played back they go to 4/3 so one needs to force the correct ratio.

I don't have much experience with the expand filter, but it can be either used to add black bars or set the aspect ratio for the output, eg -vf expand=320:::::16/9

you will probably have to do a few experiments on your own to see how it goes for you

microchip8
16th January 2009, 19:47
ChangeLog for version 8.6.9
* Add title/movie name to MKV and OGM as meta-info. The title is taken from the output name
provided by the user. For directory encodings, this will be skipped
* Add audio codec and audio language meta-info to MKV when encoding DVDs and copying the audio track(s).
Requested by Quentin Jackson
* Added support for the expand video filter
* Slightly improved info when the script is called without any parameters
* Implemented denoising presets for the 'tn' temporal denoiser
* Merge the mp3, aac, ac3 exporting code with the ffac3 and ffdts one since it's the same for the second audio track

ggking7
19th January 2009, 18:18
Thank you very much for the update. I tried forcing the input ratio and it created a video which had the correct aspect ratio on my computer via mplayer but the Nokia expands it to fill the whole screen.

I also tried the expand filter and it's on the right track but I can't get it right. If I specify either 320:::::4/3 or 240:::::4/3 I get the right shape with a 4/3 video window and black bars on the top and bottom on my computer, but the resolution ends up being 428x320 and of course the Nokia refuses to play it. I can't figure out how to expand a 16/9 video to 4/3 by creating black bars and maintaining 320x240 resolution.

microchip8
19th January 2009, 18:34
Thank you very much for the update. I tried forcing the input ratio and it created a video which had the correct aspect ratio on my computer via mplayer but the Nokia expands it to fill the whole screen.

I also tried the expand filter and it's on the right track but I can't get it right. If I specify either 320:::::4/3 or 240:::::4/3 I get the right shape with a 4/3 video window and black bars on the top and bottom on my computer, but the resolution ends up being 428x320 and of course the Nokia refuses to play it. I can't figure out how to expand a 16/9 video to 4/3 by creating black bars and maintaining 320x240 resolution.

I'm not very confident with the expand filter and how it works, so in order not to give you false information, I suggest you send your question about your problem to the mencoder-users mailing list. You have to subscribe first though. Sorry if I'm not much of a help here :(

ggking7
19th January 2009, 18:39
No problem, I'll report back with findings.

nm
19th January 2009, 21:31
I can't figure out how to expand a 16/9 video to 4/3 by creating black bars and maintaining 320x240 resolution.
I had to look this up (http://lists.mplayerhq.hu/pipermail/mencoder-users/2006-July/003670.html):
-vf expand=aspect=4/3,scale=320:240

Seems that the operations and their order is exactly the same as in your question. Logical. ;)

microchip8
19th January 2009, 21:47
I had to look this up (http://lists.mplayerhq.hu/pipermail/mencoder-users/2006-July/003670.html):
-vf expand=aspect=4/3,scale=320:240

Seems that the operations and their order is exactly the same as in your question. Logical. ;)

thanks for info, it seems it works that way. Though currently the expand filter is placed after the scale one in h264enc. Maybe I can add a question where to place it in h264enc, before or after scaling? If no one objects, I'll do it :p

ggking7
20th January 2009, 02:21
When I answer:

Specify the Expand filter values [press 'Enter' to skip]: aspect=4/3

I get the following when encoding should begin:


The round option must be an integer: =4/3
Option vf: Error while parsing expand parameter round (=4/3)

Exiting... (error parsing command line)
-> MEncoder has exited with a non-zero value!
-> Exiting in function: mencoder_exit()


What am I missing?

microchip8
20th January 2009, 02:25
When I answer:

Specify the Expand filter values [press 'Enter' to skip]: aspect=4/3

I get the following when encoding should begin:


The round option must be an integer: =4/3
Option vf: Error while parsing expand parameter round (=4/3)

Exiting... (error parsing command line)
-> MEncoder has exited with a non-zero value!
-> Exiting in function: mencoder_exit()


What am I missing?

you can't use it now that way because I need to change the code. Also even if you could use it now, you'll still get it wrong as the expand filter comes after the scale one, so the aspect=4/3 won't work like you want. Wait till tomorrow, I'll release a new version. If you can't wait, save settings to batch file and manually add expand=aspect=4/3,scale=320:240 to the filter chain in the file. Then run h264enc -b /path/to/file/batchfile

ggking7
20th January 2009, 02:42
I can wait. :) Thanks!

microchip8
20th January 2009, 16:36
ChangeLog for version 8.7.0 - small release :)

* Added support for setting the position of the expand filer when scaling is used.
The user can now choose to place it before or after the scale filter. Previously the expand
filter was always placed after the scale filter which is not optimal in certain cases
* Small improvement/fix: when encoding two audio tracks to HE-AAC audio and muxing them
into MKV, mkvmerge uses for both tracks the same track ID (1) while h264enc assumes that
the second track uses track ID 2 which is wrong so the option --aac-is-sbr 2:1 is incorrect here
and should actually be --aac-is-sbr 1:1 for the second audio track

@ ggking7

you can now use aspect=4/3 :) (and place the expand filter before scaling)

ggking7
20th January 2009, 20:56
It's perfect! Thank you!

microchip8
20th January 2009, 21:24
It's perfect! Thank you!

the things I can do with shell scripting :p :)

Fat_Guy
23rd January 2009, 04:41
Hello, this is my first post here....i have a question regarding converting
a video file into PS3 compatible container. I have looked at your h264enc
commandline program (thx for creating this froggy1) & so i also have a few questions re 'converting' an mkv file. Here's the nfo on the file in question:

General Information

RUNTIME.......: 2h:10m:16s

SIZE..........: 12.3 GB, DVD9+DVD5

VIDEO CODEC...: x264, 2pass [LEVEL 4.1]

FRAMERATE.....: 24.000 fps

BITRATE.......: Variable ~ 11956 Kbps

RESOLUTION....: 1916x816

AUDIO 1.......: French DTS 5.1 1.5 Mbps

SUBTITLES.....: English, french, spanish

It is a large 12.3 Gb MKV w/ x264 already at Level 4.1, DTS French & English Subs....i want to keep video quality untouched as well as the French DTS 5.1 untouched & include the English subs. Can this be be done with h264enc? If so, the avchdhq profile would be the correct one yes? How would i set up all the options in h264enc to 'untouch' audio/video quality? I have a simple Linux script that works on most mkv w/ DD5.1....it is suppposed to handle DTS as well but it seems to fail on this file....& the subtitles present an issue with th existing script i was using...hence looking at H264enc.

Thx for any suggestions & have a nice day.

Fat_Guy

microchip8
23rd January 2009, 13:59
if you want to keep both video and audio untouched, why use h264enc to re-encode it? Simply use mkvmerge to add the subtitles to the mkv you have (I hope you didn't get it illegally as this board doesn't allow discussions about such things). h264enc is meant to re-encode stuff so if you do that you will lose quality, and depending on the settings, this loss can be (very) minimal or more noticeable. h264enc will not help you much in your case

the avchdhq preset is a specific preset which encodes the content to be AVCHD compliant

http://en.wikipedia.org/wiki/AVCHD
http://www.avchd-info.org/

in your case, you can use something like: mkvmerge file.mkv subtitle1.srt subtitle2.srt subtitle3.srt -o output.mkv

PS: the PS3 doesn't support MKVs so you'll have to use MP4 but again you can simply demux the MKV and add video and re-encoded audio to AAC into the MP4 container, including all three subtitles. This will not guarantee though that your file will be compatible for the PS3 as Level 4.1 is not the only thing that matter but also with which settings the file was encoded. PS3 is picky about that. If your original MKV wasn't encoded with proper settings for the PS3, simply remuxing it into MP4 won't work for the PS3 so you'll have to re-encode with PS3 compatible presets which h264enc has

Fat_Guy
23rd January 2009, 18:14
Thankyou froggy1 for replying to my post.......i guess upon initial perusal of your program i noticed the avchdhq preset...i knew that avchd with dts sound is supported on ps3, so i figured perhaps there was some way to setup h264enc to 'shut off' video/audio transcoding & just remux the three tracks into the avchd. Unfortunately i find a lot of this video file manipulation a bit confusing & converting mkv to ps3 compatible is a battle for me under Linux...particularly with DTS which in this case is 1.5mbps dts that i want to keep. I have to find some sort of Linux howto related to video conversion to PS3 because i keep going around in circles. :)

In general, when you run h264enc with a preset, say 'avchdhq', are all the other prompts that follow afterwards 'preselected' to appropriate setttings?
...or must you still manipulate them accordingly?

thx & have a nice day.

microchip8
23rd January 2009, 18:45
Thankyou froggy1 for replying to my post.......i guess upon initial perusal of your program i noticed the avchdhq preset...i knew that avchd with dts sound is supported on ps3, so i figured perhaps there was some way to setup h264enc to 'shut off' video/audio transcoding & just remux the three tracks into the avchd.

yes, the ps3 supports avchd but again the file has to be encoded with compliant avchd settings. Resolution, encoder settings, etc have to be accordingly. I don't know if your file is compliant since I don't know how it was encoded, and changing the container won't fix that because container change does not alter the audio and video at all. There is a Windows tool for remuxing MKVs to M2TS (or was it PS?) container which the PS3 will play. AVCHD is a modified standard of the Blu-ray standard so it too has a directory structure just like Blu-ray does. tsMuxeR is the only available tool for creating Blu-ray structures under Linux, AFAIK. For AVCHD I don't know any

h264enc is a simple CLI interface for setting up encoder options, this is its primary function. It's not a muxing tool per definition so you can't shut off audio and video in h264enc and use only its muxing capabilities

Unfortunately i find a lot of this video file manipulation a bit confusing & converting mkv to ps3 compatible is a battle for me under Linux...particularly with DTS which in this case is 1.5mbps dts that i want to keep. I have to find some sort of Linux howto related to video conversion to PS3 because i keep going around in circles. :)

I can imaging how it can get confusing for a newbie, sometimes I'm confused too :) As I said above, remuxing doesn't change the way the video and audio were encoded. You only change containers which are used to hold audio/video/subs/etc and synchronize them. To really change something in the audio/video stream you have to re-encode it

In general, when you run h264enc with a preset, say 'avchdhq', are all the other prompts that follow afterwards 'preselected' to appropriate setttings?
...or must you still manipulate them accordingly?

thx & have a nice day.

not really, when you choose a preset you only choose the MEncoder encoder settings. Though for some presets there's an informative function which, when you reach scaling, it prints which resolutions are valid for this preset. For example, if you choose the sony psp preset, a message will be displayed with the valid resolutions for the Sony PSP devices. Also most portable device presets have restricted audio codecs. Again for example, when you use the psp preset and come to the audio settings, it will only allow you to use AAC audio or nosound because the PSP doesn't support other audio codecs

microchip8
2nd February 2009, 12:58
ChangeLog for version 8.7.1
* Use keyint_min of 2 instead of 1 for the Blu-ray/AVCHD presets to prevent consecutive IDR frames
* Added -loop 1 to MPlayer to prevent infinite looping if user has set -loop 0 in MPlayer's config file. Suggested
by Jan Paral (Dept. of Physics, Univ. of Alberta, Canada)

kozaki
13th February 2009, 13:18
@ kozaki

Well, I'm on an rpm based Linux too (openSUSE 11.0) and I don't have any problems with it. I never use mplayer and x264 from the repo's and always compile them myself. I don't have any problems with that on my system and can always use the latest of these programs. I don't know how Mandriva does it since the last time I used it, they were called Mandrake and I used version 8.1 which is many years old.

Please forgive me to ask this here.
froggy1 since you answered this i compiled needed libraries and encoders (e.g. faad2, x264, gpac, libnut, ffmpeg & mplayer) on my Mandriva x86_64 station with some success regarding h264enc's use.

Since then i've had issues with apps relying on the compiled librairies: kino, avidemux, VLC stopped to work, complaining for the lack of e.g. libavcodec.so.51()(64bit). Forcing the re-installation of the packages do not help. Neither makin a dirty symlink from (compiled) libavcodec.so to libavcodec.so.51.

I understand those apps rely on shared libraries/codecs. Basically do we need to compile the whole lot of video related apps as soon as we compile one (loosing the ability to update any of them from the distro binary packages) ? Or is there a way to use both of them, e.g. ffmpeg + ffmeg-svn ? Sorry if there's already a post on this as i couldn't find it.

microchip8
13th February 2009, 13:41
for h264enc, you don't need ffmpeg, faad2 and libnut. all you need is mplayer, x264, gpac, mkvtoolnix and ogmtools

I don't know why your vlc and avidemux complain. I also have avidemux and vlc, but they use libs from /usr/lib64 and not libs from my self-compiled mplayer and x264, which are in /usr/local

for example, my avidemux (from repo) is linked to libx264.so.60 while my self-compiled mplayer is linked to libx264.so.66 in /usr/local/lib. If I would want avidemux to use my self-compiled x264 and its libx264.so.66 library, then I'll have to recompile avidemux.

I've also never had issues in using self-compiled ffmpeg and ffmpeg from repo at the same time, and the apps that depend on ffmpeg from repo work properly here and at the same time I can use self-compiled ffmpeg without problems.

microchip8
14th February 2009, 15:49
ChangeLog for version 8.7.2
* Rewrote and simplified the video_denoise_func() function. Merged the presets with the denoise filters
* Added two Archos 5 presets (ar5 and ar5hq)
* Removed unused global_header variable from h264enc and the preset.cfg file
* Add audio meta-data info for the MKV container when using aac, mp3, ac3 or vorbis audio
* Revert back to the old crop detection method for DVDs as it was more precise in some cases than the
currently used one. This forces the video codec during crop detection to mpeg12 instead of ffmpeg2 as the
-sstep option doesn't play nice with ffmpeg2
* Updated the man page

]Lexx[
17th February 2009, 07:05
HQ presets for Blu-ray/AVCHD [x264] HP@Level 4.1 encoding

--pass 1 --bitrate XXXX --stats ".stats" --ref 4 --mixed-refs --no-fast-pskip --bframes 5
--b-pyramid --weightb --direct auto --deblock -3:-3 --subme 9 ---analyse p8x8,b8x8,i4x4,i8x8 --8x8dct --trellis 2 --aq-strength 0.8
--psy-rd 1.0:0.0 --b-adapt 2 --me umh --threads auto --thread-input --progress --no-psnr --no-ssim --output NUL

--pass 2 --bitrate XXXX --stats ".stats" --ref 4 --mixed-refs --no-fast-pskip --bframes 5 --b-pyramid --weightb
--direct auto --deblock -3:-3 --subme 9 --analyse p8x8,b8x8,i4x4,i8x8 --8x8dct --trellis 2 --aq-strength 0.8 --psy-rd 1.0:0.0 --me umh
--threads auto --thread-input --progress --no-psnr --no-ssim --output "yourmovie.mkv" "avs encode.avs"


Level 4.1 Compliances

Number of allowed reference frames to make your encode L4.1 compatible.

|-----------|---------|
|Resolution | no. ref |
|-----------|---------|
| 1280x544 | 12 |
| 1280x720 | 9 |
| 1920x800 | 5 |
| 1920x816 | 5 |
| 1920x1080 | 4 |
|-----------|---------|

microchip8
17th February 2009, 14:33
I don't change frame references according to resolution for the bd/avchd presets

liquidator87
19th February 2009, 12:49
Where did you find the documentation for mencoder "x264encopts" parameter?

buzzqw
19th February 2009, 13:06
mencoder man pages ?

BHH

nm
19th February 2009, 13:14
Looks like the manual web page (http://www.mplayerhq.hu/DOCS/man/en/mplayer.1.html) is currently empty, probably because of some bug in automatic generation.

But if you have MPlayer/MEncoder properly installed, just run "man mplayer" in a terminal. Search by typing "/x264encopts" and hit enter. Next and previous hits can be searched with keys "n" and "N", respectively.

"x264 --longhelp" is also useful since the x264encopts parameters from MEncoder are parsed by libx264, so the syntax is mostly the same except for delimiters.

liquidator87
19th February 2009, 13:42
thank you, I found what I need

WalterK
23rd February 2009, 21:17
hey froggy1 have you seen the latest svn mplayer?
Its now shipping with vdpau without the need for patches and therein lies the problem.
Trying to re-encode vc-1 hidef files to x264 leads to a
Starting to encode in: 5 4 3 2 1
MEncoder SVN-r28674-4.3.2 (C) 2000-2009 MPlayer Team
success: format: 0 data: 0x0 - 0x80e0f0c
ASF file format detected.
[asfheader] Audio stream found, -aid 1
[asfheader] Video stream found, -vid 2
VIDEO: [WVC1] 480x360 24bpp 1000.000 fps 512.0 kbps (62.5 kbyte/s)
[V] filefmt:6 fourcc:0x31435657 size:480x360 fps:1000.000 ftime:=0.0010
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 44100 Hz, 2 ch, s16le, 64.0 kbit/4.54% (ratio: 8005->176400)
Selected audio codec: [ffwmav2] afm: ffmpeg (DivX audio v2 (FFmpeg))
==========================================================================
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
Opening video filter: [harddup]
Opening video filter: [softskip]
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffvc1vdpau] vfm: ffmpeg (FFmpeg WVC1 (VDPAU))
==========================================================================
Forcing output FourCC to 30355844 [DX50].
MP3 audio selected.
VDec: vo config request - 480 x 360 (preferred colorspace: VC1 VDPAU acceleration)
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
The selected video_out device is incompatible with this codec.
Try appending the scale filter to your filter list,
e.g. -vf spp,scale instead of -vf spp.
Segmentation fault
-> MEncoder has exited with a non-zero status!
-> Exiting in function: mencoder_exit()
Lack of colorspace conversion with mplayer for vdpau-vc1, theres a nvidia patch but this requires you disable x264 so maybe add a bit that for now vdpau should be disabled with --disable-vdpau for the latest svn of mplayer (its enabled by default if the driver is detected)

PS i tried the vc-1 encoded files with all the tools divxenc, h264enc and xvidenc to see if it was limited to one but its a mplayer/vdpau bug

microchip8
23rd February 2009, 21:46
Walter,

No I have not seen that yet and I'll have to upgrade my svn. Honestly I'm tired of adding workarounds in my scripts just to fix some of the buggy code in mplayer/mencoder that developers are either too lazy to fix or just don't care.

Can you post a VC1 sample somewhere as I don't have one here?

WalterK
24th February 2009, 16:09
try this sample http://dvbportal.dyn1.de/ts/thenotebook-vc1-1080p.wmv

ranger0293
6th March 2009, 19:55
Hi, I really love the script.

I'm looking to use it to rip my dvd collection (mostly television shows), and I was curious what you would recommend for quality and file sizes. I guess I was thinking of using the vhq preset. Should I go for a size like 350MB per 30 minutes of show? I don't need anything fancy, just nice quality rips. Any suggestions would be welcome.

microchip8
6th March 2009, 23:01
Hi, I really love the script.

I'm looking to use it to rip my dvd collection (mostly television shows), and I was curious what you would recommend for quality and file sizes. I guess I was thinking of using the vhq preset. Should I go for a size like 350MB per 30 minutes of show? I don't need anything fancy, just nice quality rips. Any suggestions would be welcome.

I always use vhq preset (mostly due to my older CPU) but you can use ehq if you have a fast enough system. As for file size, it depends on the type of content you're dealing with (low-motion/fast-motion/etc). It's best to do a few tests to find out yourself what suits you better. If you don't care about file size that much, just use CRF encoding instead of 2-pass. For CRF I use a value of 23-24 and it suits my needs

ranger0293
9th March 2009, 00:31
I always use vhq preset (mostly due to my older CPU) but you can use ehq if you have a fast enough system. As for file size, it depends on the type of content you're dealing with (low-motion/fast-motion/etc). It's best to do a few tests to find out yourself what suits you better. If you don't care about file size that much, just use CRF encoding instead of 2-pass. For CRF I use a value of 23-24 and it suits my needs

Hey, thanks a lot for the crf recommendation. The file sizes are surprisingly small for the excellent quality I get. I was nearly doubling them by setting my own file sizes.

Now I can set up my own scripts with the batchfiles and just let it all run.

I wish I had a robot to insert all my dvds to convert them to isos, though. :(

cooool
29th March 2009, 13:31
First of all, I thank froggy1 for creating such a wonderful shell script. It has really helped me a lot. I faced a few problems though.

Firstly, the mp4 output was not complete. If my input file was 2 hours 22 minutes, the mp4 output file was only 2 hours in length. This has happened three times so far. But the avi output has no problems. So i need some help here.
Since the avi file is complete, can somebody please tell me how to put it into an mp4 container? I dont want to do the encoding process all over again.

My second problem is related to converting dvds. My dvd's are all widescreen and have black bars in the top and bottom. I am converting the videos for my ipod whose aspect ratio is 4:3.
When i run h264enc, i first crop the file to remove the black bars. There are no problems there. Then i set the output resolution to 640x480 and force the input aspect ratio to 4:3. But the output file does not have the dimensions i want. It is still rectangular and when i play it on the ipod, i get black bars in the top and bottom again (since the ipod has a squarish screen).
Then i used the expand filter and put aspect=4/3. But this does not help. The output file has the dimensions i want but the black bars are there again.

I think i am doing something wrong here. Can somebody help me out with the settings? Basically, I have a widescreen dvd with black bars. I need a file with 640x480 resolution and 4:3 aspect ratio with correct file dimensions (i mean width and height). Thank you.

microchip8
31st March 2009, 11:06
First of all, I thank froggy1 for creating such a wonderful shell script. It has really helped me a lot. I faced a few problems though.

Firstly, the mp4 output was not complete. If my input file was 2 hours 22 minutes, the mp4 output file was only 2 hours in length. This has happened three times so far. But the avi output has no problems. So i need some help here.
Since the avi file is complete, can somebody please tell me how to put it into an mp4 container? I dont want to do the encoding process all over again.

That's odd. I never had such problem with mp4, not even with movies over 3 hours long. I'm not really sure if it's a mp4box or mencoder problem. I'll have to investigate that myself

To remux your existing AVI encodes to MP4, do the following

MP4Box -aviraw video file.avi
MP4Box -aviraw audio file.avi

if the audio is AAC, mp4box will use the .raw extension for it. Rename it to use .aac extension . Then to add the audio & video stream, do as follows

MP4Box -fps <value> -add video.h264 -add audio.aac -new output.mp4

Replace <value> with the FPS value of the AVI (if -fps is not specified, mp4box defaults to 25 fps)

If you still get shorter files than the original length, then mp4box is screwing up and you should dump the audio & video with mencoder instead, like this


mencoder file.avi -oac copy -ovc copy -of rawvideo -o output.h264
mencoder file.avi -oac copy -ovc copy -of rawaudio -o output.aac

My second problem is related to converting dvds. My dvd's are all widescreen and have black bars in the top and bottom. I am converting the videos for my ipod whose aspect ratio is 4:3.
When i run h264enc, i first crop the file to remove the black bars. There are no problems there. Then i set the output resolution to 640x480 and force the input aspect ratio to 4:3. But the output file does not have the dimensions i want. It is still rectangular and when i play it on the ipod, i get black bars in the top and bottom again (since the ipod has a squarish screen).
Then i used the expand filter and put aspect=4/3. But this does not help. The output file has the dimensions i want but the black bars are there again.

I think i am doing something wrong here. Can somebody help me out with the settings? Basically, I have a widescreen dvd with black bars. I need a file with 640x480 resolution and 4:3 aspect ratio with correct file dimensions (i mean width and height). Thank you.

umm, I'm not really sure how to do that and I'm no expert on the expand filter (never use it). I only added support for it since it was requested by a few users. Maybe someone else with more knowledge than me of the expand filter can answer that question? I will do some tests on my own though, see if I can get a combination that works

nm
31st March 2009, 12:53
I think i am doing something wrong here. Can somebody help me out with the settings? Basically, I have a widescreen dvd with black bars. I need a file with 640x480 resolution and 4:3 aspect ratio with correct file dimensions (i mean width and height).
And you don't want any black bars in the output? Then you would need to either crop the left and right sides of the frame away or change the aspect ratio to make the video narrower (people get thinner, circles squeeze to ovals etc.).

If you want to crop the widescreen DVD video to display it on a 4:3 screen while keeping the correct frame/movie aspect ratio, follow these steps:


1. Determine the crop height, as you already did before. I haven't used h264enc, but I have understood that it uses MPlayer's cropdetect filter and also allows the user to specify the cropping parameters manually. So, we use automatic detection to find out the crop height and get rid of possible letterboxing. Then we calculate a smaller crop width so that left and right sides of the widescreen frame also get discarded.


2. Find out whether the DVD is anamorphic (its display aspect ratio is 16:9) or plain 4:3. This can be done by playing the disc with some desktop media player app that displays the video with the correct aspect ratio and doesn't crop black bars automatically. If the video is played in a wide window, it is 16:9. MPlayer can also tell you this automatically (just make sure you select the correct title):mplayer -identify -vo null -ao null -frames 10 -really-quiet dvd://TITLE_NUM | grep ASPECT
If the DVD is anamorphic, define SOURCE_DAR=16/9~=1.7778. Otherwise SOURCE_DAR=4/3~=1.3333


3.Now you can calculate the crop width by using this formula: crop_width = crop_height * TARGET_DAR * SOURCE_WIDTH / (SOURCE_HEIGHT * SOURCE_DAR)



For example, having an anamorphic PAL DVD with letterboxed 2.40:1 video as a source, the crop width would be about: 416 * 4/3 * 720 / (576 * 16/9) = 390
Crop a 390x416 rectangle from the center of the frame and scale that to a square-pixel resolution like 640x480 if the player can't handle anamorphic video.

cooool
3rd April 2009, 05:57
Hi. @froggy1 and @nm, thanks for your replies. Sorry for my late reply.

@froggy1, i used the MP4Box commands you mentioned and they worked fine.

@nm, your formula worked perfectly. However i was wondering if it is possible to do this without cropping the sides. I understand i will lose the original aspect ratio (circles become ovals etc). But i have some files for which i don't want to crop the sides. Anyway to do it?

nm
3rd April 2009, 09:30
@nm, your formula worked perfectly. However i was wondering if it is possible to do this without cropping the sides. I understand i will lose the original aspect ratio (circles become ovals etc). But i have some files for which i don't want to crop the sides. Anyway to do it?
I don't know if h264enc supports this, but you need to add dsize filter before the scale filter like this:crop=w:h:x:y,dsize=640:480,scale=640:480

cheerow
5th April 2009, 16:20
Hi froggy, thanks for your script, I'm using it all the time :)
I was wondering if you could implement VBR encoding for faac? The current ABR solution is not really optimal...

faac -faacopts mpeg=4:br=256:object=2
If I'm not mistaken br=x could be substituted with quality=y

regards

microchip8
6th April 2009, 15:39
Hi froggy, thanks for your script, I'm using it all the time :)
I was wondering if you could implement VBR encoding for faac? The current ABR solution is not really optimal...

faac -faacopts mpeg=4:br=256:object=2
If I'm not mistaken br=x could be substituted with quality=y

regards

vbr aac is not compatible with target size calculation since I can't get any numbers on quality -> bitrate mappings like I did for vorbis and lame/mp3

nm
6th April 2009, 15:54
vbr aac is not compatible with target size calculation since I can't get any numbers on quality -> bitrate mappings like I did for vorbis and lame/mp3
How about encoding audio first at the chosen quality and then calculating the video bitrate required to reach the target size? Or do you want to approximate the audio size for informational purposes before encoding?

I was wondering if you could implement VBR encoding for faac? The current ABR solution is not really optimal...
It it's quality you are worrying about, why don't you use a better encoder too, like NeroAacEnc for AAC, or if you can use other formats, LAME, Vorbis, ...?

microchip8
6th April 2009, 16:05
How about encoding audio first at the chosen quality and then calculating the video bitrate required to reach the target size? Or do you want to approximate the audio size for informational purposes before encoding?


this will complicate the codebase and may introduce A/V sync problems, especially when using frame rate doubling or halving video filters (bobbing, interlacing, etc). It's much easier for him to just save the settings to the batch file and change br= to quality= or whatever and then start encoding from the batch file

cheerow
6th April 2009, 18:55
What about allowing quantizer based audio encoding for encodes without target size e.g. crf/qp modes?

microchip8
6th April 2009, 21:29
What about allowing quantizer based audio encoding for encodes without target size e.g. crf/qp modes?

I will look into it but not right now. I have a lot of stuff to do and currently h264enc is not my top priority

cheerow
7th April 2009, 09:08
I will look into it but not right now. I have a lot of stuff to do and currently h264enc is not my top priority

I understand and thanks for considering it!

microchip8
12th April 2009, 17:02
ChangeLog for version 8.7.3
* Optimize output file naming for file/vcd encodings. Based on a patch by Jouni Suorsa
* Added support for the dsize video filter
* Added support for VBR audio encoding when using FAAC or neroAacEnc as encoder. This automatically
disables target file size calculation until I find out how to map quality values to bitrates for these codecs

crazee_canuck
13th April 2009, 20:33
First: Excellent script, I find it to be very, very useful.

I have a suggestion/request for the next release though:

Would it be possible to add -noconfig all (or something comparable) to the mplayer command lines? Experimenting with some of the mplayer configs (notably msgcolor), I managed to get h264enc to fail with output like the following:


$ h264enc -scan

Would you like to scan a video file or a DVD? [file/dvd]: file
Provide the input video file: /path/to/video/file.mpg
-> Scanning the file...

MPlayer Demuxer:
Video Format:
(standard_in) 1: syntax error
Video Bitrate: kbps
Video FPS:
Video Resolution:
Video Aspect:
(standard_in) 1: syntax error
Video Length: seconds or minutes (May not be accurate)
(standard_in) 1: syntax error
Number Of Frames: (May not be accurate)

Audio Codec:
/usr/local/bin/h264enc: line 589: /1000: syntax error: operand expected (error token is "/1000")
-> No preset specified!
-> Use: h264enc -help


it failed because ~/.h264enc/info_* contained ANSI sequences like the following:

[0;37mID_VIDEO_HEIGHT=576
[0;37mID_VIDEO_FPS=25.000
[0;37mID_VIDEO_ASPECT=0.0000
[0;37mID_AUDIO_FORMAT=80
[0;37mID_AUDIO_BITRATE=0
[0;37mID_AUDIO_RATE=0
[0;37mID_AUDIO_NCH=0
[0;37mID_LENGTH=4719.32
[0;37mID_SEEKABLE=1
[0;37mID_CHAPTERS=0
[0;37mID_VIDEO_CODEC=mpegpes
[0;37mID_AUDIO_BITRATE=224000


:thanks:

microchip8
14th April 2009, 00:55
First: Excellent script, I find it to be very, very useful.

I have a suggestion/request for the next release though:

Would it be possible to add -noconfig all (or something comparable) to the mplayer command lines? Experimenting with some of the mplayer configs (notably msgcolor), I managed to get h264enc to fail with output like the following:


Sure, I can add it as an option in the config file. I can add something like a MPLAYEROPTS variable where you can also set other options in there, not just the one you proposed

microchip8
14th April 2009, 11:00
ChangeLog for version 8.7.4
* Proper file extension handling for directory batch encodings
* Removed workaround for bug present in old versions of tsMuxeR. Please upgrade to tsMuxeR version 1.9.1(b).
The previous one is no longer supported
* Optimizations to the Blu-ray and AVCHD muxing code
* Add video fps value to the tsMuxeR meta file for TS/Blu-ray/AVCHD muxing
* User request: add an mplayer variable to the config file where the user can set custom mplayer options.
One should be careful which options he uses as some of them may introduce problems and make h264enc
behave badly. The default option set in the new MPLAYEROPTS variable is '-noconfig all' which disables
parsing of the mplayer config file
* Made the VCD device scanning code a function -> get_vcd_devices_func()
* Updated the -scan option to also support VCD scanning
* Small cleanups

microchip8
22nd April 2009, 09:19
ChangeLog for version 8.7.5 - small improvement/fix
* Dump first subtitle during the first pass of a multipass encode to avoid possible delay problems

microchip8
26th April 2009, 09:47
ChangeLog for version 8.7.6
* Bugfix: missing 's' in the sed expression of the MP4OUT variable. This results in
missing output file and will fail when one tries to remux to mp4

microchip8
26th April 2009, 22:43
Hi all

Just to inform people, I've activated my repository at the openSUSE build service and as of today, h264enc is available from there. It's automatically being packaged for SUSE 10.3, 11.0, 11.1, Fedora 9 and Fedora 10. I may add Debian and Ubuntu in the future

http://download.opensuse.org/repositories/home:/microchip8/

nickolasemp
27th April 2009, 08:46
Please, please, do ubuntu (64bit)! I have dependency problems that I don't know how to resolve...

microchip8
27th April 2009, 09:09
Please, please, do ubuntu (64bit)! I have dependency problems that I don't know how to resolve...

I'll try when I solve some minor problems. The build service is still in beta stage and sometimes acts strange, though it's pretty good as it can build packages for SUSE, SLES/SLED, Fedora, Mandriva, RHEL, CentOS and Debain/Ubuntu. It takes lots of work off my hands. It's acting strange now as I've added Ubuntu and Debian build targets, but is excluding them for some reason. Currently trying to resolve the problem

microchip8
28th April 2009, 09:30
ChangeLog for version 8.7.7
* Optimize some variables by replacing piping to sed with VARIABLE1="${VARIABLE2%.*}.ext"
* Move out the built-in -loop 1 mplayer option to the config file's MPLAYEROPTS variable
* Add support for enabling/disabling specific pre/postprocessing filters in the config file.
This adds 7 new variables to the config file where the user can either enable to ask questions
about a specific filter or disable a specific variable, thus skipping questions about the filter
* Moved the video filters code to a new function called video_filters_func(). This also
reduces a bit of code duplication
* Add a new option -e which allows the user to edit the config file directly from within the terminal.
This adds a new variable EDITOR to the config file where the user can set his preferred
text editor (defaults to nano)
* Silence possible dvdxchap warnings
* Updated the man page

cooool
28th April 2009, 13:05
Hi

I am trying to install h264enc in ubuntu 9.04 32-bit. I have installed aacplusenc and gpac. But when i perform sanity check through h264enc -sc, it says they are not installed. I know they are installed as I can use MP4Box command for example. Any idea how to resolve this?

microchip8
28th April 2009, 15:54
Hi

I am trying to install h264enc in ubuntu 9.04 32-bit. I have installed aacplusenc and gpac. But when i perform sanity check through h264enc -sc, it says they are not installed. I know they are installed as I can use MP4Box command for example. Any idea how to resolve this?

Have a look at the -r option :)

cooool
28th April 2009, 18:06
Have a look at the -r option :)

That worked !! Thanks a lot!

microchip8
29th April 2009, 09:58
ChangeLog for version 8.7.8
- Small bugfix: video filters variables in the config file were not respected when one chooses to encode VCDs.
- Add video title meta-data for MKV and OGM when doing directory batch encodings

microchip8
7th May 2009, 10:42
ChangeLog for version 8.7.9
* Automatically add the shebang line to batch files and make them executable
* Added new variable ALLOW_AUTOCROP to the config file which allows the user to enable or disable automatic cropping
* Added MP3 presets and updated target file size code to support them (requested by Rogério Brito)
* Some minor adjustments to the hq, vhq, ehq, uhq and ihq presets; decrease b-frames by one

microchip8
12th May 2009, 03:37
ChangeLog for version 8.8.0
* Added deinterlace combinations of Yadif + linear blend, linear interpolation, cubic interpolation,
median deint, ffmpeg deint and lowpass 5
* Cosmetics to the help menu
* Added global audio function audio_filters_func() for calling the resample, volume normalizing and volume filters
* Added 16 new variables to the config file for enabling/disabling of specific audio/video filters and containers:
ALLOW_FPS_CONVERSION, ALLOW_SCALER_TUNING,
ALLOW_DSIZE, ALLOW_EXPAND, ALLOW_COLORSPACE,
ALLOW_ASPECT, ALLOW_AUD_RESAMPLE, ALLOW_AUD_NORMALIZE,
ALLOW_AUD_VOLUME, ALLOW_MKV_MUXING, ALLOW_MP4_MUXING,
ALLOW_TS_MUXING, ALLOW_OGM_MUXING,
ALLOW_SAMPLE_ENCODING, ALLOW_SCAN_MULTIPLE_VIDSTREAMS and ALLOW_SCAN_MULTIPLE_AUDSTREAMS, the
last two are only effective on file and directory batch encodings
* Updated the man page

mrplow
12th May 2009, 20:53
I'm getting this error upon trying crop detect. I get errors on detecting fps aswell, the last version which doesn't have this problem is 8.7.3
/usr/local/bin/h264enc: line 2447: /2: syntax error: operand expected (error token is "/2")
this happens no matter what type of input file I'm trying

christine@christine-desktop:~/h264enc-8.8.0$ h264enc -r
-> Resetting the config file values
christine@christine-desktop:~/h264enc-8.8.0$ h264enc -sc

-> Checking for 'MPlayer'..................... OK
-> Checking for 'MEncoder'.................... OK
-> H.264 video support in MEncoder............ YES
-> AAC (FAAC) audio support in MEncoder....... YES
-> MP3 (LAME) audio support in MEncoder....... YES
-> AC3 (lavc) audio support in MEncoder....... YES
-> FLAC (lavc) audio support in MEncoder...... YES
-> PCM audio support in MEncoder.............. YES

-> Checking for 'bc'.......................... OK
-> Checking for 'pv'.......................... OK
-> Checking for 'dd'.......................... OK
-> Checking for 'neroAacEnc'.................. OK
-> Checking for 'aacplusenc'.................. OK
-> Checking for 'oggenc'...................... OK
-> Checking for 'less'........................ OK
-> Checking for 'lsdvd'....................... OK
-> Checking for 'dvdxchap' (from ogmtools).... OK
-> Checking for 'mkvmerge' (from mkvtoolnix).. OK
-> Checking for 'ogmmerge' (from ogmtools).... OK
-> Checking for 'MP4Box' (from gpac).......... OK
-> Checking for 'tsMuxeR'..................... FAILED! [no support for the TS container]

microchip8
12th May 2009, 21:29
which mplayer version are you using?

the only change in the crop detection code between version 8.7.3 and 8.8.0 is that 8.8.0 has the MPLAYEROPTS variable from the config file. Everything else is the same and all works here without a problem, including fps detection. In fact, the fps detection code hasn't changed at all and I wonder why 8.7.3 works for you but 8.8.0 doesn't. Try reinstalling h264enc and also open up the config file in /home/username/.h264enc (you can directly edit it with the -e option) and remove everything from the MPLAYEROPTS variable

The error from line 2447 indicates that it can't find the length of the file/DVD thus it fails to divide it by 2. Have you tried other files or DVDs?

mrplow
13th May 2009, 20:28
MPlayer 1.0rc2-4.3.3.
removing '-noconfig all' from the config file resolves the issue, thanks

microchip8
13th May 2009, 20:37
MPlayer 1.0rc2-4.3.3.
removing '-noconfig all' from the config file resolves the issue, thanks

that's a VERY old version (a few years). You really should update to SVN if you can. I do not really support 1.0rc2

mrplow
13th May 2009, 23:10
gotta love Ubuntu, even the new 9.04 is using that old version, I'll see if I can find a newer version in 3rd party ppa

mrplow
14th May 2009, 01:07
build mplayer svn and it works just like it should now
MPlayer SVN-r29308-4.3.3 (C) 2000-2009 MPlayer Team
I guess Ubuntu overwrote my svn mplayer when I did the 9.04 upgrade

microchip8
24th May 2009, 17:21
ChangeLog for version 8.8.1
* Use the same name for the log file as the output file name
* Force using the libmpeg2 decoder when encoding DVDs/VCDs (works slightly better in specific cases compared to ffmpeg2)
* Added support for IVTC 59.940 -> 23.976 fps
* Some small code cosmetics

Rasi
28th May 2009, 21:58
wow.. i created a mkv with h264enc today...

source was a .dv file where audio started after around 1 minute.

final file has sound without the delay for some reason the 1st few minutes of the actual sound data is simply missing...

so original file is like this:

"SILENCE-----HALLO BLA BLA"

the mkv is like this:

"BLA BLA"



i have no clue how h264enc managed to do this :)

microchip8
28th May 2009, 22:53
Rasi, no idea. I don't do anything special. Maybe mkvmerge itself is responsible for that... dunno really

microchip8
8th June 2009, 09:26
ChangeLog for version 8.8.2 - tiny update
* Add iTunes video title name to MP4 files

microchip8
9th June 2009, 22:57
ChangeLog for version 8.8.3
* Added support for adding jpeg/png cover art files to MKV/MP4
* Added audio language meta-info for MP4 and TS files
* Improved audio language meta-info for MKV files. This also adds metadata info for the second audio track
* Fixed a small bug: the --aac-is-sbr mkvmerge parameter should be set to 0:1 for the second
audio track when using aacplusenc as encoder

microchip8
12th June 2009, 19:41
ChangeLog for version 8.8.4
* Replaced the --noaudio mkvmerge option with -A due to recent options changes in mkvmerge version 2.9.5.
-A also works for older versions so nothing breaks here
* Removed the check_outfile_func() function as its code has been added to the set_output_filename_func() function,
which also has been improved
* Added support for FLAC audio in MKV
* Removed some code duplication in the MKV metadata tagging code

microchip8
15th June 2009, 10:26
ChangeLog for version 8.8.5
* Update to the video_subtitles_func() function: for DVD encodings, added support for importing up to
three external subtitles into MKV/MP4/OGM. Also added support for hardcoding an external subtitle into the movie
* Updated the MKV/MP4/OGM muxing code to support imports of external subtitles
* Increased Psy RD from 0.5 to 0.6 for some presets
* If dumping of the second and/or third DVD subtitle fails and user has selected to import the subs into MKV/MP4,
force an exit since container conversion will fail as the muxing programs will complain about the missing subs. If no
container conversion is chosen or user has chosen not to import the subs and dumping of subs fails, just continue
since there's nothing critical in this case
* Use mplayer -really-quiet option instead of redirection to /dev/null when dumping audio to a named pipe for
neroAAC/Vorbis/AAC+ encoding
* Some small updates to the man page
* Updated the AUTHORS file

microchip8
17th June 2009, 20:50
ChangeLog for version 8.8.6
* Added support for per track audio bitrate for DVD encodings
* Added support for per track audio normalization and volume adjustments for DVD encodings. Updated functions
audio_volnorm_func() and audio_volume_func()
* Added support for per track audio resampling for DVD encodings. Updated functions audio_resample_filters_func()
and audio_resample_func()
* Updated the video bitrate calculation code to support the above audio changes
* Bugfix for the qt/bd/avchd presets: audio filters were not called for these presets
* Added support for per track AAC profile settings (LC/HE/HEv2) when using the neroAacEnc audio encoder
* Small modifications to the MKV/MP4 tagging and muxing code to support the per track neroAacEnc AAC profiles.
This also includes optimizations to the way the tagging code handles different AAC profiles. If LC profile is chosen,
audio will be tagged as LC-AAC (along with channels info). For HE and HEv2, audio will be tagged as HE-AACv1 and
HE-AACv2 (along with channels info) respectively
* Moved the MKV tagging code inside the MKV muxing code
* Converted the EXTSUB1, EXTSUB2 and EXTSUB3 variables, used to import external DVD subs, to arrays so we
can easily check different files for their file extensions
* Only allow SRT subs as import into OGM. If another subs format is provided, the subs will be skipped. For MP4, do not
allow ASS/SSA subs since it's not supported yet by MP4Box. For MKV, do not allow SUP and TTXT subs

microchip8
18th June 2009, 11:04
Packages for Fedora 11 are now available from my repo - http://download.opensuse.org/repositories/home:/microchip8/

:)

microchip8
19th June 2009, 11:08
ChangeLog for version 8.8.7
* Simplifications to the MKV tagging code which reduces some code duplication
* Bugfix: FAAC acodec2 variable has wrong mpeg value. Must be mpeg=4 instead of mpeg4. This results in failure in
encoding of the second audio track when one selects FAAC as encoder
* Bugfix: FLAC audio was ignored for the second track due to missing value in the selection of the case statement
* Added support for tagging of MKV files when doing a directory batch encoding
* Replaced the IMPSUB1, IMPSUB2 and IMPSUB3 variables, used to import subs when input type is file/directory/vcd,
by array variables EXTSUB[1], EXTSUB[2] and EXTSUB[3]. This allows for less code duplication as these array variables
are shared by all input types (including DVD) and thus we only need to do a small loop and add their values if not empty
to the MKVSUBS, MP4SUBS and OGMSUBS variables
* Use as temp directory $HOME/.h264enc/job<PID>
* Added new function audio_stream_copy_func() which will print a warning that audio stream copy in directory batch encoding
mode is not recommended unless the user is certain that the files have a supported audio codec by the MKV/MP4/OGM/TS containers
* Group audio filters under a submenu similar to how the video filters are grouped
* Some small cleanups

cooool
21st June 2009, 03:40
Hi

I was trying to convert dvd's into mkv files.
I used h264enc 8.8.5. I used the COPY option in the audio settings. Both the dvd's have DTS audio.

The sample file was alright. The avi also has no problems. But in the mkv file, the audio is out of sync. I still have the avi file with me. Any idea how i can fix this?

I actually encoded 4 dvd's. Two with DTS audio and two with AC3 audio. AC3 does not have any problems. But DTS goes out of sync in mkv files.

Thanks.

microchip8
21st June 2009, 08:03
Hi

I was trying to convert dvd's into mkv files.
I used h264enc 8.8.5. I used the COPY option in the audio settings. Both the dvd's have DTS audio.

The sample file was alright. The avi also has no problems. But in the mkv file, the audio is out of sync. I still have the avi file with me. Any idea how i can fix this?

I actually encoded 4 dvd's. Two with DTS audio and two with AC3 audio. AC3 does not have any problems. But DTS goes out of sync in mkv files.

Thanks.

DTS copy for both tracks is currently a bit problematic and I can't really fix it unless I rewrite a lot of the audio code (currently underway). You may want to manually dump the tracks and then mux into mkv. I also have noticed that sometimes mencoder can behave a bit weird when copying DTS audio. You can recompile mplayer with libdca support (if you don't have it already - install devel packages of libdca too) and this may fix some stuff

.... Honestly, I don't know why you bother with DTS audio but it's your choice ;)

microchip8
22nd June 2009, 11:46
ChangeLog for version 8.9.0
* Small improvement to the MKV/MP4 tagging code: support audio tagging of single file encodes with audio stream copy
* Use array variables ${SUBFILE[2]} and ${SUBFILE[3]} instead of ${OUTPUT%.*}_sub2 and ${OUTPUT%.*}_sub3 when dumping
the second/third DVD subtitles
* Simplified the MKV cover art importing code
* Small improvements to video bitrate calculation with audio stream copy
* Use only one named pipe for all tracks when encoding to neroAAC/AAC+/Vorbis/FLAC
* Major audio code restructuring and partial rewrite. Converted virtually all audio code variables to array variables. This allows for easy
extensibility and much less code duplication. It's very easy now to add as much audio tracks as one may want to the code with very
little changes/updates needed to the containers code. Also the current changes may allow very easily to support different audio
codecs per track in the future
* Added support for a third DVD audio track
* Updated the video bitrate calculation for target size to support the above audio changes
* Converted most of the variables in the video_subtitles_func() function to arrays. This moderately reduces some code duplication
* Updated the container muxing/tagging code to support the above audio changes
* Use external flac encoder to encode to FLAC audio as doing it through mencoder is terribly broken. This updates the config file
to version 8 and adds the 'flac' encoder as dependency
* Set the default resampling filter to lavcresample as the other one gives problems when encoding to FLAC audio and resampling

shortkud
24th June 2009, 02:08
Thanks for this script, I am trying to run it on gentoo but having issues with it detecting bc being installed. I ran 'emerge bc' multiple times.

This is what happens:

h264enc -2p -p cp hq-slow.cfg
-> Checking for utility 'bc'... FAILED!

I'm sure you will ask for this so here you go ;)
# which bc
/usr/bin/bc

# /usr/bin/bc -v
bc 1.06.95
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.

microchip8
24th June 2009, 10:14
Thanks for this script, I am trying to run it on gentoo but having issues with it detecting bc being installed. I ran 'emerge bc' multiple times.

This is what happens:

h264enc -2p -p cp hq-slow.cfg
-> Checking for utility 'bc'... FAILED!

I'm sure you will ask for this so here you go ;)
# which bc
/usr/bin/bc

# /usr/bin/bc -v
bc 1.06.95
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.

Have a look at the -r option which resets the config file... if you have installed any required programs *after* the script has generated its config file, the config file won't have them so you have to reset it.

microchip8
24th June 2009, 18:54
ChangeLog for version 8.9.1
* Removed audio filters for the 1st pass in 2-pass encoding and for the 1st & 2nd pass of a 3-pass encoding.
They are useless here and it's something I've overlooked for a long time. Thanks to Mat Kanner for noticing and reporting
* Some small changes to the way we pass FPS to MP4Box
* Added support for MP4 hinting for RTP/RTSP sessions
* Simplifications to the external subs importing code. Also fixed a bug in the MP4 subs importing code; missing -add
option in the MP4SUBS variable will make MP4Box fail
* Merged the MKV tagging code with the muxing one
* Added support for detection of WMA audio for stream copy
* Added support for per track audio codecs for DVD encodings. The user can now select if he wishes for each track a
different audio codec. Mixing audio stream copy with compression codecs is also possible
* Updated all relevant audio functions to support per track audio codecs
* Updated the bitrate calculation code to support per track audio codecs
* Updated the containers muxing code to support the above audio changes

microchip8
26th June 2009, 11:11
ChangeLog for version 8.9.2
* Set default audio codec for the Blu-ray/AVCHD presets to AC3
* Bugfix to the OGM muxing code. Second/third track were ignored when one selects AC3 audio
* Added keyint, keyint_min, nr and interlaced variables to the custom preset skeleton file 'preset.cfg'
* Moved the AACTYPE variable to the neroaac_audio_func() function and updated the specific parts
that use it in the MKV/MP4 muxing code
* Do not automatically detect audio sample rate in directory batch encoding mode. Only do it for single
file/dvd/vcd encodings as in batch mode, detection will only print the sample rate of the first file but not
the other files in the directory so this can mislead the user in thinking that all files in the directory have
the sample rate reported by the script. It is possible to implement sample rate detection for all files but
since we don't know how many files are in the directory, I do not want the user to see a full screen with
sample rate info of each file if he deals with a directory with a few hundreds or more files in it
* Disallow autocropping, if enabled in the config file, for directory batch encodings
* Small reordering to the MP4 muxing code
* Small update to the install script
* Updated the man page

microchip8
1st July 2009, 13:15
ChangeLog for version 8.9.3
* Fallback to undefined audio language in the AUDLANG[$i] variables if we detect unknown language from MPlayer's output
* Added support for bitrate-based ABR Vorbis encoding in addition to quality-based VBR. ABR mode in Vorbis resembles
quality-based VBR except the encoder averages a given nominal bitrate
* Updated the Vorbis part of the video bitrate calculation code
* Added new function ratio_and_pixels_func() which calculates and displays the Storage Aspect Ratio (SAR), Pixel Aspect
Ratio (PAR) and total pixels from resolution
* Bugfix for track 1 in the internal audio encoding code. If using aacplusenc to encode audio, the case statement had a wrong
selection value (aac++ instead of aac+) resulting in displaying a failed message and forcing an exit even though the encoding
may have succeeded
* Simplifications to the internal audio encoding code which reduce code duplication
* Small fixes to the video bitrate calculation code
* Small tuning to the Blu-ray/AVCHD presets
* Small cleanups

microchip8
8th July 2009, 12:24
ChangeLog for version 8.9.4
* Added detection for E-AC3 audio for stream copy and updated the MKV/TS muxing code to support it
* Added new option -spr which calculates the Storage and Pixel Aspect Ratios (SAR/PAR) for various resolutions
* Display the amount of chapters each DVD title has when scanning for titles
* Display total pixels, SAR and PAR when scanning a file/vcd with the -scan option
* Added --no-chapters mkvmerge option for audio files encoded by neroAacEnc so that chapters won't be
copied over to the MKVs from these files
* Small update to the install script
* Updated the man page. Fix some small cosmetic issues, patch by Alessio Treglia

Rasi
19th July 2009, 20:19
Hi.. just converted a dvd with the new version.... it seems the luminace filter does something terribly wrong...
top image is the original dvd, bottom the result

http://omploader.org/vMjAyag

Automatic Brightness/Contrast Control
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0 -> Luminance-only control
1 -> Chrominance-only control
2 -> Luminance & Chrominance control
3 -> Skip automatic brightness/contrast

Select the Automatic brightness/contrast control [default is 2]:

this is what i selected

microchip8
19th July 2009, 20:23
It does nothing wrong, it auto-adjusts luminance & chrominance levels so you'll get darker parts to appear lighter ;)
This is what you asked for :p

elektronaut
19th July 2009, 20:47
Hi,

first I want to say thank you for this great tool!

I have to propose one advancement: In some cases, it would be better to be able to repeat a certain step, e.g. when it comes to cropping. How are you supposed to correctly guess the crop values? The automatically determined ones never seem to be correct. So I added a little loop expecting a final user input in video_crop_func(). Plain simple. Now I can retry setting the crop values until I'm satisfied.
I think there are also other steps where a retry possibility would be good. In order not to get on the nerves of experienced users, it could be a solution to run h264enc either with or without second checking the user's choices. For example by adding a start parameter or by asking the user in a first question which mode he wants.

Another thing is typing in the path for the input file/folder. Is there no way to use tab-completion? Would also be simple to use zenity for this, but then you have a dependency on Gnome.

Just my two cents.

microchip8
19th July 2009, 21:00
Hi,

first I want to say thank you for this great tool!

I have to propose one advancement: In some cases, it would be better to be able to repeat a certain step, e.g. when it comes to cropping. How are you supposed to correctly guess the crop values? The automatically determined ones never seem to be correct. So I added a little loop expecting a final user input in video_crop_func(). Plain simple. Now I can retry setting the crop values until I'm satisfied.

Not sure I understand what you mean. Do you want me to add a small loop that keeps asking the user for correct cropping value? I don't think that's such a good idea. If you have patches, send them over. I'll look at it and decide ;)

As for "guessing the crop values", if the crop filter is for some reason incorrect, you can always run in another console mplayer dvd:// -vf cropdetect, get the values and pass it to h264enc. The crop detection is certainly not perfect but it will work for 98% of the cases

I think there are also other steps where a retry possibility would be good. In order not to get on the nerves of experienced users, it could be a solution to run h264enc either with or without second checking the user's choices. For example by adding a start parameter or by asking the user in a first question which mode he wants.

Don't really get it either. Which steps and which start parameter? if you want the script to accept files in the form of "h264enc /path/to/file" and then ask for encoding modes and presets, this won't happen. Too much depends on the current way of doing things and I personally don't see a need for changing it

Another thing is typing in the path for the input file/folder. Is there no way to use tab-completion? Would also be simple to use zenity for this, but then you have a dependency on Gnome.

Of course there is and I use it all the time. Each question asked that requires user input in the form of specifying a path, supports bash completion. So for example, if you want to encode a file called "foobar.avi" which is in your home directory, when asked for input, just type

/h<TAB>/u<TAB>/fo<TAB> (where "u" here (username) is used as example for the actual user name)

Rasi
19th July 2009, 22:14
ok another question: h264enc does not find my mkvmerge binary and i have no clue why...


Would you like to convert the final encode from AVI to MKV? [y/n]: y

-> Utility 'mkvmerge' is missing!
-> Skipping AVI to MKV conversion!



1 carnager@freebox ~ % whereis mkvmerge
mkvmerge: /usr/bin/mkvmerge /usr/share/man/man1/mkvmerge.1.gz


same for ogmmerge and mp4box...

elektronaut
19th July 2009, 22:15
Not sure I understand what you mean. Do you want me to add a small loop that keeps asking the user for correct cropping value? I don't think that's such a good idea. If you have patches, send them over. I'll look at it and decide ;)

In video_crop_func() I inserted this before the line "read cropvalues":
CROPDETERMINED="n"
while [ "$CROPDETERMINED" != y ]
do
if [ -z "$cropvalues" ]; then
printf "Specify the crop values [default is $GETCROP]: "
else
printf "Specify the crop values [last try: "$cropvalues" ]: "
fi
read cropvalues
and at the end of the function I appended printf "Are you satisfied with the crop area? [y/n]: "
read CROPDETERMINED
done
As for "guessing the crop values", if the crop filter is for some reason incorrect, you can always run in another console mplayer dvd:// -vf cropdetect, get the values and pass it to h264enc. The crop detection is certainly not perfect but it will work for 98% of the cases
You are certainly right about running mplayer in another console. Didn't think about this (I'm not a media decrypting guru). But my addition doesn't hurt, does it?
Don't really get it either. Which steps and which start parameter? if you want the script to accept files in the form of "h264enc /path/to/file" and then ask for encoding modes and presets, this won't happen.
I don't have any particular step in my mind right now. I just think that it would generally be more user friendly, at least for beginners, to double check their choices, like in the code I pasted above. This could also be done for audio codec selection, bit rate, ... whatever.
The start parameter I suggested would be used for setting the variable "DOUBLECHECK" to TRUE or FALSE, so that the program would run either in "beginner" mode or normal mode. In the latter case the while-loops would be avoided.
/h<TAB>/u<TAB>/fo<TAB> (where "u" here (username) is used as example for the actual user name)
Strange. I could swear that it didn't work when I tried, but now it works. Sorry, maybe I was just a bit too tired.

microchip8
19th July 2009, 22:59
Sorry for late reply. Was watching a movie here, hehe :p

For your crop stuff, I think the CROPDETERMINED variable will fit better in the config file where a user can enable or disable this functionality. Personally, I wouldn't' need it but those who do, can enable it. Patch welcome :p

For the other things, I think it isn't such a good idea as in "beginner mode" it will increase the amount of questions asked when doublecheck is enabled and I certainly want to avoid too many questions being asked. This was my primary reason for adding variables to the config file where users can enable or disable certain audio/video filters and container muxing. For example, I've disabled here the interlace, brightness, sharpening, scanning for multiple video/audio tracks in files and volume normalization since I virtually never use these filters or options. For me (and for others I guess) it reduces the amount of questions asked (and thus saves a bit of time) and of course gets rid of stuff I never use ;)

Further, as with most interactive scripts, you need to pay attention to what you give. Remember, h264enc is just a script I write primarily for me (though share it with others too) and I can't please everybody and there are some things that either will require a lot of rewriting or are just not important for my needs. There are other more simple scripts out there like undvd and ANDREW which are semi-interactive and require little configuration but also offer less functionality than h264enc. So yes, the script is not for everyone and I've mentioned this already in the FAQ pros/cons section of its website

microchip8
19th July 2009, 23:20
ok another question: h264enc does not find my mkvmerge binary and i have no clue why...


Would you like to convert the final encode from AVI to MKV? [y/n]: y

-> Utility 'mkvmerge' is missing!
-> Skipping AVI to MKV conversion!



1 carnager@freebox ~ % whereis mkvmerge
mkvmerge: /usr/bin/mkvmerge /usr/share/man/man1/mkvmerge.1.gz


same for ogmmerge and mp4box...

Did you reset its config file with h264enc -r ?

I use "which" instead of "whereis" to find progs on a user's system. It should work on most, if not all, systems but if it doesn't (and I'll be surprised) you can manually set the path to those in the config file (or edit it directly by running h264enc -e (defaults to using the nano editor))

About your brightness "problem", if you want more control (and not autmomatic adjustment) of these levels, use the software equalizer (eq2) filter which offers a lot of params for adjusting the levels - read man page of mplayer to understand its params ;)

elektronaut
20th July 2009, 11:17
For your crop stuff, I think the CROPDETERMINED variable will fit better in the config file where a user can enable or disable this functionality. Personally, I wouldn't' need it but those who do, can enable it. Patch welcome :p
OK, I have no idea how to make a patch. I simply did a diff like this:
diff h264enc.backup h264enc
Here's the result:
2468,2519c2468,2529
< case "$source" in
< dir|DIR|Dir)
< echo
< error "-> Cropping in directory batch encoding mode is not"
< error " recommended unless you know what you're doing!"
< ;;
< esac
< echo
< green "-> Detecting crop values with 'cropdetect'..."
< $MPLAYER "$sourcetype" $device $vid $MPLAYEROPTS -identify -vo null -ao null -frames 1 -nocache 2>/dev/null > $CONFIGDIR/cropdetect
< VLENGTH=$(grep "^ID_LENGTH" $CONFIGDIR/cropdetect | cut -f '2' -d '=' | cut -f '1' -d '.')
< case "$source" in
< dvd|DVD|Dvd) CROPOPTS="-vc mpeg12 -frames 30 -sstep $(($VLENGTH/30))" ;;
< *) CROPOPTS="-frames 500 -ss $(($VLENGTH/2))" ;;
< esac
< GETCROP=$($MPLAYER "$sourcetype" $device $vid $MPLAYEROPTS -vf cropdetect -nosound -vo null $CROPOPTS -nocache 2>/dev/null | tr '\r' '\n' | grep "crop=" | tail -n 1 | awk '{print $9}' | sed 's/crop=//g; s/).//g')
< rm -f $CONFIGDIR/cropdetect
< if [ ! -z "$GETCROP" ]; then
< green "-> Found crop values: $GETCROP"
< else
< green "-> Failed to get the crop values!"
< green "-> You have to specify them yourself!"
< green "-> The format is as follows: width:height:x:y"
< GETCROP="??"
< fi
< echo
< printf "Specify the crop values [default is $GETCROP]: "
< read cropvalues
< if [ -z "$cropvalues" -a "$GETCROP" = "??" ]; then
< cropfilter=
< else
< if [ -z "$cropvalues" ]; then
< cropfilter="crop=$GETCROP,"
< crop_preview="$GETCROP"
< else
< cropfilter="crop=$cropvalues,"
< crop_preview="$cropvalues"
< fi
< printf "Preview the crop values for 15 seconds? [y/n]: "
< read precrop
< if [ "$precrop" = "y" -o "$precrop" = "Y" ]; then
< printf "Specify the start position in hour:min:sec [default is 0:02:00]: "
< read timepos
< if [ -z "$timepos" ]; then
< startpos="0:02:00"
< else
< startpos="$timepos"
< fi
< #$MPLAYER "$sourcetype" $device $vid $MPLAYEROPTS -vf rectangle=$crop_preview -nocache -nosound -ss $startpos >/dev/null 2>&1 & PID=$!; sleep 15; kill -KILL $PID;
< $MPLAYER "$sourcetype" $device $vid $MPLAYEROPTS -vf rectangle=$crop_preview -nocache -nosound -ss $startpos -endpos 15 >/dev/null 2>&1
< fi
< fi
---
> case "$source" in
> dir|DIR|Dir)
> echo
> error "-> Cropping in directory batch encoding mode is not"
> error " recommended unless you know what you're doing!"
> ;;
> esac
> echo
> green "-> Detecting crop values with 'cropdetect'..."
> $MPLAYER "$sourcetype" $device $vid $MPLAYEROPTS -identify -vo null -ao null -frames 1 -nocache 2>/dev/null > $CONFIGDIR/cropdetect
> VLENGTH=$(grep "^ID_LENGTH" $CONFIGDIR/cropdetect | cut -f '2' -d '=' | cut -f '1' -d '.')
> case "$source" in
> dvd|DVD|Dvd) CROPOPTS="-vc mpeg12 -frames 30 -sstep $(($VLENGTH/30))" ;;
> *) CROPOPTS="-frames 500 -ss $(($VLENGTH/2))" ;;
> esac
> GETCROP=$($MPLAYER "$sourcetype" $device $vid $MPLAYEROPTS -vf cropdetect -nosound -vo null $CROPOPTS -nocache 2>/dev/null | tr '\r' '\n' | grep "crop=" | tail -n 1 | awk '{print $9}' | sed 's/crop=//g; s/).//g')
> rm -f $CONFIGDIR/cropdetect
> if [ ! -z "$GETCROP" ]; then
> green "-> Found crop values: $GETCROP"
> else
> green "-> Failed to get the crop values!"
> green "-> You have to specify them yourself!"
> green "-> The format is as follows: width:height:x:y"
> GETCROP="??"
> fi
> echo
> CROPDETERMINED="n"
> while [ "$CROPDETERMINED" != y ]
> do
> if [ -z "$cropvalues" ]; then
> printf "Specify the crop values [default is $GETCROP]: "
> else
> printf "Specify the crop values [last try: "$cropvalues" ]: "
> fi
> read cropvalues
> if [ -z "$cropvalues" -a "$GETCROP" = "??" ]; then
> cropfilter=
> else
> if [ -z "$cropvalues" ]; then
> cropfilter="crop=$GETCROP,"
> crop_preview="$GETCROP"
> else
> cropfilter="crop=$cropvalues,"
> crop_preview="$cropvalues"
> fi
> printf "Preview the crop values for 15 seconds? [y/n]: "
> read precrop
> if [ "$precrop" = "y" -o "$precrop" = "Y" ]; then
> printf "Specify the start position in hour:min:sec [default is 0:02:00]: "
> read timepos
> if [ -z "$timepos" ]; then
> startpos="0:02:00"
> else
> startpos="$timepos"
> fi
> #$MPLAYER "$sourcetype" $device $vid $MPLAYEROPTS -vf rectangle=$crop_preview -nocache -nosound -ss $startpos >/dev/null 2>&1 & PID=$!; sleep 15; kill -KILL $PID;
> $MPLAYER "$sourcetype" $device $vid $MPLAYEROPTS -vf rectangle=$crop_preview -nocache -nosound -ss $startpos -endpos 15 >/dev/null 2>&1
> fi
> fi
> printf "Are you satisfied with the crop area? [y/n]: "
> read CROPDETERMINED
> done
Hope you can do something with this.

nm
20th July 2009, 11:38
OK, I have no idea how to make a patch. I simply did a diff like this:
diff h264enc.backup h264encYou only need to add option -u in this case to create a unified diff supported by the patch tool. For projects with many changed files in different subdirectories, use diff -Naur

elektronaut
20th July 2009, 13:19
I see. Here's the output using the "-u" parameter:
--- h264enc.backup 2009-07-19 15:12:34.000000000 +0200
+++ h264enc 2009-07-19 16:33:35.000000000 +0200
@@ -2465,58 +2465,68 @@

# Video cropping
video_crop_func() {
- case "$source" in
- dir|DIR|Dir)
- echo
- error "-> Cropping in directory batch encoding mode is not"
- error " recommended unless you know what you're doing!"
- ;;
- esac
- echo
- green "-> Detecting crop values with 'cropdetect'..."
- $MPLAYER "$sourcetype" $device $vid $MPLAYEROPTS -identify -vo null -ao null -frames 1 -nocache 2>/dev/null > $CONFIGDIR/cropdetect
- VLENGTH=$(grep "^ID_LENGTH" $CONFIGDIR/cropdetect | cut -f '2' -d '=' | cut -f '1' -d '.')
- case "$source" in
- dvd|DVD|Dvd) CROPOPTS="-vc mpeg12 -frames 30 -sstep $(($VLENGTH/30))" ;;
- *) CROPOPTS="-frames 500 -ss $(($VLENGTH/2))" ;;
- esac
- GETCROP=$($MPLAYER "$sourcetype" $device $vid $MPLAYEROPTS -vf cropdetect -nosound -vo null $CROPOPTS -nocache 2>/dev/null | tr '\r' '\n' | grep "crop=" | tail -n 1 | awk '{print $9}' | sed 's/crop=//g; s/).//g')
- rm -f $CONFIGDIR/cropdetect
- if [ ! -z "$GETCROP" ]; then
- green "-> Found crop values: $GETCROP"
- else
- green "-> Failed to get the crop values!"
- green "-> You have to specify them yourself!"
- green "-> The format is as follows: width:height:x:y"
- GETCROP="??"
- fi
- echo
- printf "Specify the crop values [default is $GETCROP]: "
- read cropvalues
- if [ -z "$cropvalues" -a "$GETCROP" = "??" ]; then
- cropfilter=
- else
- if [ -z "$cropvalues" ]; then
- cropfilter="crop=$GETCROP,"
- crop_preview="$GETCROP"
- else
- cropfilter="crop=$cropvalues,"
- crop_preview="$cropvalues"
- fi
- printf "Preview the crop values for 15 seconds? [y/n]: "
- read precrop
- if [ "$precrop" = "y" -o "$precrop" = "Y" ]; then
- printf "Specify the start position in hour:min:sec [default is 0:02:00]: "
- read timepos
- if [ -z "$timepos" ]; then
- startpos="0:02:00"
- else
- startpos="$timepos"
- fi
- #$MPLAYER "$sourcetype" $device $vid $MPLAYEROPTS -vf rectangle=$crop_preview -nocache -nosound -ss $startpos >/dev/null 2>&1 & PID=$!; sleep 15; kill -KILL $PID;
- $MPLAYER "$sourcetype" $device $vid $MPLAYEROPTS -vf rectangle=$crop_preview -nocache -nosound -ss $startpos -endpos 15 >/dev/null 2>&1
- fi
- fi
+ case "$source" in
+ dir|DIR|Dir)
+ echo
+ error "-> Cropping in directory batch encoding mode is not"
+ error " recommended unless you know what you're doing!"
+ ;;
+ esac
+ echo
+ green "-> Detecting crop values with 'cropdetect'..."
+ $MPLAYER "$sourcetype" $device $vid $MPLAYEROPTS -identify -vo null -ao null -frames 1 -nocache 2>/dev/null > $CONFIGDIR/cropdetect
+ VLENGTH=$(grep "^ID_LENGTH" $CONFIGDIR/cropdetect | cut -f '2' -d '=' | cut -f '1' -d '.')
+ case "$source" in
+ dvd|DVD|Dvd) CROPOPTS="-vc mpeg12 -frames 30 -sstep $(($VLENGTH/30))" ;;
+ *) CROPOPTS="-frames 500 -ss $(($VLENGTH/2))" ;;
+ esac
+ GETCROP=$($MPLAYER "$sourcetype" $device $vid $MPLAYEROPTS -vf cropdetect -nosound -vo null $CROPOPTS -nocache 2>/dev/null | tr '\r' '\n' | grep "crop=" | tail -n 1 | awk '{print $9}' | sed 's/crop=//g; s/).//g')
+ rm -f $CONFIGDIR/cropdetect
+ if [ ! -z "$GETCROP" ]; then
+ green "-> Found crop values: $GETCROP"
+ else
+ green "-> Failed to get the crop values!"
+ green "-> You have to specify them yourself!"
+ green "-> The format is as follows: width:height:x:y"
+ GETCROP="??"
+ fi
+ echo
+ CROPDETERMINED="n"
+ while [ "$CROPDETERMINED" != y ]
+ do
+ if [ -z "$cropvalues" ]; then
+ printf "Specify the crop values [default is $GETCROP]: "
+ else
+ printf "Specify the crop values [last try: "$cropvalues" ]: "
+ fi
+ read cropvalues
+ if [ -z "$cropvalues" -a "$GETCROP" = "??" ]; then
+ cropfilter=
+ else
+ if [ -z "$cropvalues" ]; then
+ cropfilter="crop=$GETCROP,"
+ crop_preview="$GETCROP"
+ else
+ cropfilter="crop=$cropvalues,"
+ crop_preview="$cropvalues"
+ fi
+ printf "Preview the crop values for 15 seconds? [y/n]: "
+ read precrop
+ if [ "$precrop" = "y" -o "$precrop" = "Y" ]; then
+ printf "Specify the start position in hour:min:sec [default is 0:02:00]: "
+ read timepos
+ if [ -z "$timepos" ]; then
+ startpos="0:02:00"
+ else
+ startpos="$timepos"
+ fi
+ #$MPLAYER "$sourcetype" $device $vid $MPLAYEROPTS -vf rectangle=$crop_preview -nocache -nosound -ss $startpos >/dev/null 2>&1 & PID=$!; sleep 15; kill -KILL $PID;
+ $MPLAYER "$sourcetype" $device $vid $MPLAYEROPTS -vf rectangle=$crop_preview -nocache -nosound -ss $startpos -endpos 15 >/dev/null 2>&1
+ fi
+ fi
+ printf "Are you satisfied with the crop area? [y/n]: "
+ read CROPDETERMINED
+ done
}

calcbits() {

microchip8
20th July 2009, 13:24
I've already manually added it. Also your patch is inconsistent with the coding standard of the script. Always use tabs instead of spaces ;)

microchip8
24th July 2009, 09:42
ChangeLog for version 8.9.5
* Switched to the new Auto-variance AQ (aq_mode=2) for all presets. This requires latest x264 revision
from git so please upgrade!
* Decreased frame references for all iPod presets to 1 and increased subq to 8 for the HQ iPod presets
* Minor improvments to the set_output_filename_func() function
* Merged the audio code of the portable device presets. Moderately reduces code duplication in the audio functions calling code
* Added two new presets (ag1 and ag1hq) for Android G1 devices. This brings the total presets count to 60
* Added support for the new gradfun debanding video filter. Although mostly recommended for playback due to the fact that
encoding tends to bring back banding, it can be useful to deband input sources which show pretty bad and very noticable
banding effects before passing the content to the encoder. The gradfun filter is only available in MPlayer SVN. This also
adds a new variable ALLOW_DEBAND to the config file where one can enable or disable this filter
* Added a small while loop to the video_crop_func() function which will keep asking the user for new crop values until he's
satisfied with them. Patch by elektronaut from Doom9.org
* Added a new variable PRIORITY to the config file which can be used to set a global priority nice value for the encoding
process. The values one can use are between (and including) -20 and 19. However, if the script detects that the variable
has a negative nice value set and the script is being executed with regular user privileges, it will print a notice and exit.
This change updates the config file to version 9
* Updated the man page

microchip8
30th July 2009, 13:01
ChangeLog for version 8.9.6 - small update
* Increased subq to 10 (QP-RD) for the IHQ preset. Requires latest x264 from git.
Also lowered frameref from 16 to 8 and bframes from 10 to 7
* Add example on how to encode only specific DVD chapters. Some people keep bugging
me about this while it's actually very simple

microchip8
1st August 2009, 11:56
ChangeLog for version 8.9.7
* Added new option -mfr which calculates the maximum allowed frame references within DPB (Decoded Picture Buffer)
limits for different H.264 levels and resolutions
* Call the track_echo_func() function inside the select_audio_codec_func() one. Removes pointless duplication
* Don't call mplayer twice in the 2nd/3rd audio track code just to get the audio codec. Also removed a pointless case statement
* Allow users to set the H.264 level when using the standard PC presets
* Fixed a few typos in the preset.cfg file
* Updated the man page

microchip8
7th August 2009, 11:07
ChangeLog for version 8.9.8
* Added support for the audio panning filter. This change also updates the config file to version 10
* Simplifications to the audio_filters_func() and audio_filters_var_func() functions
* Moved the audio filters functions after the audio codec ones
* Fixed a bug in the audio_channels_func() function for the AAC codec. If user just hits return to accept the
default AAC codec, the channels function was not called due to missing "" in the first case statement of that function
* Enabled MB tree (macroblock tree ratecontrol) for the high quality presets and disabled b_pyramid for presets that
have mbtree enabled as it currently doesn't support it. Note that mbtree produces a large passlog file when ran in 2-pass
mode but can increase quality anywhere between 2-70%, depending on the content. mbtree is only available in latest
x264 git so please upgrade
* Added new options mbtree, rc_lookahead and nopsy to the preset.cfg file

microchip8
11th August 2009, 09:26
ChangeLog for version 8.9.9
* Reduced the amount of if conditional iterations for setting the scaler interlace variable
* Print full path of the output file(s) at the end of encoding
* 10L: forgot to enable MB tree for the anihq preset
* Replaced variable CONFIGDIR with TEMPDIR. This change updates the config file to version 11
* Fixed some spacings issues by moving around some echo's
* Simplified the sample encoding code. Reduced some code duplication
* Upped psy_rd from 0.6 to 0.8

microchip8
15th August 2009, 11:46
ChangeLog for version 9.0.0
* Renamed presets f9 and f9hq to fl and flhq
* Added new preset 'fghq' specifically optimized for preserving film grain
* Removed duplicate videofilters variable. This removes the check for the tfields filter as now deinterlacing
will always be done after cropping (which also speeds up things a bit) so the crop filter will never complain
about crop area being outside of the original if tfields is used. It also reduces filters maintenance a bit
* Turn soft-clipping on in the volume audio filter
* Use aq_mode=1 for presets that have mbtree enabled as it usually does better on fades than aq_mode=2
* Updated the man page

WalterK
25th August 2009, 18:16
I am having random failures when trying to create a mkv and mp4 file from a specific chapter rip of a dvd.

This is the latest one

-> Converting AVI file to the MKV container, please wait...
-> Failed!

-> Converting AVI file to the MP4 container, please wait...
*** buffer overflow detected ***: /usr/bin/MP4Box terminated
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6(__fortify_fail+0x48)[0xb7c38da8]
/lib/tls/i686/cmov/libc.so.6[0xb7c36eb0]
/lib/tls/i686/cmov/libc.so.6(__strcpy_chk+0x44)[0xb7c36184]
/usr/bin/MP4Box[0x804f58d]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe5)[0xb7b51775]
/usr/bin/MP4Box[0x804cea1]
======= Memory map: ========
08048000-0806f000 r-xp 00000000 08:27 1094450 /usr/bin/MP4Box
0806f000-08071000 r--p 00026000 08:27 1094450 /usr/bin/MP4Box
08071000-08072000 rw-p 00028000 08:27 1094450 /usr/bin/MP4Box
084bf000-084e0000 rw-p 084bf000 00:00 0 [heap]
b7954000-b7961000 r-xp 00000000 08:27 2719809 /lib/libgcc_s.so.1
b7961000-b7962000 r--p 0000c000 08:27 2719809 /lib/libgcc_s.so.1
b7962000-b7963000 rw-p 0000d000 08:27 2719809 /lib/libgcc_s.so.1
b7963000-b7964000 rw-p b7963000 00:00 0
b7964000-b7966000 r-xp 00000000 08:27 2737489 /lib/tls/i686/cmov/libdl-2.9.so
b7966000-b7967000 r--p 00001000 08:27 2737489 /lib/tls/i686/cmov/libdl-2.9.so
b7967000-b7968000 rw-p 00002000 08:27 2737489 /lib/tls/i686/cmov/libdl-2.9.so
b7968000-b7969000 rw-p b7968000 00:00 0
b7969000-b797e000 r-xp 00000000 08:27 2737509 /lib/tls/i686/cmov/libpthread-2.9.so
b797e000-b797f000 r--p 00014000 08:27 2737509 /lib/tls/i686/cmov/libpthread-2.9.so
b797f000-b7980000 rw-p 00015000 08:27 2737509 /lib/tls/i686/cmov/libpthread-2.9.so
b7980000-b7982000 rw-p b7980000 00:00 0
b7982000-b7ab5000 r-xp 00000000 08:27 2722220 /lib/i686/cmov/libcrypto.so.0.9.8
b7ab5000-b7abd000 r--p 00132000 08:27 2722220 /lib/i686/cmov/libcrypto.so.0.9.8
b7abd000-b7aca000 rw-p 0013a000 08:27 2722220 /lib/i686/cmov/libcrypto.so.0.9.8
b7aca000-b7ace000 rw-p b7aca000 00:00 0
b7ace000-b7b10000 r-xp 00000000 08:27 2722221 /lib/i686/cmov/libssl.so.0.9.8
b7b10000-b7b11000 ---p 00042000 08:27 2722221 /lib/i686/cmov/libssl.so.0.9.8
b7b11000-b7b12000 r--p 00042000 08:27 2722221 /lib/i686/cmov/libssl.so.0.9.8
b7b12000-b7b15000 rw-p 00043000 08:27 2722221 /lib/i686/cmov/libssl.so.0.9.8
b7b15000-b7b39000 r-xp 00000000 08:27 2737491 /lib/tls/i686/cmov/libm-2.9.so
b7b39000-b7b3a000 r--p 00023000 08:27 2737491 /lib/tls/i686/cmov/libm-2.9.so
b7b3a000-b7b3b000 rw-p 00024000 08:27 2737491 /lib/tls/i686/cmov/libm-2.9.so
b7b3b000-b7c97000 r-xp 00000000 08:27 2737483 /lib/tls/i686/cmov/libc-2.9.so
b7c97000-b7c98000 ---p 0015c000 08:27 2737483 /lib/tls/i686/cmov/libc-2.9.so
b7c98000-b7c9a000 r--p 0015c000 08:27 2737483 /lib/tls/i686/cmov/libc-2.9.so
b7c9a000-b7c9b000 rw-p 0015e000 08:27 2737483 /lib/tls/i686/cmov/libc-2.9.so
b7c9b000-b7c9f000 rw-p b7c9b000 00:00 0
b7c9f000-b7cb3000 r-xp 00000000 08:27 2719905 /lib/libz.so.1.2.3.3
b7cb3000-b7cb4000 r--p 00013000 08:27 2719905 /lib/libz.so.1.2.3.3
b7cb4000-b7cb5000 rw-p 00014000 08:27 2719905 /lib/libz.so.1.2.3.3
b7cb5000-b7f2e000 r-xp 00000000 08:27 1094409 /usr/lib/libgpac-0.4.4.so
b7f2e000-b7f2f000 r--p 00279000 08:27 1094409 /usr/lib/libgpac-0.4.4.so
b7f2f000-b7f33000 rw-p 0027a000 08:27 1094409 /usr/lib/libgpac-0.4.4.so
b7f33000-b7f35000 rw-p b7f33000 00:00 0
b7f51000-b7f53000 rw-p b7f51000 00:00 0
b7f53000-b7f54000 r-xp b7f53000 00:00 0 [vdso]
b7f54000-b7f70000 r-xp 00000000 08:27 2719767 /lib/ld-2.9.so
b7f70000-b7f71000 r--p 0001b000 08:27 2719767 /lib/ld-2.9.so
b7f71000-b7f72000 rw-p 0001c000 08:27 2719767 /lib/ld-2.9.so
bfa47000-bfa72000 rw-p bffd5000 00:00 0 [stack]
-> Failed!

-> AVI file size: 182.631 MiB (/home/walter/encodes/chapter3 - chapter 3-3.avi)

Delete the AVI file? [y/n]: n

-> Have a nice day ^_^

Mplayer/Mencoder SVN-r29544-4.3.3 (C) 2000-2009 MPlayer Team
x264 core:72 r1222 d0ee6f8
gpac/libgpac 0.4.4-3
mkvtoolnix 2.9.8
faac/libfaac 1.26
aacplusenc 0.17
neroAacEnc 1.3.3.0

It randomly fails on mkv or mp4 creation depending on what aac encoder and what bitrate setting is used (all the default ones are selected), its the only thing i can think of since the encoding with libx264 works
here is the setting
h264enc -2p -p vdhq
With deinterlacing (default settings, crop to 720x352
Sure i can create my own mp4/mkv file but i am trying to figure out why that fails in h264enc

microchip8
25th August 2009, 18:27
h264enc doesn't fail in this case. It's the muxing programs that do. Probably, your muxing programs are mis-compiled or broken in some way. I also use mkvmerge 2.9.8 and MP4Box 0.4.5 (newer than yours and self-compiled) and have not experienced any problems with them. On occasion, and this is very rare, MP4Box will crash and there's little I can do about it. Blame it on it being cr@p :P

Also, I do not really use any exotic parameters for the muxers and everything is done according to documentation

EDIT: it'll be nice if you save the settings to the batch file and post them here so I can see what you use

WalterK
26th August 2009, 01:44
yes with the exception of mplayer,X264 (which are compiled), neroAacEnc and mkvtoolnix (which comes from bunkus' own repos listed at his site) all the addons required come from the stock ubuntu 9.04 repos.
I guess that could be a problem with Mp4Box but it doesnt explain why mkvmerge fails, however take the same avi run it through mp4box and mkvmerge (via the gui) and it outputs to mp4 and mkv fine.

I wished i had saved the settings i'll run another encode again tonight and post it.

microchip8
26th August 2009, 09:15
My mkvmerge also comes from Moritz' repo and I have yet to see it fail on me. Like I said, unless you show me the settings used from the batchfile, I can't really do much and can only speculate. Also you should remux that avi through the terminal and not using the gui, in order to replicate how h264enc does it as close as possible

WalterK
26th August 2009, 16:37
Ok heres my settings used, this time libfaac instead of accplusenc like the last time and this time mp4 output was successful but mkvmerge failed, i also compiled gpac using the 0.4.5 source
so here it is mkvmerge failure output

-> Converting AVI file to the MKV container, please wait...
-> Failed!

And the settings used

#!/bin/bash
################### START OF COMMANDS ###################

test -d "/home/walter/downloads" || mkdir -p "/home/walter/downloads"
test -d /home/walter/.h264enc/job4976 || mkdir -p /home/walter/.h264enc/job4976
test -e "/home/walter/encodes/chapter3 - chapter 3-3.avi" && mv -f "/home/walter/encodes/chapter3 - chapter 3-3.avi" "/home/walter/encodes/chapter3 - chapter 3-3.avi.old"

/usr/bin/mencoder "dvd://3" -o /dev/null -passlogfile "/home/walter/.h264enc/job4976/chapter3 - chapter 3-3.log" -vc mpeg12 -dvd-device /home/walter/encodes/montanareview -chapter 3-3 -ofps 30000/1001 -vf yadif=0,crop=720:352:0:66,softskip,harddup -field-dominance -1 -aspect 1.3333 -aid 128 -oac faac -faacopts mpeg=4:br=110:object=2 -ovc x264 -x264encopts pass=1:bitrate=1500:turbo=2:me=umh:me_range=24:nodct_decimate:nointerlaced:8x8dct:nofast_pskip:trellis=1:partitions=p8x8,b8x8,i8x8,i4x4:mixed_refs:keyint=300:keyint_min=30:psy_rd=0.8,0.2:frameref=4:bframes=3:b_adapt=2:nob_pyramid:weight_b:direct_pred=auto:subq=7:mbtree:chroma_me:cabac:aq_mode=2:deblock:vbv_maxrate=50000:vbv_bufsize=50000:level_idc=41:threads=auto:ssim:psnr

/usr/bin/mencoder "dvd://3" -o "/home/walter/encodes/chapter3 - chapter 3-3.avi" -passlogfile "/home/walter/.h264enc/job4976/chapter3 - chapter 3-3.log" -vc mpeg12 -dvd-device /home/walter/encodes/montanareview -chapter 3-3 -ofps 30000/1001 -vf yadif=0,crop=720:352:0:66,softskip,harddup -field-dominance -1 -aspect 1.3333 -aid 128 -oac faac -faacopts mpeg=4:br=110:object=2 -ovc x264 -x264encopts pass=2:bitrate=1500:me=umh:me_range=24:nodct_decimate:nointerlaced:8x8dct:nofast_pskip:trellis=1:partitions=p8x8,b8x8,i8x8,i4x4:mixed_refs:keyint=300:keyint_min=30:psy_rd=0.8,0.2:frameref=4:bframes=3:b_adapt=2:nob_pyramid:weight_b:direct_pred=auto:subq=7:mbtree:chroma_me:cabac:aq_mode=2:deblock:vbv_maxrate=50000:vbv_bufsize=50000:level_idc=41:threads=auto:ssim:psnr




sleep 2

test -e "/home/walter/encodes/chapter3 - chapter 3-3.mkv" && mv -f "/home/walter/encodes/chapter3 - chapter 3-3.mkv" "/home/walter/encodes/chapter3 - chapter 3-3.mkv.old"
/usr/bin/mkvmerge --attachment-mime-type image/jpeg --attachment-name Cover --attach-file "/home/walter/encodes/image.jpg" --title "chapter3 - chapter 3-3" --track-name 0:"chapter3 - chapter 3-3" --language 1:aid: --track-name 1:"LC-AAC Stereo" "/home/walter/encodes/chapter3 - chapter 3-3.avi" -o "/home/walter/encodes/chapter3 - chapter 3-3.mkv"
sleep 2

test -e "/home/walter/encodes/chapter3 - chapter 3-3.mp4" && mv -f "/home/walter/encodes/chapter3 - chapter 3-3.mp4" "/home/walter/encodes/chapter3 - chapter 3-3.mp4.old"
/usr/bin/mencoder "/home/walter/encodes/chapter3 - chapter 3-3.avi" -nosound -ovc copy -of rawvideo -o /home/walter/.h264enc/job4976/h264_video.h264
sleep 2
/usr/bin/MP4Box -aviraw audio "/home/walter/encodes/chapter3 - chapter 3-3.avi" -out /home/walter/.h264enc/job4976/aac.raw
mv -f /home/walter/.h264enc/job4976/aac_audio.raw /home/walter/.h264enc/job4976/aac_audio.aac


/usr/bin/mplayer "/home/walter/encodes/chapter3 - chapter 3-3.avi" -noconfig all -loop 1 -identify -nosound -vo null -nocache -frames 1 2>/dev/null | grep '^ID_VIDEO_FPS' | tail -n 1 | awk -F= '{print $2}' > /home/walter/.h264enc/job4976/mp4fps
/usr/bin/MP4Box -fps $(cat /home/walter/.h264enc/job4976/mp4fps) -tmp /home/walter/.h264enc/job4976 -add /home/walter/.h264enc/job4976/h264_video.h264 -add /home/walter/.h264enc/job4976/aac_audio.aac#audio:name="LC-AAC Stereo":lang=aid: -itags name="chapter3 - chapter 3-3":cover="/home/walter/encodes/image.jpg" -mpeg4 -new "/home/walter/encodes/chapter3 - chapter 3-3.mp4"


sleep 2
rm -f /home/walter/.h264enc/job4976/h264_video.h264
rm -f /home/walter/.h264enc/job4976/aac_audio.aac


sleep 2

rm -rf /home/walter/.h264enc/job4976

#################### END OF COMMANDS ####################

microchip8
26th August 2009, 16:46
That's the part that's causing mkvmerge to fail: --language 1:aid:

the aid: after the 1 should really be a language code but for some reason it isn't. I'll have to check why that is here but am using an older mencoder/mplayer revision than yours so am currently pulling from SVN and compiling a new one. Maybe something changed in mplayer. I've not had this problem with older mplayer revisions

microchip8
26th August 2009, 17:57
hmmm, I cannot reproduce your problem here even when using the latest mplayer from SVN. Tested with 4 different DVDs and all works fine here so I'm suspecting that this is specific to the DVD you used. Can you post the the output of:

mplayer dvd://1 -nosound -nocache -vo null -frames 1 2>/dev/null

At the top of this output, there are "audio stream" lines for each audio track on the DVD. Currently, I just grep for each track aid number at the end of each line and then print the 8th positional which gives me the language code. I can modify this to grep *specifically* for the language word with the -o grep option and then sed everything else with exception of the language code (or use awk '{print $2}' which is better in this case). This can be more reliable in case the DVD or mplayer does not report the "language" word for some reason, and thus will just return an empty string and further on allow the muxing to succeed but without language metadata added to the container(s) so it'll default to "und" (undefined) language

Can you test this small patch for me on the DVD that's giving you problems? - save as h264enc.diff http://pastebin.com/pastebin.php?dl=m752ef542

Apply as: patch -p0 < h264enc.diff /path/to/script/h264enc

After applying, you don't have to encode the chapter again just to see how it works. Instead, just save everything to the batchfile, hit ctrl+c when the encoding countdown starts and open the batchfile and check for the --language stuff in the mkvmerge line. It should be something like --language 1:en (for English language). If mplayer or this DVD does not report the language word, then it should be something like --language 1:und

WalterK
26th August 2009, 21:27
I did the encode anyway, its only a 19min chapter so it doesnt take that long to encode.
The muxing to mp4 and mkv now work again

-> Converting AVI file to the MKV container, please wait...
-> Done

-> Converting AVI file to the MP4 container, please wait...
-> Done

-> AVI file size: 178.983 MiB (/home/walter/encodes/chapter3 - chapter 3-3.avi)
-> MKV file size: 177.382 MiB (/home/walter/encodes/chapter3 - chapter 3-3.mkv)
-> MP4 file size: 177.537 MiB (/home/walter/encodes/chapter3 - chapter 3-3.mp4)

Delete the AVI file? [y/n]: y

-> Have a nice day ^_^



its currently on the harddrive but here it is before applied patch

mplayer dvd://3 -dvd-device /home/walter/encodes/montanareview -nosound -nocache -vo null -frames 1 2>/dev/null
MPlayer SVN-r29544-4.3.3 (C) 2000-2009 MPlayer Team

Playing dvd://3.
There are 4 titles on this DVD.
There are 1 angles in this DVD title.
audio stream: 0 format: ac3 (stereo) language: aid: 128.
number of audio channels on disk: 1.
number of subtitles on disk: 0
MPEG-PS file format detected.
VIDEO: MPEG2 720x480 (aspect 2) 29.970 fps 7800.0 kbps (975.0 kbyte/s)
==========================================================================
Forced video codec: ffmpeg12vdpau
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffmpeg12vdpau] vfm: ffmpeg (FFmpeg MPEG-1/2 (VDPAU))
==========================================================================
Audio: no sound
Starting playback...
[VD_FFMPEG] XVMC-accelerated MPEG-2.
VDec: vo config request - 720 x 480 (preferred colorspace: MPEG2 VDPAU acceleration)
VDec: using MPEG2 VDPAU acceleration as output csp (no 1)
Movie-Aspect is 1.33:1 - prescaling to correct movie aspect.
VO: [null] 720x480 => 720x540 MPEG2 VDPAU acceleration


Patch applied and settings

microchip8
26th August 2009, 22:07
ah, so the DVD does not report any language codes at all. That's why it failed and not due to missing language word. Still, the new method of finding language codes is better anyways so I'll put it in next release of h264enc ;)

Thanks for reporting!

microchip8
1st September 2009, 16:35
ChangeLog for version 9.0.1
* Simplified the audio_channels_func() function a bit
* Merged the QP and CRF settings
* Increased rc_lookahead a bit for the ehq, uhq and ihq presets
* Improved detection of DVD audio language codes. We now specifically grep for the language word and then print the 2nd positional
which gives us the language code. It works more reliably if the DVD does not report its language code for the audio track(s) so if this is
the case, we fall back to undefined language. The previous code fails in such cases due to the printing of the 8th positional which will
print the "aid:" part when there's no language code after the "language:" word, resulting in MKV/MP4 muxing failures. Reported by
WalterK from doom9.org
* Moved the code that deals with DVD subs/cover files/metadata info/chapters and external subs for the MP4 container before its audio code
* Added slicing to the Blu-ray and AVCHD presets. It increases compliancy with the Blu-ray specs. Slicing is only available in the latest x264
from git so please upgrade if you intend to use the Blu-ray/AVCHD presets
* Added new options 'slices', 'slice_max_size' and 'slice_max_mbs' to the preset.cfg file
* Fixed chapters import for the OGM container. Missing '@' before the chapters input file results in the file not being imported
* Added support for audio language metadata info for the OGM container
* Small improvements to how chapters information is added to the output file name

microchip8
4th September 2009, 22:19
ChangeLog for version 9.0.2
* Added new option sync_lookahead available in latest x264 git and updated the preset.cfg file
* Added support for the noise video filter. This change updates the config file to version 12. Also, encoding priority now defaults
to a nice value of 10 in the config file
* Moved out the code which checks and backups/renames a file if it has the same name as the output provided by the user to a
separate function called backup_file_func() and also improved it so that if there's already an existing backup file, the new one will
increase its count number by one thus there's no more overwriting being done anymore. The same thing applies to existing chapter
files and DVD subs
* Added support for Year and Genre metadata tagging for the MKV/MP4/OGM containers. For MKV, the genre and year is set globally
using an automatically generated XML file. MP4 uses the iTunes tagging and OGM the comment space
* Updated the man page

microchip8
6th September 2009, 12:41
ChangeLog for version 9.0.3
* Fixed a typo in the man page, MEnocder -> MEncoder
* Small improvement to how the MKV XML tagging file gets exported. Also improved the XML formatting and added
COMMENT string with text "Tagged by h264enc $version"
* Added comment tag for MP4 and OGM with the same text as above
* Small update to the video_deinterlace_func() function's menu
* Add comment header with dates to batch files

elektronaut
10th September 2009, 23:18
I didn't use h264enc in a little while and now installed the new version. Suddenly I have trouble in the cropping part. The preview window is not really working. It just flashes for a fraction of a second and then disappears again.

Anyone else having the same problem?

(Tried to encode a VOB file.)

microchip8
10th September 2009, 23:50
I haven't changed anything in the cropping code after your patch so this must be file specific. You can always get the cropping values from mplayer and provide them like I told you before. It works here and today I encoded a DVD

punlo
11th September 2009, 19:18
neroAAC encoder supports 2pass encoding. Could you please add this feature to your script. I know that it needs going back from fifos to regular files but the feature might be nice to have, especially if other coders start offering such feature too.

microchip8
11th September 2009, 19:23
I'll see if I will. IIRC 2pass will not get you more quality but guarantees the specified bitrate to be achieved

microchip8
11th September 2009, 21:30
neroAAC encoder supports 2pass encoding. Could you please add this feature to your script. I know that it needs going back from fifos to regular files but the feature might be nice to have, especially if other coders start offering such feature too.

You can do it just as well with FIFOs and I just did that so it'll be supported in next version of h264enc ;)

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"

microchip8
13th November 2009, 22:04
Have you already tried the two xbox presets available (mx and mxhq) ? They don't work? I don't see anything special in the above settings that'll make the already present xbox presets in the script incompatible. The only thing is that CABAC is disabled while I have it enabled in the xbox presets. Maybe xbox1 can't take CABAC?

mrplow
13th November 2009, 23:15
Those are xbox360 presets and to tell you the truth I tried them many revisions ago and many xbmc revisions ago and at the time it would stutter from time to time in high action scenes. But that was a while ago and I could try them again this weekend.
It seems the xbox1 can only handle CABAC if Deblocking is disabled and visa versa. With CABAC on and deblocking off the video is better quality but larger and with CABAC off and deblocking on the quality goes down slightly along with the file size.

microchip8
13th November 2009, 23:21
hmm, CABAC is supposed to increase compression more than CAVLC so I'm a bit at a loss why you get smaller file sizes when you disable it. If I add such a preset, then I'll only disable CABAC but leave deblocking on. Can you try the xbox presets again on a short sample and see if you still get problems with them on the xbox1?

daniel.pool
18th November 2009, 20:32
Hi,

I have a multi core cpu I was wondering if there is an option I need to be setting to make the encode multi-threaded? I got h264enc off the Karmic repository today (version 9.0.0) and am trying out a test encode but it is currently only using a single core. A quick search of this thread and the man pages hasn't revealed anything to me ... :-(

Thanks in advance.
~Dan

nm
18th November 2009, 20:36
First of all, I'd recommend getting MPlayer/MEncoder SVN, built against a recent libx264 version and then the latest h264enc version. Ubuntu provides oldish versions of these programs.

Multithreading should work with those versions too, but maybe froggy1 can guess what's going on.

microchip8
18th November 2009, 20:50
the threads=auto option is always used in h264enc so it should work. As nm said, get latest stuff from SVN/git/whatever

daniel.pool
18th November 2009, 21:22
Froggy1, nm,

Thanks for the really fast reply guys.

I've got the latest x264 from git, but I'm currently unable to get the latest mplayer from svn, one of the dependencies (I'm using this (http://ubuntuforums.org/showthread.php?t=1305181) guide on compiling mplayer-nogui, so maybe I'm building completely the wrong thing) has a broken deb. I've got a bug raised against it, so for now the only way I've been able to get h264enc working is to go with what is coming from rvm's ppa (https://launchpad.net/~rvm/+archive/testing).

I'll try upgrading as soon as a fix is made available for the deb (or someone points out I'm being thick and get pointed to the right guide for compiling on Karmic :))

microchip8
18th November 2009, 21:41
what is this broken dependency? Just go to mplayer's site, get SVN link, and pull from there. That's what I always to (though I have a script called getprog which accepts params about which software to pull from SVN, something small I've written to east it for me)

daniel.pool
18th November 2009, 22:16
what is this broken dependency?

To quote Andrew (http://ubuntuforums.org/showthread.php?t=1024592) from the Ubuntu forums: By default Ubuntu does not offer a particularly rich development environment so we need to download the required 'dev' files which are specific to Intrepid Ibex. (These files are loosely modelled on the results of the command 'sudo apt-get build-dep mplayer-nogui', I have removed some files and added others.)

The dep that was failing me was libopencore-amrnb0, as stated, there is a bug (https://bugs.launchpad.net/ubuntu/+source/opencore-amr/+bug/454026) raised against it.

However, as it turns out in researching these links to reply to you (and running the apt-get command again to try and get the error), the dependencies now actually install, which means my compilation should succeed! Huzzah.

So, I'll grab the latest h264enc once I've got the latest mplayer. Will update this with my results. Thanks very much for your help.

Thanks
~Dan

microchip8
18th November 2009, 22:23
This is why I don't use Ubuntu! They got to have the most incompetent packagers out there :P
I'm a packager myself but luckily not for Ubuntu...

So then... compile everything, first x264 then mplayer, and see if you get threading problems. Make sure to run h264enc -r to reset its config file

daniel.pool
18th November 2009, 23:06
Gaah, it's still only running on a single core :mad:

I'm pretty sure that it's not an option I've selected (I've attached my options file just to make sure).

I'm going to call it a day on this, but will look at it again tomorrow evening. I'm guessing the best way would be to call the encoder directly from the command line and see what is happening there. Is it mencoder called, or ffmpeg?

Cheers,

microchip8
18th November 2009, 23:08
better post attachments to an external site as it can take here some time before they get accepted by a mod
as for the threading. I don't have problems, neither other users who have reported that it works

kripz
19th November 2009, 09:52
Im getting errors after updating h264enc, mencoder, mplayer and ffmpeg.

Starting to encode in: 5 4 3 2 1
MPlayer SVN-r29809 (C) 2000-2009 MPlayer Team
Option x264encopts: Unknown suboption weightp
success: format: 0 data: 0x0 - 0x93a0a800
TS file format detected.
VIDEO VC1(pid=4113) AUDIO TRUEHD(pid=4352) NO SUBS (yet)! PROGRAM N. 1
Searching for VC1 sequence header... found
VIDEO: VC-1 1920x1080, 23.976 fps, header len: 30
[V] filefmt:29 fourcc:0x31435657 size:1920x1080 fps:23.976 ftime:=0.0417
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
Unknown/missing audio format -> no sound
ADecoder init failed :(
Cannot find codec for audio format 0x44485254.
==========================================================================
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 0
Opening video filter: [harddup]
Opening video filter: [softskip]
==========================================================================
Requested video codec family [wmvvc1dmo] (vfm=dmo) not available.
Enable it at compilation.
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffvc1] vfm: ffmpeg (FFmpeg WVC1)
==========================================================================
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
FATAL: Cannot initialize video driver.

Exiting...
-> MEncoder has exited with a non-zero value!
-> Exiting in function: mencoder_exit()


Trying to convert a m2ts bluray rip ripped by anydvd. Ive tried AC3 and ACC, no luck.

microchip8
19th November 2009, 13:42
@kripz

Look at the top, your libx264 is not new enough as it's missing weightp option. Pull latest x264 from git and compile it, then you may need to recompile mplayer and make sure it's linked to it, not to another older libx264 if you have one on your system

WalterK
19th November 2009, 17:12
yeah folks dont forget to keep x264 updated as well as mencoder and mplayer.

kripz
19th November 2009, 22:56
lol i totally missed that line

edit: those patches on your website are very outdated?

edit2: Doesnt look right...

Starting to encode in: 5 4 3 2 1
MEncoder SVN-r29934-4.3.2 (C) 2000-2009 MPlayer Team
success: format: 0 data: 0x0 - 0x93a0a800
TS file format detected.
VIDEO VC1(pid=4113) AUDIO TRUEHD(pid=4352) NO SUBS (yet)! PROGRAM N. 1
Searching for VC1 sequence header... found
VIDEO: VC-1 1920x1080, 23.976 fps, header len: 30
[V] filefmt:29 fourcc:0x31435657 size:1920x1080 fps:23.976 ftime:=0.0417
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
Unknown/missing audio format -> no sound
ADecoder init failed :(
Cannot find codec for audio format 0x44485254.
==========================================================================
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 0
Opening video filter: [harddup]
Opening video filter: [softskip]
==========================================================================
Requested video codec family [wmvvc1dmo] (vfm=dmo) not available.
Enable it at compilation.
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffvc1] vfm: ffmpeg (FFmpeg WVC1)
==========================================================================
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
x264 [warning]: NAL HRD parameters require VBV max bitrate and buffer size to be specified
x264 [info]: using SAR=1/1
x264 [info]: using cpu capabilities: MMX2 SSE2Fast FastShuffle SSEMisalign LZCNT
x264 [info]: profile Main, level 4.1
Pos: 0.0s 1f ( 0%) 0.00fps Trem: 0min 0mb A-V:0.000 [0:0]
1 duplicate frame(s)!
Writing header...7f ( 0%) 18.56fps Trem: 0min 0mb A-V:0.000 [0:0]
ODML: vprp aspect is 16:9.
Writing header...
ODML: vprp aspect is 16:9.
Pos: 16.8s 469f ( 0%) 7.93fps Trem: 838min 11200mb A-V:0.000 [6575:0]


Any tips? Conversion just stopped after about 30s.

Enable it at compilation.
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffvc1] vfm: ffmpeg (FFmpeg WVC1)
==========================================================================
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
x264 [warning]: NAL HRD parameters require VBV max bitrate and buffer size to be specified
x264 [info]: using SAR=1/1
x264 [warning]: DPB size (5 frames, 15667200 bytes) > level limit (4 frames, 12582912 bytes)
x264 [info]: using cpu capabilities: MMX2 SSE2Fast FastShuffle SSEMisalign LZCNT
x264 [info]: profile High, level 4.1
Pos: 0.0s 1f ( 0%) 0.00fps Trem: 0min 0mb A-V:0.000 [0:0]
1 duplicate frame(s)!
Writing header...9f ( 0%) 0.00fps Trem: 0min 0mb A-V:0.000 [0:0]
ODML: vprp aspect is 16:9.
Writing header...
ODML: vprp aspect is 16:9.
Pos: 21.3s 540f ( 0%) 8.70fps Trem: 811min 15164mb A-V:0.000 [7588:0]]
Too many audio packets in the buffer: (4096 in 10186116 bytes).
Maybe you are playing a non-interleaved stream/file or the codec failed?
For AVI files, try to force non-interleaved mode with the -ni option.
Pos: 21.4s 541f ( 0%) 8.72fps Trem: 811min 15145mb A-V:0.000 [7574:0]
Too many audio packets in the buffer: (4096 in 10186116 bytes).
Maybe you are playing a non-interleaved stream/file or the codec failed?
For AVI files, try to force non-interleaved mode with the -ni option.

Flushing video frames.
Writing index...
Writing header...
ODML: vprp aspect is 16:9.

Video stream: 7240.165 kbit/s (905020 B/s) size: 20421072 bytes 22.564 secs 541 frames
x264 [info]: frame I:3 Avg QP:10.49 size: 64271 PSNR Mean Y:72.84 U:85.74 V:85.57 Avg:73.42 Global:60.86
x264 [info]: frame P:315 Avg QP:13.35 size: 31965 PSNR Mean Y:70.60 U:82.15 V:84.17 Avg:71.03 Global:59.38
x264 [info]: frame B:223 Avg QP:13.38 size: 45558 PSNR Mean Y:57.79 U:77.69 V:80.32 Avg:58.75 Global:57.22
x264 [info]: consecutive B-frames: 30.7% 44.6% 6.1% 5.2% 3.7% 4.5% 5.2%
x264 [info]: mb I I16..4: 85.2% 9.3% 5.5%
x264 [info]: mb P I16..4: 6.0% 9.4% 0.5% P16..4: 8.8% 2.0% 1.4% 0.0% 0.0% skip:71.9%
x264 [info]: mb B I16..4: 2.5% 7.4% 0.3% B16..8: 10.6% 0.5% 0.9% direct: 6.5% skip:71.2% L0:56.9% L1:37.1% BI: 6.0%
x264 [info]: 8x8 transform intra:61.0% inter:63.1%
x264 [info]: direct mvs spatial:89.2% temporal:10.8%
x264 [info]: coded y,uvDC,uvAC intra: 61.9% 79.2% 73.9% inter: 9.0% 11.5% 9.8%
x264 [info]: i16 v,h,dc,p: 55% 14% 15% 16%
x264 [info]: i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 10% 13% 49% 4% 4% 4% 5% 4% 7%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 11% 13% 32% 7% 8% 6% 7% 6% 9%
x264 [info]: Weighted P-Frames: Y:23.8%
x264 [info]: ref P L0: 43.3% 19.7% 7.7% 11.0% 8.9% 8.3% 1.1%
x264 [info]: ref B L0: 50.0% 19.0% 19.2% 11.8%
x264 [info]: SSIM Mean Y:0.9988253
x264 [info]: PSNR Mean Y:65.330 U:80.331 V:82.595 Avg:65.983 Global:58.363 kb/s:7240.17

-> Converting AVI file to the MKV container, please wait...
-> Done

-> AVI file size: 19.491 MiB (/storage/public/Random/Fearless.avi)
-> MKV file size: 19.485 MiB (/storage/public/Random/Fearless.mkv)

microchip8
30th November 2009, 09:36
For NAL-HRD, you need to use a preset which has vbv-bufsize and vbv-maxrate set. The blu-ray/avchd presets have these. Unless you really need HRD signaling, you shouldn't use it otherwise. Also, the HRD patches are still (very) experimental

For the audio issue, it's a known problem in the default demuxer for TS files. Configure as usual, save all to the batch file, open it up and add to the mencoder line -demuxer lavf then run your encode from the batchfile. See if this fixes it for you

kripz
30th November 2009, 23:17
Ok, ill try that next time.

I'm now having another problem with another movie, not sure what it is. I didnt save the mencoder options but here they are from within the job folder.

nice -n 10 /usr/local/bin/mencoder "/storage/public/Random/BOURNE_SUPREM_G51/BDMV/STREAM/00009.m2ts" -o /dev/null -passlogfile "/home/user/.h264enc/job4653/The Bourne Supremacy.log" -vid 4113 -vf softskip,harddup -aid 4358 -channels 6 -oac copy -ovc x264 -x264encopts pass=1:bitrate=10000:turbo=2:me=tesa:me_range=64:nodct_decimate:nointerlaced:8x8dct:nofast_pskip:trellis=2:partitions=all:mixed_refs:keyint=240:keyint_min=24:psy_rd=0.8,0.2:frameref=10:bframes=7:b_adapt=2:b_pyramid=none:weight_b:weightp=2:direct_pred=auto:subq=10:mbtree:rc_lookahead=60:chroma_me:cabac:aq_mode=1:deblock:level_idc=41:threads=auto:ssim:psnr
nice -n 10 /usr/local/bin/mencoder "/storage/public/Random/BOURNE_SUPREM_G51/BDMV/STREAM/00009.m2ts" -o "/storage/public/Random/The Bourne Supremacy.avi" -passlogfile "/home/user/.h264enc/job4653/The Bourne Supremacy.log" -vid 4113 -vf softskip,harddup -aid 4358 -channels 6 -oac copy -ovc x264 -x264encopts pass=2:bitrate=10000:me=tesa:me_range=64:nodct_decimate:nointerlaced:8x8dct:nofast_pskip:trellis=2:partitions=all:mixed_refs:keyint=240:keyint_min=24:psy_rd=0.8,0.2:frameref=10:bframes=7:b_adapt=2:b_pyramid=none:weight_b:weightp=2:direct_pred=auto:subq=10:mbtree:rc_lookahead=60:chroma_me:cabac:aq_mode=1:deblock:level_idc=41:threads=auto:ssim:psnr


Starting the second pass of the encoding process in: 5 4 3 2 1
MEncoder SVN-r29934-4.3.2 (C) 2000-2009 MPlayer Team
success: format: 0 data: 0x0 - 0xf7a51000
TS file format detected.
VIDEO VC1(pid=4113) AUDIO A52(pid=4358) NO SUBS (yet)! PROGRAM N. 1
Searching for VC1 sequence header... found
VIDEO: VC-1 1920x1080, 23.976 fps, header len: 30
[V] filefmt:29 fourcc:0x31435657 size:1920x1080 fps:23.976 ftime:=0.0417
==========================================================================
Opening audio decoder: [liba52] AC3 decoding with liba52
Using SSE optimized IMDCT transform
Unimplemented resampler for mode 0xA -> 6 channels conversion - Contact MPlayer developers!
Unimplemented resampler for mode 0xA -> 5 channels conversion - Contact MPlayer developers!
Unimplemented resampler for mode 0xA -> 4 channels conversion - Contact MPlayer developers!
Unimplemented resampler for mode 0xA -> 3 channels conversion - Contact MPlayer developers!
Using MMX optimized resampler
AUDIO: 48000 Hz, 2 ch, s16le, 192.0 kbit/12.50% (ratio: 24000->192000)
Selected audio codec: [a52] afm: liba52 (AC3-liba52)
==========================================================================
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 0
Opening video filter: [harddup]
Opening video filter: [softskip]
==========================================================================
Requested video codec family [wmvvc1dmo] (vfm=dmo) not available.
Enable it at compilation.
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffvc1] vfm: ffmpeg (FFmpeg WVC1)
==========================================================================
audiocodec: framecopy (format=2000 chans=2 rate=48000 bits=16 B/s=24000 sample-1)
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
x264 [warning]: NAL HRD parameters require VBV max bitrate and buffer size to be specified
x264 [info]: using SAR=1/1
x264 [warning]: DPB size (10 frames, 31334400 bytes) > level limit (4 frames, 12582912 bytes)
x264 [info]: using cpu capabilities: MMX2 SSE2Fast FastShuffle SSEMisalign LZCNT
x264 [info]: profile High, level 4.1
Pos: 0.0s 1f ( 0%) 0.15fps Trem: 0min 0mb A-V:0.000 [0:0]
1 duplicate frame(s)!
Writing header...3f ( 0%) 4.69fps Trem: 0min 0mb A-V:0.027 [0:0]
ODML: vprp aspect is 16:9.
Setting audio delay to 0.042s.
Writing header...
ODML: vprp aspect is 16:9.
Setting audio delay to 0.042s.
Pos: 112.2s 2722f ( 1%) 0.21fps Trem:13956min 6193mb A-V:0.036 [6746:192]


I've never seen it drop down to those speeds before. This was after compiling and updating most of the required programs although its a new Bluray that i got.

Also, instead of defaulting the jobs to the home directory, can you please make it specifiable? my home directory isnt very big.

microchip8
30th November 2009, 23:21
did you compile x264 with asm? yasm enabled?

for the job directory, you can already do that in the config file. Look at the TEMPDIR variable in /home/username/.h264enc/config and set it there

microchip8
1st December 2009, 02:00
Just came back from the pub ;)
Looking again at your settings, no wonder you'll get such slow speeds (even on Quad cores). You got 10 frame references, 7 bframes with badapt=2, subq of 10, trellis of 2, me_range of 64, weigthp=2, mbtree on, me=tesa and lookahead of 60. This combined with a resolution of 1920x1080 will be pretty slow, even on quad cores and some of the settings are placebo-like (me=tesa f.ex). I bet you're using the insane high quality preset, huh? This preset is a "troll" preset, for those who think they'll see the difference between it and the EHQ preset, and of course for the Japs who love crazy settings ;)

My advice: do not go above the EHQ preset. I always use VHQ but only because my system is a bit slow. Nevertheless, it produces very nice results

kripz
1st December 2009, 09:07
Ah yep, i wanted to try a new setting. baited:devil:

did you compile x264 with asm? yasm enabled?
Well all i did was configure and make. no special options. Will those 2 enable better performance? Google doesnt have much regarding this, ill have to search around here for all the switches that will enable higher performance.

microchip8
1st December 2009, 15:22
If you haven't done so, recompile x264 with asm support by installing yasm. Without asm enabled, x264 will be DOG SLOW ;)

so after installing yasm, just do ./configure --enable-shared && make && sudo make install

kripz
3rd December 2009, 23:25
Done. I had an idea for this program, perhaps consider adding an option to send an email once conversion is done (as i run this on a headless box).

Would something like this do as i described?

if [ -f "$BATCH" ]; then
cp -f $BATCH $HOME
source $BATCH
echo ""
brown "-> Have a nice day ^_^"
echo ""
echo "Converting blah completed `date`" | mail blah@blah.com -s "h264enc conversion complete"
rmconf
else

microchip8
3rd December 2009, 23:48
Yes, but you need a working/configured smtp running on the machine you're executing the h264enc script. So you should tell it to use an external smtp server (like that of your isp) ;)

microchip8
10th December 2009, 13:59
ChangeLog for version 9.1.1
* Disabled weightp for the AppleTV presets
* Added new option sliced_threads present in latest x264 from git
* Enabled b_pyramid for some presets that use mbtree as it now works with mbtree
* Updated the preset.cfg file. Added sliced_threads option
* Changed all video ALLOW_* variables in the config file to ALLOW_VID_*
* When using dd to dump a DVD to an ISO, use options noerror,sync and a bs size of 2048
* Added support for sending mails. This requires the 'mailx' program and a valid .mailrc file in the home directory.
Mail notification can be enabled in the config file of h264enc which also offers an example of a gmail setting for .mailrc
* Bumped config file version to 13
* Updated copyright dates

microchip8
23rd December 2009, 02:36
ChangeLog for version 9.1.2
* Fixed a severe bug that can cause in some cases severe data loss when using a custom temp directory.
It manifests itself when using a 'top' directory as custom temp directory such as a partition mount point or even
the user's home directory. In such cases, the top directory will be deleted upon script termination or when encoding
finishes, resulting in possible massive data loss due to rm -rf $TEMPDIR if TEMPDIR was set to, for example, /home/username
or points to a mount point or another directory that may be important to the user.
From now on, always use a job<pid> directory inside the one set in the TEMPDIR variable so it'll only delete the job<pid>
directory and not its parent one, minimizing possibility of a data loss disaster
* Set nomixed_refs for the iphq/iphhq presets

kripz
27th December 2009, 10:25
Does h264enc support decoding of a single DTS + AC3 audio stream?

microchip8
27th December 2009, 13:52
Yes, but only for DVDs at the moment. Also DTS is a bit problematic as I always get skipped frames and haven't looked much on how to fix it. For file encodings, only 1 audio track is supported but if you export the settings to the batchfile, you can modify it for two tracks and encode from there

Redsandro
6th January 2010, 15:05
Wow this is so nice, thanks!

I have one issue I'm wondering about. Pretty much always when I convert a random batch of television shows to a 320x240 mp4 using the symbian60 preset and all defaults (except for resolution), right at the start there's a bunch of random SKIPPING FRAME messages. About 5 or so. That causes a loss of AV sync. Any idea why this happens?

microchip8
6th January 2010, 15:58
No idea really, but a few skipped frames at the beginning shouldn't cause any noticeable A/V sync issues, and mencoder most of the time compensates as it adjusts its a/v sync due to this

Redsandro
13th January 2010, 11:40
Wow.. what? Who?

nm
13th January 2010, 12:12
Looks like someone's testing a chatterbot.

elektronaut
17th January 2010, 03:50
Hi,

I've got the problem that MEncoder is exiting with this message:
-a52drc is not an MEncoder option
Using latest h264enc and also latest versions (tarballs) of x264, ffmpeg and mplayer.

microchip8
17th January 2010, 03:55
Hi,

I've got the problem that MEncoder is exiting with this message:
-a52drc is not an MEncoder option
Using latest h264enc and also latest versions (tarballs) of x264, ffmpeg and mplayer.

I guess they removed dynamic range compression control. I'll have to see if they have replaced that option with something else or just removed it and then update script accordingly :)

microchip8
17th January 2010, 15:37
@elektronaut

Alright, I looked around and it seems latest mplayer from svn needs external liba52 library. If it's not detected during configure, then the -a52drc option will be disabled. However, there's a --enable-liba52-internal option in configure which enables mplayer's internal liba52 if one doesn't have or want to link against an external liba52. I've no idea why the mplayer devs have chosen to disable completely liba52 if an external liba52 is not detected instead of enabling the internal one. Maybe it's a bug in configure, no idea.

The -a52drc option is still present in cfg-common-opts.h... so either install external liba52 lib, or configure with --enable-liba52-internal and compile again.

EDIT: seems according to a guy in #mplayerdev that there was a commit which disables internal liba52 because libavcodec supports it. It also said that if no one objects, internal liba52 will be removed in a few months.... so I'm thinking of removing the -a52drc option in h264enc (it's not mandatory and one can do without DRC control anyways)

microchip8
19th January 2010, 18:48
ChangeLog for version 9.1.3
* Made the TEMPDIR variable escape spaces in directory names
* Small update to the mkvtags_func() function
* Removed the -a52drc option for AC3 encoding
* Added new x264 intra_refresh option to the script and the preset.cfg file
* Added two new variables, DVD_DEVICE and CDROM_DEVICE, to the config file where user can set a default block
device to encode from. This updates the config file to version 14
* Merged the get_dvd_devices_func() and get_vcd_devices_func() functions into a new one called get_devices_func()

Redsandro
20th January 2010, 13:33
Nice!

Any idea why MEncoder skips so many frames? ~6 frames on every video I encode for my phone, always within the first 2 seconds , just enough to make every action movie gunshot explosion badly annoying. :P

(scroll down to the end)
MEncoder SVN-r29237-4.4.1 (C) 2000-2009 MPlayer Team
success: format: 0 data: 0x0 - 0x15e34000
AVI file format detected.
[aviheader] Video stream found, -vid 0
[aviheader] Audio stream found, -aid 1
VIDEO: [XVID] 624x464 12bpp 23.976 fps 964.5 kbps (117.7 kbyte/s)
[V] filefmt:3 fourcc:0x44495658 size:624x464 fps:23.976 ftime:=0.0417
==========================================================================
Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
AUDIO: 48000 Hz, 2 ch, s16le, 32.0 kbit/2.08% (ratio: 4000->192000)
Selected audio codec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3)
==========================================================================
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
Opening video filter: [harddup]
Opening video filter: [unsharp=l5x5:1:c5x5:-0.2]
Opening video filter: [scale w=320 h=240 interlaced=0 chr-drop=0]
Opening video filter: [softskip]
Opening video filter: [pp=al:c]
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffodivx] vfm: ffmpeg (FFmpeg MPEG-4)
==========================================================================
VDec: vo config request - 624 x 464 (preferred colorspace: Planar YV12)
[PP] Using external postprocessing filter, max q = 6.
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is 1.34:1 - prescaling to correct movie aspect.
SwScaler: reducing / aligning filtersize 40 -> 20
SwScaler: reducing / aligning filtersize 40 -> 20
SwScaler: reducing / aligning filtersize 40 -> 19
SwScaler: reducing / aligning filtersize 40 -> 19
[swscaler @ 0x3e4240]Bicubic spline scaler, from yuv420p to yuv420p using MMX2
[swscaler @ 0x3e4240]using n-tap MMX scaler for horizontal luminance scaling
[swscaler @ 0x3e4240]using n-tap MMX scaler for horizontal chrominance scaling
[swscaler @ 0x3e4240]using n-tap MMX scaler for vertical scaling (YV12 like)
[swscaler @ 0x3e4240]624x464 -> 320x240
unsharp: 5x5:1.00 (sharpen luma)
unsharp: 5x5:-0.20 (blur chroma)
Opening video filter: [scale]
x264 [info]: using SAR=161/160
x264 [warning]: MB rate (7192) > level limit (6000)
x264 [info]: using cpu capabilities: MMX2 SSE2 Cache64
x264 [info]: profile Baseline, level 1.2
Writing header...2f ( 0%) 0.00fps Trem: 0min 0mb A-V:0.004 [0:0]
ODML: vprp aspect is 16384:12211.
Writing header...
ODML: vprp aspect is 16384:12211.
Pos: 0.8s 21f ( 0%) 0.00fps Trem: 0min 0mb A-V:0.083 [0:5]
Skipping frame!
Pos: 1.2s 31f ( 0%) 0.00fps Trem: 0min 0mb A-V:0.083 [11:5]
Skipping frame!
Pos: 1.5s 41f ( 0%) 37.21fps Trem: 0min 0mb A-V:0.083 [9:5]]
Skipping frame!
Pos: 1.9s 51f ( 0%) 38.46fps Trem: 0min 0mb A-V:0.083 [8:27]
Skipping frame!
Pos: 2.3s 61f ( 0%) 36.24fps Trem: 0min 0mb A-V:0.083 [106:53]
Skipping frame!
Pos: 2.8s 73f ( 0%) 32.65fps Trem: 0min 0mb A-V:0.084 [394:75]
Skipping frame!

microchip8
20th January 2010, 13:40
I've no idea.... does the skipping continue throughout the whole encode or does it only occur at the beginning and for a very short period? What are your encoding settings (save to batchfile & post here). Did you force a specific framerate? Can you post a sample of the original?

Redsandro
20th January 2010, 13:57
It comes only at the beginning, usually within two seconds.

I am converting old shows to run on my Symbian phone from DVD colletions I have that were recorded in 4:3 aspect ratio because they fit nicely on my phone screen. Such as X-files and Friends. I use downloaded rips of these seasons because I use my headless server to do the encoding and it takes about 2 days for a season and I am too lazy to figure out how to use DVD's and swap them all the time.

But although downloading rips for private use of video you own is legal where I live (Netherlands), uploading is not and would violate rule 6 here.

#!/bin/bash
################### START OF COMMANDS ###################

cd "/var/media/160/01"
test -d "/home/sander/h264enc_3351" || mkdir -p "/home/sander/h264enc_3351"

for i in *; do

test -d /home/sander/.h264enc/job3351 || mkdir -p /home/sander/.h264enc/job3351

/usr/bin/mencoder "$i" -o "/home/sander/h264enc_3351/${i%.*}.avi" -vf pp=al:c,softskip,scale=320:240:0:0,unsharp=l5x5:1:c5x5:-0.2,harddup -sws 10 -af volnorm=2,lavcresample=44100:16:1 -srate 44100 -channels 2 -oac faac -faacopts mpeg=4:br=80:tns:object=2 -ovc x264 -x264encopts bitrate=384:me=hex:dct_decimate:nointerlaced:no8x8dct:nofast_pskip:trellis=0:partitions=p8x8,i4x4:mixed_refs:keyint=240:keyint_min=24:psy_rd=0.8,0.0:frameref=2:bframes=0:b_adapt=0:nob_pyramid:noweight_b:direct_pred=none:subq=6:chroma_me:nocabac:aq_mode=2:deblock:vbv_maxrate=384:vbv_bufsize=900:level_idc=12:threads=auto:ssim:psnr

test -e "/home/sander/h264enc_3351/${i%.*}.mp4" && mv -f "/home/sander/h264enc_3351/${i%.*}.mp4" "/home/sander/h264enc_3351/${i%.*}.mp4.old"
/usr/bin/mencoder "/home/sander/h264enc_3351/${i%.*}.avi" -nosound -ovc copy -of rawvideo -o /home/sander/.h264enc/job3351/h264_video.h264
sleep 2
/usr/bin/MP4Box -aviraw audio "/home/sander/h264enc_3351/${i%.*}.avi" -out /home/sander/.h264enc/job3351/aac.raw
mv -f /home/sander/.h264enc/job3351/aac_audio.raw /home/sander/.h264enc/job3351/aac_audio.aac


/usr/bin/mplayer "/home/sander/h264enc_3351/${i%.*}.avi" -noconfig all -loop 1 -identify -nosound -vo null -nocache -frames 1 2>/dev/null | grep '^ID_VIDEO_FPS' | tail -n 1 | awk -F= '{print $2}' > /home/sander/.h264enc/job3351/mp4fps
/usr/bin/MP4Box -fps $(cat /home/sander/.h264enc/job3351/mp4fps) -tmp /home/sander/.h264enc/job3351 -add /home/sander/.h264enc/job3351/h264_video.h264 -add /home/sander/.h264enc/job3351/aac_audio.aac#audio:name="LC-AAC Stereo" -itags name="${i%.*}" -mpeg4 -new "/home/sander/h264enc_3351/${i%.*}.mp4"


sleep 2
rm -f /home/sander/.h264enc/job3351/h264_video.h264
rm -f /home/sander/.h264enc/job3351/aac_audio.aac


sleep 2

rm -f "/home/sander/h264enc_3351/${i%.*}.avi"
rm -rf /home/sander/.h264enc/job3351

done

#################### END OF COMMANDS ####################

-edit-
disclaimer

Source as strikeprevention because no one ever believes dutch lawUnder the updated Dutch Copyright Act, digital copying for private purposes is allowed. However, right holders are compensated for the losses by a levy on recording media – e.g. recordable CDs and DVDs, audio- and videotapes and, possibly, hard-discs.http://www.euro-copyrights.org/index/1/10
Downloading is considered copying, while uploading is considered spreading. The latter is not legal.

microchip8
20th January 2010, 14:07
Well, this is not unusual for the first few frames to get skipped so that mencoder can adjust its A/V synchronization. It may become a problem if this continues throughout the whole encoding. When I encode DVDs, I also get at the very beginning a few frames skipped but the rest is fine. Do you get any problems with these few skipped frames at the beginning? If not, then ignore them. If yes, you can completely disable mencoder's sync by adding to its arguments -mc 0 but beware that this can cause a lot more problems that it can solve. Other than that, unless I have a sample of the original you try to encode, I can't do much. The above settings look fine to me

PS: uploading a sample of the original you own is not considered a rule 6 violation on this forum. Many people upload samples to help out development or troubleshoot problems ;)

Redsandro
20th January 2010, 14:32
Oh so it's sort of synchronization compensation! Well during speech I hardly notice it, but when shots are fired I can clearly see it's off. So I thought it was some error that introduced 0.2 seconds of audio-lack-behind.
But how can MEncoder think there's a sync issue when it has no ears? The source is good.

I thought I'd give you a sample then, for educational fair use purposes and stuff, but I cannot quickly find an example where a machine gun is fired (because then you could easily see the sync problem) and I need to go to work. In stead I found a single gunshot but with a keen eye you can clearly see a ~0.2 sec sync issue and you'd have to trust me that in some cases it will be more annoying than it looks. :)

The original, correct sync: (6 second snippet)
http://red.chillosophy.nl/trash/xfile0124/x0124orig.avi

The mp4 s60 encode, audio comes later because 6 frames are missing from the start (not included) (6 second snippet)
http://red.chillosophy.nl/trash/xfile0124/x0124s60.mp4

Here's a snip from the start of the original, because the missing frames on encodes always occur at the start: (9 second snippet)
http://red.chillosophy.nl/trash/xfile0124/x0124start.avi

microchip8
20th January 2010, 15:31
Mencoder doesn't need ears to adjust a/v sync ;) it has an internal algorithm to do this (though it's not perfect, but then what is?). I watched the mp4 (audio is a bit out of sync in the mp4 while playing under mplayer but the mp4 is not directly coming from h264enc - you used avidemux and I've no idea how it deals with sync) and the other two avi files, but I cannot spot any sync issues, though I must note that mine ears are not that fine-tuned ;)

As for what you can do, you may need to play around with -delay and/or -mc options of mencoder. Currently, h264enc doesn't support (yet) any way of adjusting these options

nm
20th January 2010, 15:33
The original, correct sync: (6 second snippet)
http://red.chillosophy.nl/trash/xfile0124/x0124orig.avi

The mp4 s60 encode, audio comes later because 6 frames are missing from the start (not included) (6 second snippet)
http://red.chillosophy.nl/trash/xfile0124/x0124s60.mp4

A/V sync is identical in these clips when played back with MPlayer or VLC. I also tried changing the sync by 0.2 seconds (to both directions) in the other file and then there was a difference. Which players have you tried?

Redsandro
20th January 2010, 15:50
Yes I used AviDemux to cut a snip out of my full encode. I used copy stream (it snaps to keyframes) and I thought it made an identical copy like that.
Thanks for the advise though. I might want to try -mc 0 on my next batch.

A/V sync is identical in these clips when played back with MPlayer or VLC. I also tried changing the sync by 0.2 seconds (to both directions) in the other file and then there was a difference. Which players have you tried?

A/V sync is not identical here when using:
MPC (win)
MPC-HC (win) (I think that one uses ffdshow internally, not sure)
VLC (win)
RealPlayer (I know! But it comes with Symbian S60 and for once it's pretty good at it. :P)

Note that you need an accurate observational A/V sync internally if you know what I mean. It's only a small difference.

I am sorry I did not try linux players because I use my server with ssh for cool stuff like h264enc but for anything other than text I use my windows machine.

nm
20th January 2010, 16:02
A/V sync is not identical here when using:
MPC (win)
MPC-HC (win) (I think that one uses ffdshow internally, not sure)
VLC (win)
RealPlayer (I know! But it comes with Symbian S60 and for once it's pretty good at it. :P)

Note that you need an accurate observational A/V sync internally if you know what I mean. It's only a small difference.

Well, I controlled my test by changing the sync, in which case I could hear a difference between the samples, but originally I didn't notice any difference. Did you try these sample clips in all those players too? Maybe they are different from your full encodes.

Redsandro
20th January 2010, 16:10
Yes I tried the samples before I uploaded and just now I tried them in VLC. I do notice the difference or I am really getting crazy. Maybe it's not 200ms because that was just a 6 frame guess. A wrong guess btw, 6 frames would be about 250ms in this case.

I watch sometimes when I need to travel by train to work, school or friends. When I come across a more obvious example I will post another example.

microchip8
21st January 2010, 06:24
ChangeLog for version 9.1.4
* Set default H.264 level to 'auto' and also accept integer numbers as levels in addition to accepting fixed point ones,
ie both 41 and 4.1 are now accepted as valid levels
* Renamed the rmconf() function to rmtemp()
* Moved creation of temp dir, the interrupt_func() and rmtemp() functions at the beginning of the script
* Fixed a bug in the DVD part of the -scan option where lsdvd doesn't get a valid device passed. Bug was introduced due to
changes in the new get_devices_func() function
* Reduced duplication in the mencoder_opts() function
* Various small code improvements

microchip8
30th January 2010, 16:47
ChangeLog for version 9.1.5
* Reduced duplication in the audio encode exporting code by moving it inside functions
* Reduced duplication in the MKV/MP4/TS/OGM exporting code by moving it inside functions
* Reduced duplication in the code that prints some information before encoding starts
* Various minor code improvements

kripz
31st January 2010, 13:29
Not sure if it's me but i just upgraded to h264enc to 9.1.5, mplayer and x264. h264enc says mencoder doesnt have h.264 support in mencoder?

h264enc -r followed by -sc
-> Checking for 'MPlayer'..................... OK
-> Checking for 'MEncoder'.................... OK
-> H.264 video support in MEncoder............ NO
-> AAC (FAAC) audio support in MEncoder....... NO
-> MP3 (LAME) audio support in MEncoder....... NO
-> AC3 (lavc) audio support in MEncoder....... NO
-> PCM audio support in MEncoder.............. NO

-> Checking for 'bc'.......................... OK
-> Checking for 'pv'.......................... OK
-> Checking for 'dd'.......................... OK
-> Checking for 'neroAacEnc'.................. OK
-> Checking for 'aacplusenc'.................. OK
-> Checking for 'oggenc'...................... FAILED! [no support for Vorbis audio]
-> Checking for 'flac'........................ OK
-> Checking for 'less'........................ OK
-> Checking for 'lsdvd'....................... OK
-> Checking for 'dvdxchap' (from ogmtools).... OK
-> Checking for 'mkvmerge' (from mkvtoolnix).. OK
-> Checking for 'ogmmerge' (from ogmtools).... OK
-> Checking for 'MP4Box' (from gpac).......... OK
-> Checking for 'tsMuxeR'..................... OK


mplayer ./configure
Checking for cc version ... 4.3.4
Detected operating system: Linux
Detected host architecture: x86_64
Checking for host cc ... cc
Checking for cross compilation ... no
Checking for CPU vendor ... AuthenticAMD (16:5:2)
Checking for CPU type ... AMD Athlon(tm) II X4 620 Processor
Checking for kernel support of mmx ... yes
Checking for kernel support of mmxext ... yes
Checking for kernel support of 3dnow ... yes
Checking for kernel support of 3dnowext ... yes
Checking for kernel support of sse ... yes
Checking for kernel support of sse2 ... yes
Checking for kernel support of cmov ... yes
Checking for mtrr support ... yes
Checking for GCC & CPU optimization abilities ... native
Checking for byte order ... little-endian
Checking for extern symbol prefix ...
Checking for assembler support of -pipe option ... yes
Checking for compiler support of named assembler arguments ... yes
Checking for .align is a power of two ... no
Checking for 10 assembler operands ... yes
Checking for ebx availability ... yes
Checking for PIC ... no
Checking for yasm ... yasm
Checking for bswap ... yes
Checking for -lposix ... no
Checking for -lm ... yes
Checking for langinfo ... yes
Checking for language ... messages: en - man pages: en - documentation: en
Checking for enable sighandler ... yes
Checking for runtime cpudetection ... no
Checking for restrict keyword ... restrict
Checking for __builtin_expect ... yes
Checking for kstat ... no
Checking for posix4 ... no
Checking for exp2 ... yes
Checking for exp2f ... yes
Checking for llrint ... yes
Checking for log2 ... yes
Checking for log2f ... yes
Checking for lrint ... yes
Checking for lrintf ... yes
Checking for round ... yes
Checking for roundf ... yes
Checking for truncf ... yes
Checking for mkstemp ... yes
Checking for nanosleep ... yes
Checking for socklib ... yes
Checking for netdb.h, struct addrinfo ... yes
Checking for netdb.h, getaddrinfo() ... yes
Checking for sockaddr_storage ... yes
Checking for arpa/inet.h ... yes
Checking for inet_pton() ... yes
Checking for inet_aton() ... yes
Checking for socklen_t ... yes
Checking for closesocket() ... no
Checking for network ... yes
Checking for inet6 ... yes
Checking for gethostbyname2 ... yes
Checking for inttypes.h (required) ... yes
Checking for int_fastXY_t in inttypes.h ... yes
Checking for malloc.h ... yes
Checking for memalign() ... yes
Checking for posix_memalign() ... yes
Checking for alloca.h ... yes
Checking for fastmemcpy ... yes
Checking for hard-coded tables ... no
Checking for mman.h ... yes
Checking for dynamic loader ... yes
Checking for dynamic a/v plugins support ... no
Checking for pthread ... yes (using -lpthread)
Checking for w32threads ... no (using pthread instead)
Checking for rpath ... no
Checking for iconv ... yes
Checking for soundcard.h ... yes (sys/soundcard.h)
Checking for sys/dvdio.h ... no
Checking for sys/cdio.h ... no
Checking for linux/cdrom.h ... yes
Checking for dvd.h ... no
Checking for termcap ... yes (using -lncurses)
Checking for termios ... yes (using sys/termios.h)
Checking for shm ... yes
Checking for strsep() ... yes
Checking for vsscanf() ... yes
Checking for swab() ... yes
Checking for POSIX select() ... yes
Checking for audio select() ... yes
Checking for gettimeofday() ... yes
Checking for glob() ... yes
Checking for setenv() ... yes
Checking for sys/sysinfo.h ... yes
Checking for Apple IR ... yes
Checking for pkg-config ... yes
Checking for Samba support (libsmbclient) ... no
Checking for tdfxfb ... no
Checking for s3fb ... no
Checking for wii ... no
Checking for tdfxvid ... no
Checking for xvr100 ... no
Checking for tga ... yes
Checking for md5sum support ... yes
Checking for yuv4mpeg support ... yes
Checking for bl ... no
Checking for DirectFB ... no
Checking for X11 headers presence ... no (check if the dev(el) packages are installed)
Checking for X11 ... no (check if the dev(el) packages are installed)
Checking for Xss screensaver extensions ... no
Checking for DPMS ... no
Checking for Xv ... no
Checking for XvMC ... no
Checking for VDPAU ... no
Checking for Xinerama ... no
Checking for Xxf86vm ... no
Checking for XF86keysym ... no
Checking for DGA ... no
Checking for 3dfx ... no
Checking for VIDIX ... yes
Checking for VIDIX PCI device name database ... yes
Checking for VIDIX dhahelper support ... no
Checking for VIDIX svgalib_helper support ... no
Checking for /dev/mga_vid ... no
Checking for xmga ... no
Checking for GGI ... no
Checking for GGI extension: libggiwmh ... no
Checking for AA ... no
Checking for CACA ... no
Checking for SVGAlib ... no
Checking for FBDev ... yes
Checking for DVB ... no
Checking for DVB HEAD ... yes
Checking for OpenGL ... no
Checking for MatrixView ... no
Checking for PNG support ... no
Checking for MNG support ... no
Checking for JPEG support ... no
Checking for OpenJPEG (JPEG2000) support ... no
Checking for PNM support ... yes
Checking for GIF support ... no
Checking for VESA support ... no
Checking for SDL ... no
Checking for DXR2 ... no
Checking for DXR3/H+ ... no
Checking for IVTV TV-Out (pre linux-2.6.24) ... no
Checking for V4L2 MPEG Decoder ... yes
Checking for OSS Audio ... yes
Checking for aRts ... no
Checking for EsounD ... no
Checking for NAS ... no
Checking for pulse ... no
Checking for JACK ... no
Checking for OpenAL ... no
Checking for ALSA audio ... no
Checking for Sun audio ... no
Checking for VCD support ... yes
Checking for dvdread ... yes (internal)
Checking for internal libdvdcss ... yes
Checking for cdparanoia ... no
Checking for libcdio ... no
Checking for bitmap font support ... yes
Checking for freetype >= 2.0.9 ... no
Checking for fontconfig ... no (FreeType support needed)
Checking for SSA/ASS support ... no (FreeType support needed)
Checking for fribidi with charsets ... no
Checking for ENCA ... no
Checking for zlib ... yes
Checking for bzlib ... yes
Checking for RTC ... yes
Checking for liblzo2 support ... no
Checking for mad support ... no
Checking for Twolame ... no
Checking for Toolame ... no
Checking for OggVorbis support ... yes (internal Tremor)
Checking for libspeex (version >= 1.1 required) ... no
Checking for OggTheora support ... no
Checking for internal mp3lib support ... yes
Checking for liba52 support ... no
Checking for internal libmpeg2 support ... yes
Checking for libdca support ... no
Checking for libmpcdec (musepack, version >= 1.2.1 required) ... no
Checking for FAAC support ... yes (in libavcodec: yes)
Checking for FAAD2 support ... yes (internal floating-point)
Checking for LADSPA plugin support ... no
Checking for libbs2b audio filter support ... no
Checking for Win32 codecs ... no
Checking for XAnim codecs ... yes (using /usr/local/lib/codecs)
Checking for RealPlayer codecs ... yes (using /usr/local/lib/codecs)
Checking for QuickTime codecs ... auto
Checking for Nemesi Streaming Media libraries ... no
Checking for LIVE555 Streaming Media libraries ... no
Checking for FFmpeg libavutil ... yes (static)
Checking for FFmpeg libavcodec ... yes (static)
Checking for FFmpeg libavformat ... yes (static)
Checking for FFmpeg libpostproc ... yes (static)
Checking for FFmpeg libswscale ... yes (static)
Checking for libopencore_amr narrowband ... no
Checking for libopencore_amr wideband ... no
Checking for libdv-0.9.5+ ... no
Checking for Xvid ... no
Checking for Xvid two pass plugin ... no
Checking for x264 ... yes (in libavcodec: yes)
Checking for libdirac ... no
Checking for libschroedinger ... no
Checking for libnut ... no
Checking for zr ... no
Checking for libmp3lame ... yes (in libavcodec: yes)
Checking for mencoder ... yes
Checking for UnRAR executable ... yes
Checking for TV interface ... yes
Checking for DirectShow TV interface ... no
Checking for Video 4 Linux TV interface ... yes
Checking for Video 4 Linux 2 TV interface ... yes
Checking for Radio interface ... no
Checking for Capture for Radio interface ... no
Checking for Video 4 Linux 2 Radio interface ... no
Checking for Video 4 Linux Radio interface ... no
Checking for Video 4 Linux 2 MPEG PVR interface ... yes
Checking for ftp ... yes
Checking for vstream client ... no
Checking for OSD menu ... no
Checking for Subtitles sorting ... yes
Checking for XMMS inputplugin support ... no
Checking for GUI ... no
Checking for automatic gdb attach ... no
Checking for compiler support for noexecstack ... yes
Checking for linker support for --nxcompat --no-seh --dynamicbase ... no
Checking for joystick ... no
Checking for lirc ... no
Checking for lircc ... no
Checking for DVD support (libdvdnav) ... yes (internal)
Creating config.mak
Creating config.h

Config files successfully generated by ./configure !

Install prefix: /usr/local
Data directory: /usr/local/share/mplayer
Config direct.: /usr/local/etc/mplayer

Byte order: little-endian
Optimizing for: native

Languages:
Messages/GUI: en
Manual pages: en
Documentation: en

Enabled optional drivers:
Input: dvdnav(internal) ftp pvr tv-v4l2 tv-v4l tv libdvdcss(internal) dvdread(internal) vcd dvb network
Codecs: x264 libavcodec(internal) real xanim faad2(internal) faac libmpeg2(internal) mp3lib(internal) tremor(internal)
Audio output: oss v4l2 mpegpes(dvb)
Video output: v4l2 pnm mpegpes(dvb) fbdev cvidix yuv4mpeg md5sum tga

Disabled optional drivers:
Input: vstream radio tv-dshow live555 nemesi cddb cdda smb
Codecs: libschroedinger libdirac xvid libdv libopencore_amrwb libopencore_amrnb qtx win32 musepack libdca liba52 libtheora speex toolame twolame libmad liblzo gif OpenJPEG
Audio output: sun alsa openal jack pulse nas esd arts ivtv dxr2 sdl
Video output: zr zr2 ivtv dxr3 dxr2 sdl vesa gif89a jpeg matrixview opengl svga caca aa ggi xmga mga xvidix winvidix 3dfx dga vdpau xvmc xv x11 dfbmga directfb bl xvr100 tdfx_vid wii s3fb tdfxfb

'config.h' and 'config.mak' contain your configuration options.
Note: If you alter theses files (for instance CFLAGS) MPlayer may no longer
compile *** DO NOT REPORT BUGS if you tweak these files ***

'make' will now compile MPlayer and 'make install' will install it.
Note: On non-Linux systems you might need to use 'gmake' instead of 'make'.

Please check mtrr settings at /proc/mtrr (see DOCS/HTML//video.html#mtrr)

NOTE: Win32 codec DLLs are not supported on your CPU (x86_64) or your
operating system (Linux). You may encounter a few files that cannot
be played due to missing open source video/audio codec support.

Check configure.log if you wonder why an autodetection failed (make sure
development headers/packages are installed).

NOTE: The --enable-* parameters unconditionally force options on, completely
skipping autodetection. This behavior is unlike what you may be used to from
autoconf-based configure scripts that can decide to override you. This greater
level of control comes at a price. You may have to provide the correct compiler
and linker flags yourself.
If you used one of these options (except --enable-gui and similar ones that
turn on internal features) and experience a compilation or linking failure,
make sure you have passed the necessary compiler/linker flags to configure.

If you suspect a bug, please read DOCS/HTML//bugreports.html.

microchip8
31st January 2010, 15:26
No problems here at all with all latest versions. Do you have multiple instances of mencoder/mplayer? If so, make sure the correct one is set in the config. Also check with ldd to see if mencoder is linked against libx264 - ldd /paht/to/bin/mencoder | grep x264. Also see with mencoder -ovc help

WalterK
1st February 2010, 00:33
yes make sure your version of libx264 and mplayer/mencoder are uptodate

microchip8
18th February 2010, 17:30
ChangeLog for version 9.1.6


* Added new veriable 'DEFOUTPUT' to the config file which can be used to set a default
output directory. This updates the config to version 15
* Modified the set_output_filename_func() function to support the above variable.
- If the DEFOUTPUT variable is empty, user can either provide just the output
name for the encode (in this case the script assumes $HOME as output dir), or
the full path and output name, which in this case the script will create the
output dir if it's not present or will do a write test when the dir is present
to see if it's writable by the user. If creation of output dir or the write test
fails, the script exits with a notice.
- If the DEFOUTPUT variable contains a custom output dir, the script will test for
it and create it if it's not present. If creation fails, the script exits with a
notice. If the dir is present, the script will do a write test to see if the
custom dir is writable. If not, the script exits with a notice.
- The DEFOUTPUT variable can be overwritten on the command line. This means that if
user has set a custom output dir in the DEFOUTPUT variable but provides a path when
asked on the command line, that path will be used instead of the one in the DEFOUTPUT
variable. The script then will either check and create the provided output dir on
the command line (if that dir is not present) or will do a write test if the dir
is present. Upon failure of creation or write test, the script exits with a notice.
If no path is provided on the command line but only the output name for the encode,
the script will use the one set in the DEFOUTPUT variable.

dbg0
10th March 2010, 23:29
@froggy1,

h264enc is a nice script, thank you. I agree that GUI is almost useless. However, I am just a beginner user of h264, and it frustrates me a bit. Let us consider an example:

$ h264enc -3p ehq
...
Select the Input type [file/dir/dvd/vcd]: filr # It is just a typo, I wanted to enter "file".
-> You have to specify the input type (file/dir/dvd/vcd)

That's all, program finished, so I have to restart it and be more careful. It this particular case my mistake is not a big problem, because h264enc terminates at the first question. But in reality I made a few mistakes no so close to the beginning, so I had to restart h264enc again and again.

Once I entered a relative path to file (I believe it is rather natural for a person working with command line), but h264enc said I should enter an absolute one and terminated again.

I did not like it. I believe (1) some more amount of interactivity would not hurt, it would be better if h264enc would check user input, and if it is wrong, let user a chance to fix it and continue, (2) h264enc should not stop if an absolute path is required -- h264enc should convert relative path to absolute and continue.

I wrote few functions for getting user input. They allows user correct a mistake and continue. For example:

$ h264enc -3p -p ehq
...
Available input types
~~~~~~~~~~~~~~~~~~~~~
1 --> File
2 --> Directory
3 --> DVD
4 --> VCD

Select the input type [1, 2, 3, 4]: 6
Invalid choice, try again.
Select the input type [1, 2, 3, 4]:

Here is the code of functions:


bold() { echo -e "\e[1m$1\e[0m"; }

function ask_choice() {
local _ac_prompt=$1 # Prompt string.
local _ac_choices=$2 # Choices string.
local _ac_var=$3 # Name of variable to save answer to.
local _ac_default=$4 # Default answer.
local _ac_n=0 # Index variable.
local _ac_choice # Array of choices.
local _ac_answer # User's answer.
# Parse $2, fill in array of valid choices.
while [[ $_ac_choices == *\,* ]]; do
_ac_n=$(( _ac_n + 1 ))
_ac_choice[ $_ac_n ]=${_ac_choices%%,*}
_ac_choices=${_ac_choices#*,}
done
_ac_n=$(( _ac_n + 1 ))
_ac_choice[ $_ac_n ]=$_ac_choices
# Reconstruct _ac_choices (it was destroyed during parsing).
_ac_choices=
for (( _ac_n = 1; _ac_n <= ${#_ac_choice[@]}; _ac_n = _ac_n + 1 )); do
if [[ $_ac_n -gt 1 ]]; then
_ac_choices="$_ac_choices, "
fi
if [[ ${_ac_choice[ $_ac_n ]} == "$_ac_default" ]]; then
# Highligh default choice.
_ac_choices="$_ac_choices$(bold "${_ac_choice[ $_ac_n ]}")"
else
_ac_choices="$_ac_choices${_ac_choice[ $_ac_n ]}"
fi
done
# Now ask user.
while true; do
read -e -p "$_ac_prompt [$_ac_choices]: " _ac_answer
if [[ $_ac_answer == "" ]]; then
_ac_answer=$_ac_default
fi
for (( _ac_n = 1; _ac_n <= ${#_ac_choice[@]}; _ac_n = _ac_n + 1 )); do
if [[ $_ac_answer == "${_ac_choice[ $_ac_n ]}" ]]; then
eval $_ac_var=\$_ac_answer
return $_ac_n
fi
done
printf "Invalid choice, try again.\n"
done
} # function ask

function ask_yn() {
local _ay_prompt=$1 # Prompt string.
local _ay_var=$2 # Name of variable to save answer to.
local _ay_default=$3 # Default answer.
if [[ -z $_ay_default ]]; then
_ay_default="n"
fi
# Ask user.
ask_choice "$_ay_prompt" "y,n" "$_ay_var" "$_ay_default"
} # function ask_yn

function ask_file() {
local _af_prompt=$1 # Prompt string.
local _af_tests=$2 # File tests.
local _af_var=$3 # Name of variable to save answer to.
local _af_default=$4 # Default answer.
local _af_n=0 # Index variable.
local _af_test
local _af_answer=
# Parse $2, fill in array of tests.
while [[ $_af_tests == *,* ]]; do
_af_n=$(( _af_n + 1 ))
_af_test[ $_af_n ]=${_af_tests%%,*}
_af_tests=${_af_tests#*,}
done
_af_n=$(( _af_n + 1 ))
_af_test[ $_af_n ]=$_af_tests
# Prepare prompt.
if [[ -n $_af_default ]]; then
_af_prompt="$_af_prompt [default is $(bold "$_af_default")]"
fi
# Ask user.
while true; do
read -e -p "$_af_prompt: " -i "$_af_answer" _af_answer
if [[ $_af_answer == "" ]]; then
_af_answer=$_af_default
fi
for (( _af_n = 1; _af_n <= ${#_af_test[@]}; _af_n = _af_n + 1 )); do
if [[ ${_af_test[ $_af_n ]} == "-e" && ! -e $_af_answer ]]; then
echo "\`$_af_answer' does not exist."
continue 2
fi
if [[ ${_af_test[ $_af_n ]} == "-d" && ! -d $_af_answer ]]; then
echo "\`$_af_answer' not a directory."
continue 2
fi
if [[ ${_af_test[ $_af_n ]} == "-f" && ! -f $_af_answer ]]; then
echo "\`$_af_answer' not a file."
continue 2
fi
if [[ ${_af_test[ $_af_n ]} == "-b" && ! -b $_af_answer ]]; then
echo "\`$_af_answer' not a block device."
continue 2
fi
if [[ ${_af_test[ $_af_n ]} == "-A" ]]; then
rel2abs "$_af_answer" _af_answer
fi
done
eval $_af_var=\$_af_answer
return 0
done
} # function ask_file

function rel2abs() {
local _rel2abs_path=$1
local _rel2abs_var=$2
local _rel2abs_dir
local _rel2abs_file
if [[ ! $_rel2abs_path == "/" ]]; then
_rel2abs_dir=$(dirname "$_rel2abs_path")
_rel2abs_file=$(basename "$_rel2abs_path")
_rel2abs_dir=$(cd "$_rel2abs_dir" && pwd -P)
if [[ $_rel2abs_dir == "" ]]; then
echo "??????????"
fi
if [[ $_rel2abs_dir == */ ]]; then
_rel2abs_path=$_rel2abs_dir$_rel2abs_file
else
_rel2abs_path=$_rel2abs_dir/$_rel2abs_file
fi
fi
eval $_rel2abs_var=\"\$_rel2abs_path\"
} # function rel2abs

Function ask_choice asks user for a choice one of allowed options, e. g.:

ask_choice "In which format to export" "text,perl,python,ruby,xml" format

or

echo ""
brown "Deinterlace Methods"
brown "~~~~~~~~~~~~~~~~~~~"
echo "0 -> Deinterlace at half frame rate"
echo "1 -> Deinterlace at original frame rate"
echo "2 -> Deinterlace at double frame rate (bobbing)"
echo "3 -> Skip deinterlacing"
echo ""
ask_choice "Select the deinterlacing method" "0,1,2,3" deintmethod "1"

ask_yn is an adaptation of ask_choice to yes/no questions.

ask_file asks for a file or directory name, e. g.:

ask_file "Provide the input video file: " "-e,-f,-A" infile

"-e,-f,-A" means that file should exist, be a plain file, and function will convert relative path to absolute one.

Another example, asking for a DVD device:

ask_file "Specify the DVD device" "-e,-b,-A" dvd_dev "/dev/dvd"

Here is an example of work:

Specify the DVD device [default is /dev/dvd]: /home/
`/home/' not a block device.
Specify the DVD device [default is /dev/dvd]:

Do you think you could incorporate these functions into h264enc?

Thanks.

microchip8
11th March 2010, 00:07
if you provide a decent real unified patch against the latest version, then I just might. Otherwise, no.

microchip8
16th March 2010, 22:10
ChangeLog for version 9.1.7
* Space escaped some previously missed variables
* Use one variable in the presets (x264params) for all MEncoder x264 encoding options. Reduces some code and simplifies things a bit
* Updated the preset.cfg file to support the "one variable for all x264 encoder opts"
Note: those using custom preset files for encoding should read the preset.cfg file in the doc dir and adapt their existing preset files to
be compatible with the changes. Previous older custom presets written by users will not work with this and future versions of h264enc!

microchip8
18th March 2010, 16:51
ChangeLog for version 9.1.8
* Small bugfix: keyint and keyint_min weren't passed on to MEncoder when using some presets

ennob
22nd March 2010, 17:02
Hi froggy1

Nice tool. I especially like the presets, it can be a pain to figure out what all the different platforms support.

I attached a patch to replace some sed(1) commands with awk(1) commands since the '-r' switch for sed(1) is not university supported. E.g., my FreeBSD box didn't like them.

Hope you can use it and thanks for a great tool.

/ennob

ennob
22nd March 2010, 21:49
Btw froggy1, any plans of putting this under version control, say Git?

It would make it a bit easier to update and you might get more community support/development.

/ennob

microchip8
22nd March 2010, 22:26
@ennob

No plan for version control. Project's too small and it's already easy

Also, upload the patch somewhere else as on here it can take some time before a mod approves the attachment

ennob
23rd March 2010, 11:55
here is the diff:


--- h264enc.orig 2010-03-17 15:30:11.000000000 +0100
+++ h264enc 2010-03-17 15:38:49.000000000 +0100
@@ -1099,7 +1099,7 @@
}
trap 'interrupt_iso_func' SIGHUP SIGTSTP SIGINT SIGQUIT SIGKILL SIGABRT SIGFPE SIGSEGV SIGTERM SIGPIPE SIGIO
check_space_func() {
- HDSPACE="$(df -m "$(dirname "$OUTPUT")" | tail -n 1 | sed -r 's/^.*\s+[0-9]+\s+[0-9]+\s+([0-9]+)\s+[0-9]+%.*/\1/')"
+ HDSPACE="$(df -m "$(dirname "$OUTPUT")" | tail -n 1 | awk '{print $4}')"
if [ $HDSPACE -le 9216 ]; then
echo ""
error "-> You are running out of disk space in '$(dirname "$OUTPUT")'"
@@ -2961,8 +2961,8 @@
}

check_diskspace_func() {
- HDOUT="$(df -m "$(dirname "$OUTPUT")" | tail -n 1 | sed -r 's/^.*\s+[0-9]+\s+[0-9]+\s+([0-9]+)\s+[0-9]+%.*/\1/')"
- HDCONF="$(df -m "$TEMPDIR" | tail -n 1 | sed -r 's/^.*\s+[0-9]+\s+[0-9]+\s+([0-9]+)\s+[0-9]+%.*/\1/')"
+ HDOUT="$(df -m "$(dirname "$OUTPUT")" | tail -n 1 | awk '{print $4}')"
+ HDCONF="$(df -m "$TEMPDIR" | tail -n 1 | awk '{print $4}')"
if [ $HDOUT -le 4096 -o $HDCONF -le 4096 ]; then
echo ""
echo "Note that you are running out of disk space in"

microchip8
23rd March 2010, 12:05
Yeah, it's already applied. I downloaded it earlier. Thanks anyways

microchip8
28th March 2010, 13:21
ChangeLog for version 9.1.9
* Replaced sed with awk for checking available disk space. Should work better on FreeBSD systems.
Patch by ennob from doom9
* Updated interlace options and presets to support the latest x264 from git. Note that due to these changes,
h264enc's presets are incompatible with older x264 versions so please upgrade to latest x264 from git!
* Small update to the preset.cfg file

microchip8
24th April 2010, 03:05
ChangeLog for version 9.2.0
* Switch to using external FAAC encoder to work around an issue in mkvmerge where it flags AAC
audio taken from an AVI as being Main profile regardless if LC profile is used for encoding or not. Problem
noticed & reported by benpro. This updates the config file to version 16 and requires FAAC to be installed.
* Same small cleanups
* Updated the man page

microchip8
29th April 2010, 15:54
ChangeLog for version 9.2.1
* Reworked a bit the audio channels decode/output function. This function also got renamed
from audio_channels_func() to audio_channels_decode_func()
* Added support for the audio channels filter which can be used to add/remove/route channels. This updates
the config file to version 17 and adds variable ALLOW_AUD_CHANNELS
* Bugfix: audio filters were not inserted when doing 1-pass encodes

microchip8
15th May 2010, 17:34
ChangeLog for version 9.2.2

* Small bugfix in the get_devices_func() function; script exits when user hits enter to accept default device
* Remove AVI menu entry as supported container when using FAAC for audio encoding

microchip8
25th June 2010, 17:39
ChangeLog for version 9.2.3
* Added support for x264's preset, tune and profile options. This adds two additional optional args
[-t (for tune) and -pf (for profile)] which can only be used with an x264 preset, not with the built-in script
presets. If used with those, these args will be ignored.
Examples on how to use x264 presets (which is also explained in the -help option)
h264enc -crf -p slow
h264enc -crf -p slow -t film
h264enc -crf -p slow -pf main
h264enc -crf -p slow -t film -pf high
One can also switch the -t and -pf options, eg: h264enc -crf -p slow -pf high -t film
* Updated the man page

swk
18th July 2010, 02:23
While looking for x264 cli tutorials (and not finding much) I came across h264enc today. I was hopeful but it doesn't work for me. I did a simple test (choosing all defaults). I started with:
h264enc -1p -p fast


and got the following command:

nice -n 10 /usr/bin/mencoder "dvd://2" -o "/p3/mebo - chapter 1-2.avi" -vc mpeg12 -dvd-device mebo.iso -chapter 1-2 -vf \
softskip,harddup -aid 128 -oac pcm -ovc x264 -x264encopts bitrate=1000:nointerlaced:preset=fast:keyint=300:keyint_min=30:force_cfr


with resulting:
MPlayer SVN-r31309 (C) 2000-2010 MPlayer Team
Option x264encopts: Unknown suboption preset
libdvdread: Encrypted DVD support unavailable.
There are 5 titles on this DVD.
There are 1 angles in this DVD title.
audio stream: 0 format: ac3 (stereo) language: ja aid: 128.
number of audio channels on disk: 1.
number of subtitles on disk: 0
success: format: 2 data: 0x5EDF000 - 0x5ede800
MPEG-PS file format detected.
VIDEO: MPEG2 720x480 (aspect 2) 29.970 fps 9800.0 kbps (1225.0 kbyte/s)
[V] filefmt:2 fourcc:0x10000002 size:720x480 fps:29.970 ftime:=0.0334
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 48000 Hz, 2 ch, s16le, 192.0 kbit/12.50% (ratio: 24000->192000)
Selected audio codec: [ffac3] afm: ffmpeg (FFmpeg AC-3)
==========================================================================
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
Opening video filter: [harddup]
Opening video filter: [softskip]
==========================================================================
Forced video codec: mpeg12
Opening video decoder: [libmpeg2] libmpeg2 MPEG 1/2 Video decoder
Selected video codec: [mpeg12] vfm: libmpeg2 (MPEG-1 or 2 (libmpeg2))
==========================================================================
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
Movie-Aspect is 1.33:1 - prescaling to correct movie aspect.
[swscaler @ 0x328be40]using unscaled yuv420p -> yuv420p special converter
FATAL: Cannot initialize video driver.

Exiting...


Looking around, it seems mencoder passed x264 options to libx264 but libx264 doesn't recognize the preset option. Removing the preset=fast option from the menconder command does work. Since h264enc requires a preset, I'm confused as to how anyone gets it to work.

I'm using (all from Debian repos):
Package: libx264-98
Version: 1:0.svn20100620-0.1

Package: mencoder
Version: 2:1.0~rc3+svn20100603-0.0

Package: h264enc
Version: 9.2.3-0.0

Redsandro
18th July 2010, 02:29
I use h264enc for encoding series for my nokia phone using h264enc -1p -p nks60 and there's no problem.

Could it be that h264enc doesn't handle non-specific profiles well (anymore)?

microchip8
18th July 2010, 07:49
@swk

you're trying to use the native x264 presets but your x264 or mencoder version is too old and doesn't support them. Either upgrade these programs or use the script presets instead (eg, the hq, vhq, ehq, etc presets, not the x264 ones as shown in -help). The x264 presets work here in mencoder (and in h264enc) without a problem so it must be something on your side

I recommend using mplayer from svn and x264 from git, compiled yourself

swk
18th July 2010, 16:52
I use a svn checkout from June 3, 2010. That can't be that old can it?

Anyway, I did use the script presets and it did work. I'll contact the Debian package maintainer to find out what is going on. I used to compile svn mplayer all the time but this is a new comp and I haven't had time to hunt down all needed libs. Looks like I may have to though.

Thanks to both of you for helping.

microchip8
18th July 2010, 17:22
I'm not exactly sure when they pushed the patch to mencoder to support x264 presets, so I can't tell you if yours supports it or not. But mine does here. If mencoder didn't support these x264 presets, I wouldn't add them to the script ;)

nm
21st July 2010, 08:19
I use a svn checkout from June 3, 2010. That can't be that old can it?
It's a new feature:
r31363 | tack | 2010-06-11 00:45:20 +0300 (pe, 11 kesä** 2010) | 11 lines

ve_x264: rewrite option parsing and add support for x264's presets,
profiles, and tuning system.

No longer explicitly disable 'psnr' and 'ssim' options (they are off by
default); deprecate the 'turbo' option, enable fast first pass by
default, and introduce slow_firstpass option to disable it (provides
parity with x264).

Some ideas taken from patch submitted by Micha (mk spline de).

microchip8
21st July 2010, 09:39
ChangeLog for version 9.2.4
* Typo fix in the display_quality_preset_func(); verslow -> veryslow. As this is an informative function,
it does not affect the encoding configuration
* Force -nosub option in case subtitles are skipped. This is to prevent auto-loading of subs

Goga777
10th August 2010, 20:00
thanks for you great job
does it possible to implement the possibility to power off computer after finishing of encoding ?

microchip8
10th August 2010, 20:07
thanks for you great job
does it possible to implement the possibility to power off computer after finishing of encoding ?

halting requires root privileges so if you run the script as normal user (which you should), it can't be done afaik

Goga777
11th August 2010, 20:10
with sudo it's possible to find solution

microchip8
11th August 2010, 20:16
with sudo it's possible to find solution

I don't like sudo and I don't use it. Not to mention many distros are not as fanatic sudo pushers as Ubuntu/Debian

what you can do is just see how much time is remaining for the encode to finish, add 10-15 minutes on top and in another console as root do;

sleep <remaining-time-in-min-or-hrs> && halt -p

example, if mencoder says your encoding will finish in 100 minutes, add to those 5 or 10 on top just to be sure and then

sleep 110m && halt -p

Goga777
11th August 2010, 20:22
yes, I have already used such solution :)


shutdown -P -h -time 04:00

microchip8
11th August 2010, 20:32
well, there you go :)

and make sure to account for audio encoding (if you use an external encoder like Nero) and for muxing, hence why I said to add 5-10 minutes (or a bit more) on top of the estimated encoding time by mencoder :)

Goga777
11th August 2010, 20:51
in which cases do you recommend to use deringing/deblocking filters ?

microchip8
11th August 2010, 20:52
in which cases do you recommend to use deringing/deblocking filters ?

in case the input has clearly visible ringing and/or blocking effects :)

Goga777
15th August 2010, 17:42
after encoding with h264enc I tried to open output mkv file with avidemux and received a lot of warnings like

[MKV] Tracks analyzed
[MKV] Indexing clusters
[MKV] Found 1367 clusters
[MKV]Found 1367 clusters
[MKV] Indexing video
??0x7
Warning , incomplete nal (196709/101010),(30065/18a92)
Warning , incomplete nal (5/63499),(5/f80b)
Warning , incomplete nal (5/14872),(5/3a18)
Warning , incomplete nal (5/56106),(5/db2a)
Warning , incomplete nal (5/28184),(5/6e18)
Warning , incomplete nal (5/13975),(5/3697)
Warning , incomplete nal (5/13185),(5/3381)
Warning , incomplete nal (5/12916),(5/3274)
Warning , incomplete nal (5/13771),(5/35cb)

is it normal to have such warnings ? how can I test my file ?



with ffmpeg -i Турция\ 2010.06.mkv
FFmpeg version SVN-r24334, Copyright (c) 2000-2010 the FFmpeg developers
built on Jul 19 2010 23:07:34 with gcc 4.3.3
configuration: --enable-shared --enable-libx264 --enable-libfaac --enable-gpl --enable-nonfree
libavutil 50.22. 0 / 50.22. 0
libavcodec 52.84. 0 / 52.84. 0
libavformat 52.75. 0 / 52.75. 0
libavdevice 52. 2. 0 / 52. 2. 0
libavfilter 1.25. 1 / 1.25. 1
libswscale 0.11. 0 / 0.11. 0
[matroska @ 0x9e29470] Estimating duration from bitrate, this may be inaccurate
Input #0, matroska, from 'Турция 2010.06.mkv':
Metadata:
title : Турция 2010.06
Source : Video file
Title : Турция 2010.06
Release Date : 2010
Genre : home video
Video Filters : softskip,ilpack=1,scale=::1,harddup
Audio Filters (Track 1): lavcresample=48000:16:1
Audio Codec (Track 1): LC-AAC Stereo
Encoder : MEncoder SVN-r31567-4.4.4 (C) 2000-2010 MPlayer Team
x264 parameters : crf=19:bff:pic_struct:force_cfr:frameref=5:mixed_refs:bframes=6:b_adapt=2:b_pyramid=normal:weight_b:weightp=2:direct_pred=auto:aq_mode=1:me=umh:me_range=32:subq=8:mbtree:rc_lookahead=50:psy_rd=0.8,0.2:chroma_me:trellis=1:cabac:deblock:8x8dct:partitions=p8x8,b8x8,i8x8,i4x4:nofast_pskip:nodct_decimate:threads=auto:ssim:psnr:keyint=250:keyint_min=25
x264 version : 0.104.1677
mkvmerge version: 2.7.0
h264enc parameters: h264enc -crf -p ehq
Comment : Tagged by h264enc 9.2.4 on 2010/08/13
Duration: 00:37:52.61, start: 0.000000, bitrate: N/A
Stream #0.0: Video: h264, yuv420p, 720x576 [PAR 131:90 DAR 131:72], 25 fps, 25 tbr, 1k tbn, 50 tbc
Metadata:
title : Турция 2010.06
Stream #0.1: Audio: aac, 48000 Hz, stereo, s16
Metadata:
title : LC-AAC Stereo
At least one output file must be specified

microchip8
16th August 2010, 12:11
that's probably avidemux screwing up. No idea really

microchip8
21st August 2010, 11:26
ChangeLog for version 9.2.5
* Update QuickTime & iPhone presets. Patch by gongloo

microchip8
23rd August 2010, 12:20
ChangeLog for version 9.2.6
* Fixed a syntax error in the iphq preset

contador
12th September 2010, 15:51
Hi froggy1,

I have started to use your xvidenc script and its perfect for my needs, thankyou.


I was hoping I could get your opnion on something (Im a total noob), I have a dvd of an old black and white comedy which I think is interlaced because when I encode without that option I get lines when there is fast movement on the screen.

I have tried using interlacing with option 39, its very slow, but it works to stop the lines, but I was wondering about your prefered interlacing options?

microchip8
12th September 2010, 16:58
@contador

it's very slow because it uses the slowest mode in mcdeint. You better stick to the yadif deinterlacer or if you really need motion compensated deinterlacing, yadif with a faster mode of mcdeint.

contador
12th September 2010, 17:44
Thanks froggy1 :)

esthon
12th September 2010, 19:24
Hi,

this is a very good tool, thank you for the great work.

I am using it to encoding videos that will be streamed by a mediatomb mediacenter running in a Linux to a PS3 that is (HDMI) connected to a HD TV. My question is: should I use the PS3 preset or this doesn't matter as I am streaming it by network?

microchip8
14th September 2010, 18:28
@esthon,

doesn't matter. If it works currently, stick to it :)

microchip8
15th September 2010, 09:51
ChangeLog for version 9.2.7
* Small update to the -scan option. Just check if input file is there, regardless if user provides the full path or not
* Enable trellis in some presets that use CAVLC

crazee_canuck
15th September 2010, 19:20
Using 9.2.7 with "h264enc -2p -p fast" I end up with hardcoded subtitles in the final file.

If I select to have the subtitles imported into the matroska container, and then select subtitle #2, subtitle #0 is hardcoded into the file and #2 is imported into the MKV file.

One pass encoding works as one would expect (the quality looks very good, so 1-pass looks like it'll be sufficient for my needs).

Unfortunately I do not know when this behaviour changed.

I'm using Debian sid, x64, with the following packages:
ii ffmpeg 5:0.6~svn20100726-0.0 audio/video encoder, streaming server & audio/video file converter
ii libavcodec52 5:0.6~svn20100726-0.0 library to encode decode multimedia streams - runtime files
ii libx264-104 1:0.svn20100902-0.0 x264 video coding library
ii mencoder 2:1.0~rc3++svn20100804-0.0 MPlayer's Movie Encoder
ii mplayer-nogui 2:1.0~rc3++svn20100804-0.0 The Ultimate Movie Player For Linux
ii x264 1:0.svn20100902-0.0 video encoder for the H.264/MPEG-4 AVC standard

microchip8
15th September 2010, 20:30
Will look into it... it's because the wonderful idiots over at mplayer decided sometime ago to enable subtitles by default so I have to work around their BS constantly

microchip8
15th September 2010, 21:02
hmmm, I cannot reproduce that here. I just encoded one chapter from a DVD, selected to dump & import the 7th sub on it (which was in dutch language) into MKV. Playing the file shows by default the subtitle in the MKV. Adding -nosub to mplayer's params, makes it go away and no other subtitle is shown during speech so nothing can be hardcoded or else it'll show up regardless if one uses -nosub or not

Did you save the options to the batchfile? if so, can you pastebin them?

My mencoder rev is: MEncoder SVN-r32153-4.5, which is newer than yours. Maybe it's a problem with your mencoder?

microchip8
15th September 2010, 21:12
wait, i think I made a mistake. I ran a 1 pass encode, you did a 2 pass one. The subs code for 2 pass is slightly different. Will test now, will report soon..

microchip8
15th September 2010, 21:17
Yup, looks you're right. Will fix :)

Thanks for reporting!

microchip8
16th September 2010, 10:16
ChangeLog for version 9.2.8
* Workaround mencoder stupidity. With recent versions of mencoder that have subs enabled
by default (who came up with that great idea?), in case the user selects to dump a sub for importing
into mkv/mp4, during multipass encoding the first sub will always get hardcoded due to missing -nosub
option in the 2nd and 3rd pass code. This is only valid for multipass encodes so people using one pass
modes (-1p, -qp or -crf) are safe.

contador
24th September 2010, 16:23
Froggy,

Would it be possible to have Xvidenc encode to/from a ram disk?

I have asked a question regarding speeding up dvd encodes, on a different forum, and some suggest that If I can do all the encoding via a ram disk then that might avoid bottlenecks on the system. Is that possible with the Xvidenc script?

microchip8
24th September 2010, 16:40
Froggy,

Would it be possible to have Xvidenc encode to/from a ram disk?

I have asked a question regarding speeding up dvd encodes, on a different forum, and some suggest that If I can do all the encoding via a ram disk then that might avoid bottlenecks on the system. Is that possible with the Xvidenc script?

I don't see why it wouldn't be possible, but you do realize a ramdisk is a temporary thing? So why would you encode content you want to keep to a ramdisk? When you're finished, you'd have to put it on a real disk anyways if you want to keep it and this will involve moving the data so what's the point?

And what bottlenecks are you having? Even with ridiculously big resolutions, a modern HDD shouldn't have any problems feeding the encoder with data. I don't really see the point in using a ramdisk for that

contador
24th September 2010, 17:44
Froggy,

Im not facing any bottlenecks yet, Im still deciding on the hardware, and Im just trying to find out the fastest way of encoding because I've got 500+ 30 minute comedy episodes that need to be encoded with interlaced slowest mcdient.

microchip8
24th September 2010, 17:49
The fastest way is to buy better hardware. You won't notice any significant measurable difference if you encode from a ramdisk. Also slowest mcdeint is kinda silly, you won't really notice a difference between it and the faster modes.

contador
24th September 2010, 18:23
I dont know wether I will need to encode all the episodes with slowest mcdeint, but a batch of 37 need it really, hopefully the others wont.

If I can ask you one last question about hardware:

If I bought a quad-core cpu, could I have 4 Xvid encodes working at the same time, using xvidenc script? or should I just go for dual-core? (please excuse my ignorance).

microchip8
24th September 2010, 18:30
you can have as many encodes working as you like, but it'll slow things down

contador
24th September 2010, 19:56
Cool

Thanks man :thanks:

nm
25th September 2010, 11:32
Im not facing any bottlenecks yet, Im still deciding on the hardware, and Im just trying to find out the fastest way of encoding because I've got 500+ 30 minute comedy episodes that need to be encoded with interlaced slowest mcdient.

Yep, you'll need to encodes multiple videos simultaneously since mcdeint is single-threaded. Still, it's so slow that I doubt you'll have I/O bottlenecks even with a beefy i7 or Xeon. Use a fast SSD if you are concerned about disk performance.


Also slowest mcdeint is kinda silly, you won't really notice a difference between it and the faster modes.

I have done some tests myself and mode 0 (fast) always gave the best quality with difficult sources. Slower modes seem to cause more artifacting and delayed response to scene changes. Mcdeint=0 is definitely worth it over plain yadif though.

lib3rty1
30th September 2010, 09:04
For first :) awsome job man :)

Second.
Could you add some other presets like:
1. Copy video and audio options and add just subtitles without changig video and audio. Just hardsubing subs.

2. I can`t use AAC coding on my dedi. It says that mencoder is not supporting AAC, do you know how to fix it ?

microchip8
30th September 2010, 09:28
@ lib3rty1

1. No, h264enc is for encoding to the H.264 format, not copying video. You can easily do this with mencoder without the need of a script. Just use -ovc copy -oac copy. If I'm not mistaken, you can't copy the video and at the same time hardsub subs into it.

2. h264enc doesn't rely on mencoder having or not having AAC support since I don't use its AAC encoding capabilities but directly use FAAC, Nero and aacplusenc

lib3rty1
30th September 2010, 10:13
Yeah I know that is for encoding to h264.
You have to encode whole movie to add subs.


It would be like:

Check video options (bitrate, size etc) and convert it to h264 with hardsubs.
btw. Adding subs support only subs in UTF-8 ?

But nero is payed option. Is there any chance to use AAC or similar one ?
It`s better for me.
I often makes small like 350 MB converts and would like to use AAC audio.
I also often add only subs to video. Without changing size.

microchip8
30th September 2010, 10:24
Not sure about the encoding for subs, but UTF-8 is good supported

Nero is not payed option. It's free available from Nero's site (check website of h264enc for links). If you don't want Nero, install FAAC (which is worse quality and slower) and use that. Just make sure to run h264enc -r after installation of Nero or FAAC so it can reset the config file and find it

lib3rty1
30th September 2010, 10:55
Oh, ok
Now I have new problem.
While I was encoding movie I wanted hardsubs subs but I am having problem with polish diacritics. Do you know how to fix it up ?
I have saved txt to UTF-8 but that won`t works.

microchip8
30th September 2010, 11:02
No idea really, I don't deal with subs that much. Have a look at mplayer's man page, there's probably an option to set a codepage

lib3rty1
30th September 2010, 11:05
Yeah, there is but how to use this function with your script ?

microchip8
30th September 2010, 11:07
you have the options when asked to the batch file, open it up, add the new option, save and encode from the batch file

lib3rty1
30th September 2010, 11:17
Could you show me point by point how to do this ?

microchip8
30th September 2010, 11:20
LOL?

you just configure like you're used to and when you get to the point of asking to save the options, do it. When it starts the countdown for encoding, hit CTRL+C to terminate. Then open up the file you saved and add to the mencoder line what you need. Save all and do a ./yourfile and it will start encoding.

lib3rty1
30th September 2010, 11:40
thanks
I had to add -subpc cp1250

Can I somehow change used font to other that be used permanently
and can I add that option -subcp cp1250 permanently ?

Ok, sorry for so many questions but I like your script and I will use it now :)

microchip8
30th September 2010, 11:43
you can change/add/remove anything from the batch file. For setting a codepage through h264enc, I need to add support for that first

lib3rty1
30th September 2010, 11:50
So mayby you could add support for chosing coding and mayby using custom fonts ?

microchip8
30th September 2010, 11:52
Sure, when I get some free time.

ganymede
6th October 2010, 20:49
There's a little trick to speed up deinterlacing and reduce picture size at the same time (a very common task).

The idea comes from -Vit-, author of the QTGMC deinterlacing script for avisynth : see http://forum.doom9.org/showthread.php?p=1445979#post1445979
Resize horizontally before deinterlacing, giving the deinterlacer less data to process, then do the vertical resize afterwards. Works because deinterlacing is primarily a vertical process. Can be used regardless of deinterlacer

Mplayer -vf filter chain supports this possibility. For instance, if you want to deinterlace HD 1080i video with yadif & mcdeint, and also reduce image dimensions to 1024x576 :
-vf scale=1024:1080:1,yadif=1,mcdeint=0:0:10,framestep=2,softskip,scale=1024:576:0,harddup
I noticed a significant speedup doing this, since deinterlacing with yadif + mcdeint is a ressource-consuming process.
This principle can probably be implemented in h264enc when the user requests both deinterlacing and downsizing.

BTW @froggy1 thank you for developing this very nice tool. I learnt a lot by using it.

microchip8
6th October 2010, 20:59
And now the question is; where exactly to ask this? Just after the deinterlace stuff or when one reaches scaling, which is multiple steps below?

ganymede
6th October 2010, 22:17
And now the question is; where exactly to ask this? Just after the deinterlace stuff or when one reaches scaling, which is multiple steps below?
Why not at the scaling step, and only if the user has requested deinterlacing ?

Redsandro
6th October 2010, 23:17
There's a little trick to speed up deinterlacing and reduce picture size at the same time (a very common task).

Doesn't this leave interpolated less precise data (YUV warning) for the deinterlace?

ganymede
7th October 2010, 12:55
Doesn't this leave interpolated less precise data (YUV warning) for the deinterlace?
I guess you're right. The deinterlacing filter has to work with less precise data since the horizontal resolution is reduced.
Nevertheless, this precision loss is probably not too severe as long as :

you resize only horizontally
you don't resize too much (eg. 1920x1080 -> 1280x720 or 1024x576 should be OK, 1920x1080 -> 640x360 I don't know)

Anyway, you'll have to resize at the end, right ? So I doubt there is a significant reduction in picture quality at the end. At least, I didn't notice any when I deinterlaced this way.

contador
10th October 2010, 15:26
I would also like to ask if there are any plans to introduce other mp3 audio enchancement options to Xvidenc? I have a great picture on my encodes, but the source audio is very 'tinny'. Being able to boost the bass would improve the audio alot.

microchip8
10th October 2010, 15:32
Can probably add the audio equalizer...

About the deinterlace stuff, don't think I'll add it

microchip8
29th October 2010, 10:14
ChangeLog for version 9.2.9
* Fix typo in the backup_file_func(): exisiting -> existing
* Workaround multichan FAAC encoding. FAAC somehow does not like multichan PCM from MPlayer
but it does if one treats it as raw using -P in FAAC. Nero/FLAC/Vorbis have no issues, though. Go figure
* Added support for setting subtitle codepage during hardcoding of external subs
* Added support for the audio equalizer filter. This updates the config file version to 18
* Removed 'time' requirement

microchip8
26th November 2010, 09:54
ChangeLog for version 9.3.0
* Remove double $HOME variable in the -scan option

microchip8
5th December 2010, 22:10
ChangeLog for version 9.3.1
* Fix for the custom preset (cp) option

cord-factor
7th December 2010, 16:49
Hi froggy1, can you answer?
Why usage of 'B-frames' is disabled by default (in mencoder options of x264 codec)? It's because of default 'AVI' container features or something else?
Thx.

microchip8
7th December 2010, 16:54
Hi froggy1, can you answer?
Why usage of 'B-frames' is disabled by default (in mencoder options of x264 codec)? It's because of default 'AVI' container features or something else?
Thx.

I have no idea where you get that from. If you don't touch b-frames options, mencoder picks whatever is the default in libx264

cord-factor
8th December 2010, 16:30
Oh, sorry, yes it is fine right now.
But year ago, when I've used stable version of mplayer/mencoder (at that time; I don't remember exact number) it was there.
With the command below the x264 video stream became without b-frames (only I and P).

mencoder input.avi -nosound -ovc x264 -x264encopts crf=20 -of lavf -lavfopts format=rawvideo -o output.x264


Also there was the warning

** MUXER_LAVF *****************************************************************
REMEMBER: MEncoder's libavformat muxing is presently broken and can generate
INCORRECT files in the presence of B-frames. Moreover, due to bugs MPlayer
will play these INCORRECT files as if nothing were wrong!
*******************************************************************************

and I had to use the "i_certify_that_my_video_stream_does_not_use_b_frames" option to make lavf formats.

microchip8
8th December 2010, 18:40
Oh, sorry, yes it is fine right now.
But year ago, when I've used stable version of mplayer/mencoder (at that time; I don't remember exact number) it was there.
With the command below the x264 video stream became without b-frames (only I and P).

mencoder input.avi -nosound -ovc x264 -x264encopts crf=20 -of lavf -lavfopts format=rawvideo -o output.x264


Also there was the warning

** MUXER_LAVF *****************************************************************
REMEMBER: MEncoder's libavformat muxing is presently broken and can generate
INCORRECT files in the presence of B-frames. Moreover, due to bugs MPlayer
will play these INCORRECT files as if nothing were wrong!
*******************************************************************************

and I had to use the "i_certify_that_my_video_stream_does_not_use_b_frames" option to make lavf formats.

The problem in here is different. It's because mencoder is broken when used with the lavf muxer so it will produce incorrect files and most likely nothing but mplayer will play them. So, in short: lavf muxer + mencoder + b-frames= no go

However, the above option has been removed for quite some time now. This is not to say that now mencoder produces correct files when b-frames and the lavf muxer are used. It still doesn't. Don't ask me why they removed that option 'cause I don't recall

Anyways, if you don't use the lavf muxer, mencoder has little issues encoding to H.264 with b-frames. Also in the past b-frames in libx264 weren't enforced like these days, so obviously you'd only get I and P ones. Not so with recent libx264 versions which has sane defaults that include b-frames even if you don't explicitly tell mencoder to use them

cord-factor
8th December 2010, 21:27
Oh, Thanks. Now, I see :)

nbi
30th December 2010, 02:45
Ok, I just took a stab at it and it appears badly broken. What's particularly aggravating is that the preview gave no hint of anything being wrong. So what are all the things that went wrong?

1. It created an AVI that had video and audio totally out of sync.
2. It did encode the source WMV video into a H264 file that plays video, but is missing the audio track.
3. I was expecting to get an end result ".mp4" file but MP4Box ran for nearly a day (!) without ever finishing!

This transpired on a x86_64 Debian Lenny system. I have no idea how it got tripped up, but I did save the executed shell script in case anyone knows what to look for.
Thanks.

microchip8
30th December 2010, 08:47
@nbi

already replied to you by mail

microchip8
8th January 2011, 16:36
ChangeLog for version 9.3.2

* Use -demuxer lavf when trying to get the video length for bitrate calculation for a target file size. Should be more reliable on M2TS/TS files
* Add support for the delogo filter. Patch by Haiko Michelfeit <haiko AT zsyndikat DOT org>. Config file version is bumped to 19
* Updated copyright dates

microchip8
21st February 2011, 19:07
ChangeLog for version 9.3.3
* Fixed a bug in directory batch mode were wrong conditional was used to check for the DEFOUTPUT variable
* Display which file is currently being processed in batch mode
* Check only for files while in batch mode
* Do not exit if user types an incorrect answer to y/n questions. Instead, ask the question again. Patch by Jan-Hendrik Peters and friends

microchip8
9th March 2011, 15:16
ChangeLog for version 9.3.4
* Fix option 4 and 5 of the video_deblock_func() function. Wrong vars used

microchip8
29th March 2011, 09:29
ChangeLog for version 9.3.5
* Added support for setting the crop rounding value

microchip8
3rd April 2011, 13:34
ChangeLog for version 9.3.6
* Fixed the subtitles function which got broken when the get_selection_func() function got introduced

Carpo
4th April 2011, 12:53
I would use this tool but a few things i am unsure of, for example, how will i know what interlacing options to choose? Is there a way of scanning the stream on linux and having it tell you? Guess comming from windows i have been spoilt by MeGUI doing it all for me

microchip8
4th April 2011, 13:02
I would use this tool but a few things i am unsure of, for example, how will i know what interlacing options to choose? Is there a way of scanning the stream on linux and having it tell you? Guess comming from windows i have been spoilt by MeGUI doing it all for me

Not for interlacing, no. I haven't implemented that and I don't think I will. However, if you feed it an NTSC type DVD, it will try to detect whether it's (soft) telecined or not, and it will tell you. But for pure interlacing, you'd have to know your source and answer appropriate

if you want a fast and decent deinterlacer (not perfect) use yadif. You can go even higher by combining yadif + mcdeint but I don't see much difference between yadif only and yadif with mcdeint, and the latter can be much slower (depends on chosen mcdeint mode)

ganymede
4th April 2011, 15:01
Is there a way of scanning the stream on linux and having it tell you?Use mediainfo (http://mediainfo.sourceforge.net/).

Rasi
9th April 2011, 09:32
Are there any plans to support ffmpeg in the future?

mencoder wasnt worked on for quite a while (years) and even its dev say its a hack, while ffmpeg is constantly improving... i find it odd, that there is only one tool for easy ripping with ffmpeg (handbrake)

microchip8
9th April 2011, 12:11
Are there any plans to support ffmpeg in the future?

mencoder wasnt worked on for quite a while (years) and even its dev say its a hack, while ffmpeg is constantly improving... i find it odd, that there is only one tool for easy ripping with ffmpeg (handbrake)

Yes, I know about the state of mencoder :)

No, I don't plan in supporting ffmpeg within h264enc as it will require a major rewrite in a lot of parts in the script... Maybe I'll write a new script at some point which uses ffmpeg instead. My main problem with ffmpeg is that it can't directly read from DVDs while mencoder easily can

watsonalgas
8th May 2011, 03:37
Do you know if there's any reason why recently it's been necessary to add -mc 0 -noskip to my h264enc encodes? It wasn't necessary before (unless if the DVDs I've done recently have all had similar aspects, which I doubt), but it seems like I have to do it to everything now. Maybe it should be added as default or at least as an option?

I've attached the config I'm using, and most recent encodes have lost audio-video sync (no matter if I have to deinterlace, IVTC, or nothing at all) without the two mentioned parameters.

microchip8
8th May 2011, 12:52
that preset you attached doesn't tell me anything. it's just the x264 options. I need the batch file instead

what audio codec are you using?

watsonalgas
9th May 2011, 03:04
I don't have the encoding file anymore, if I come across another one I'll upload it. I tried all of them with either IVTC or just plain, and the audio would be out of sync and a bunch of Skipped frame! or Duplicate frame! warnings.

The audio codec was either copy (AC3), or a couple had to be encoded from LPCM to AC3. Finally I would just do -nosound and do the audio myself due to the problem I was having.

microchip8
9th May 2011, 11:12
that's your problem right there. Recent versions of mencoder have issues with copying AC3 streams (or encoding to AC3). I suggest using a different audio codec. I always use Nero AAC and never have issues

watsonalgas
9th May 2011, 13:05
Yeah, you're right. So I just have to use -nosound to fix the problem. I use AC3 because I like a copy of the audio stream, not an encode.

It's weird that mencoder recently broke that, it seems like a big issue for encoding anyway.

POSSIBLE FIX: I know this isn't a problem with h264enc, but if you're interested a fix could be just encoding (or dumping) all audio seperately instead of during the encode. That solved my problems with AC3. So instead of dumping and encoding the audio in the same command as the video encode (as is usually done), make it -nosound and do the main audio like secondary audio streams are done.

yak_vi
12th May 2011, 00:59
Hi, thanks for sharing this utility! i have a VPS with Centos 5, all ok but when start to encode say this (all for command line i dont have video card), the error is:
[root@213671 html]# h264enc -2p -p fast

+=============================================================+
|<<<<<<< h264enc - the interactive shell script ripper >>>>>>>|
|-------------------------------------------------------------|
|<<<<<< version: 9.3.6 - (C) 2006-2011, Grozdan Nikolov >>>>>>|
+=============================================================+


Select the Input type [file/dir/dvd/vcd]: file
Provide the Input Video File: SAMPLE.VOB
Provide a name for the Output File [default is H264-23961]: sample

Note that you are running out of disk space in
the destination output directory and/or in the
configuration directory of h264enc!

This could be a problem if you want to convert
the final encode to MKV, OGM, TS or to the MP4
container. It is recommended to free up some disk
space or provide a different destination output
directory before continuing with the encoding
process if you intend to do some of the above
tasks!

Space left over in '/root': 2592 MiB
Space left over in '/root/.h264enc/job23961': 2592 MiB

#### Press 'Enter' to continue, CTRL+C to exit ####

Scan for multiple video streams? [y/N]: n
Would you like to use Pre/Postprocessing video filters? [y/N]: n
Would you like to Crop the Video file? [y/N]: n
Would you like to include/rip a Subtitle? [y/N]: n

-> Detecting FPS value...
-> Detected 25.000 FPS
-> Number of frames: 1722

Would you like to set/force the Output Frame Rate (FPS)? [y/N]: n
Would you like to do Frame Rate Conversion? [y/N]: n

-> Detecting original resolution...
-> Original resolution: 720x576

-> Detected Aspect Ratio (AR): 1.7778:1
-> Storage Aspect Ratio (SAR): 1.2500:1
-> Pixel Aspect Ratio (PAR): 1.4222:1
-> Total pixels: 414720

Specify the desired Resolution [default is 720x576]: 720x576
Specify the Expand filter parameters [press 'Enter' to skip]:
Would you like to set/force the input Video Aspect Ratio? [y/N]:

+=============================+
| H.264 Encoder Configuration |
+=============================+

Specify the desired Video Bitrate in kbps [default is 1000]:

-> Bits Per Pixel value: 0.096 bpp
-> Bits Per Block value: 24.691 bpb
-> Using "x264 fast" preset

+=====================+
| Audio Configuration |
+=====================+

Scan for multiple Audio streams? [y/N]: n

Available Audio Codecs
~~~~~~~~~~~~~~~~~~~~~~
MP3 -----> Container support: AVI, MKV, MP4, OGM, TS
AC3 -----> Container support: AVI, MKV, MP4, OGM, TS
AAC -----> Container support: MKV, MP4, TS
AAC+ ----> Container support: MP4, MKV
neroAAC -> Container support: MP4, MKV
VORBIS --> Container support: MP4, MKV, OGM
FLAC ----> Container support: MKV
PCM -----> Container support: AVI, MKV, OGM
COPY ----> Container support: Depends on audio codec
NOSOUND -> Container support: AVI, MKV, MP4, OGM, TS

Track 1: Select the Audio Codec [default is AAC]: AAC
Track 1: Specify the AAC encoding mode [ABR/VBR - default is ABR]: VBR
Track 1: Specify the AAC Quality value [10-500 - default is 150]: 96
Track 1: Enable AAC Temporal Noise Shaping? [y/N]: n
Track 1: Would you like to decode/output more than 2 Audio Channels? [y/N]: n
Track 1: Would you like to use Audio filters? [y/N]: n

+=============================+
| Miscellaneous Configuration |
+=============================+

Would you like to inspect the MEncoder options? [y/N]: n
Would you like to encode a Sample? [y/N]: n
Would you like to save the MEncoder options to a file? [y/N]: n
Would you like to convert the final encode from AVI to MKV? [y/N]: y
Specify the Release Year of the content [press 'Enter' to skip]:
Specify a Genre for the content [press 'Enter' to skip]:
Provide a Cover file in jpeg/png format [press 'Enter' to skip]:
Would you like to convert the final encode from AVI to MP4? [y/N]: y
Specify the Release Year of the content [press 'Enter' to skip]:
Specify a Genre for the content [press 'Enter' to skip]:
Provide a Cover file in jpeg/png format [press 'Enter' to skip]:
Hint the MP4 file for RTP/RTSP streaming sessions? [y/N]: n
Would you like to convert the final encode from AVI to TS? [y/N]: n

-> Starting to encode the Video file in 2-pass mode
-> Using "x264 fast" preset
-> Using '/dev/null' as output for the first pass
-> Using '/root/sample.avi' as output file for the second pass

Starting to encode in: 5 4 3 2 1
MEncoder SVN-r31628-4.1.2 (C) 2000-2010 MPlayer Team
Option x264encopts: turbo option is deprecated; use slow_firstpass to disable turbo
success: format: 0 data: 0x0 - 0x4bae000
MPEG-PS file format detected.
VIDEO: MPEG2 720x576 (aspect 3) 25.000 fps 9608.0 kbps (1201.0 kbyte/s)
[V] filefmt:2 fourcc:0x10000002 size:720x576 fps:25.000 ftime:=0.0400
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 48000 Hz, 2 ch, s16le, 192.0 kbit/12.50% (ratio: 24000->192000)
Selected audio codec: [ffac3] afm: ffmpeg (FFmpeg AC-3)
==========================================================================
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
Opening video filter: [harddup]
Opening video filter: [softskip]
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffmpeg2] vfm: ffmpeg (FFmpeg MPEG-2)
==========================================================================
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
x264 [info]: using SAR=64/45
x264 [info]: using cpu capabilities: none!
x264_encoder_open failed.
FATAL: Cannot initialize video driver.

Exiting...
-> MEncoder has exited with a non-zero value!
-> Exiting in function: mencoder_exit()

FATAL: Cannot initialize video driver.

Always say same error!

Is possible encode with your utility in linux only in console?

Thanks!

microchip8
15th May 2011, 14:36
@yak_vi

I'm not sure what is causing this. Try updating your mencoder/mplayer. Also your x264 looks like it can't detect any CPU capabilities. Looks like broken to me

yes it is possible to encode on linux in console only. I do it all the time

microchip8
15th May 2011, 14:37
ChangeLog for version 9.3.7
* Removed the ssim and psnr options from the presets. Should only be used for benchmarking

yak_vi
8th July 2011, 20:42
froggy1 is possible in the script modify to add subtitles to video? Thanks!

microchip8
8th July 2011, 21:45
@yak_vi

you can already do that

microchip8
23rd July 2011, 10:02
ChangeLog for version 9.3.8
* Update the mq, nq, hq, vhq, ehq, uhq and ihq presets. Increase subme by 1. For the ihq preset, this means that
it uses subme 11 now which requires latest x264 from git

microchip8
8th August 2011, 18:31
ChangeLog for version 9.3.9
* Bugfix: selecting the x264 internal denoiser does nothing due to missing $nr variable in the MEncoder options

microchip8
20th August 2011, 15:06
ChangeLog for version 9.4.0
* Disable mbtree in multipass mode to prevent segfaulting MEncoder due to differences in frames amount in
the passlog file. Disabling mbtree reduces quality but saves us a crash in MEncoder
* Notify the user that the script does not support AAC in AVI anymore. Also exit if user has not selected any of
the other supported containers

microchip8
10th October 2011, 20:41
ChangeLog for version 9.4.1
* Introduced two new variables in the config file, DEFAULT_VID_BITRATE and DEFAULT_AUD_CODEC.
The first one sets the default video bitrate or CRF/QP value while the second one can be used to set a
default audio codec. This change updates the config file to version 20
* Fixed a typo in man page

lib3rty1
28th November 2011, 21:11
I have ubununtu 11.10 server edition.

When I am runing h264enc I got


Checking for utility 'bc'... FAILED!


I have restartec cfg file but still I got that issue.
any idea how to fix it ?

microchip8
28th November 2011, 21:14
did you reset the config file with h264enc -r ?

if that still doesn't work, then open the config and add the path to bc manually. The config is in $HOME/.h264enc/config

lib3rty1
28th November 2011, 21:26
yes I did

where I can find that bc ?

microchip8
28th November 2011, 21:29
If you have installed bc, then type "which bc" in a terminal (no quotes). Then add the line in the BC variable of the config file

lib3rty1
28th November 2011, 21:34
ok got it working :D
great thx :)

love ya and your work :)

ok, last question, where to put nero acc codes to run it under your scrip ?

Goga777
3rd December 2011, 17:03
why h264enc didn't finish succesfully audio encoding ?


h264enc -crf -p fast

+=============================================================+
|<<<<<<< h264enc - the interactive shell script ripper >>>>>>>|
|-------------------------------------------------------------|
|<<<<<< version: 9.4.1 - (C) 2006-2011, Grozdan Nikolov >>>>>>|
+=============================================================+


Select the Input type [file/dir/dvd/vcd]: dir
Provide one Input Video File from the directory: dvgrab-2011.11.29_15-12-34.dv
Where to store the encodings? [default is /root/h264enc_21787]:
Would you like to use Pre/Postprocessing video filters? [y/N]:
Would you like to Crop the Video files? [y/N]:
Would you like to include/rip a Subtitle? [y/N]:

-> Detecting FPS value...
-> Detected 25.000 FPS
-> Number of frames: 148

Would you like to set/force the Output Frame Rate (FPS)? [y/N]:
Would you like to do Frame Rate Conversion? [y/N]:

-> Detecting original resolution...
-> Original resolution: 720x576

-> Detected Aspect Ratio (AR): 1.7778:1
-> Storage Aspect Ratio (SAR): 1.2500:1
-> Pixel Aspect Ratio (PAR): 1.4222:1
-> Total pixels: 414720

Specify the desired Resolution [default is 720x576]:
Specify the Expand filter parameters [press 'Enter' to skip]:
Would you like to set/force the input Video Aspect Ratio? [y/N]:

+=============================+
| H.264 Encoder Configuration |
+=============================+

Specify the desired CRF value [0-51.0 - default is 20.0]:

-> Using "x264 fast" preset

+=====================+
| Audio Configuration |
+=====================+


Available Audio Codecs
~~~~~~~~~~~~~~~~~~~~~~
MP3 -----> Container support: AVI, MKV, MP4, OGM, TS
AC3 -----> Container support: AVI, MKV, MP4, OGM, TS
AAC -----> Container support: MKV, MP4, TS
AAC+ ----> Container support: MP4, MKV
neroAAC -> Container support: MP4, MKV
VORBIS --> Container support: MP4, MKV, OGM
FLAC ----> Container support: MKV
PCM -----> Container support: AVI, MKV, OGM
COPY ----> Container support: Depends on audio codec
NOSOUND -> Container support: AVI, MKV, MP4, OGM, TS

Track 1: Select the Audio Codec [default is AAC]: neroAAC
Track 1: Which AAC Profile to use? [LC/HE/HEv2 - default is LC]:
Track 1: Specify the AAC Encoding Mode [ABR/CBR/VBR - default is ABR]:
Track 1: Specify the AAC Average Bitrate in kbps [default is 96]:
Track 1: Use 2-pass AAC encoding instead of 1-pass? [y/N]:
Track 1: Would you like to decode/output more than 2 Audio Channels? [y/N]:
Track 1: Would you like to use Audio filters? [y/N]:

+=============================+
| Miscellaneous Configuration |
+=============================+

Would you like to convert the final encode from AVI to MKV? [y/N]: y
Would you like to convert the final encode from AVI to MP4? [y/N]:
Delete the AVI file after remuxing? [y/N]: y

-> Starting to batch encode Video files in '.'
-> Using "x264 fast" preset
-> Using '/root/h264enc_21787' as output directory for all Video files
-> Using constant rate factor mode for all Video files
-> Batch file located in '/root/.h264enc/batch21787'

Starting to encode in: 5 4 3 2 1

-> Processing file './dvgrab-2011.11.29_15-12-34.dv'

MPlayer SVN-r34245 (C) 2000-2010 MPlayer Team
success: format: 0 data: 0x0 - 0x1453200
libavformat file format detected.
[dv @ 0x89e7da0]Estimating duration from bitrate, this may be inaccurate
[lavf] stream 0: video (dvvideo), -vid 0
[lavf] stream 1: audio (pcm_s16le), -aid 0
VIDEO: [dvsd] 720x576 0bpp 25.000 fps 28800.0 kbps (3515.6 kbyte/s)
[V] filefmt:35 fourcc:0x64737664 size:720x576 fps:25.000 ftime:=0.0400
==========================================================================
Opening audio decoder: [pcm] Uncompressed PCM audio decoder
AUDIO: 48000 Hz, 2 ch, s16le, 1536.0 kbit/100.00% (ratio: 192000->192000)
Selected audio codec: [pcm] afm: pcm (Uncompressed PCM)
==========================================================================
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
Opening video filter: [harddup]
Opening video filter: [softskip]
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffdv] vfm: ffmpeg (FFmpeg DV)
==========================================================================
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
[swscaler @ 0x89d8d60]using unscaled yuv420p -> yuv420p special converter
x264 [info]: using SAR=64/45
x264 [info]: using cpu capabilities: MMX2 SSE2 SSE3 Cache64
x264 [info]: profile High, level 3.0
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
Pos: 1.4s 36f (34%) 0.00fps Trem: 0min 0mb A-V:0.049 [0:1536]
Writing header...
ODML: vprp aspect is 16:9.
Setting audio delay to 0.080s.
Writing header...
ODML: vprp aspect is 16:9.
Setting audio delay to 0.080s.
Pos: 5.9s 148f (100%) 6.36fps Trem: 0min 5mb A-V:0.041 [5640:1535]
File not found: 'n'
Failed to open n.
Cannot open file/device.

Exiting...
*************************************************************
* *
* Nero AAC Encoder *
* Copyright 2009 Nero AG *
* All Rights Reserved Worldwide *
* *
* Package build date: Feb 18 2010 *
* Package version: 1.5.4.0 *
* *
* See -help for a complete list of available parameters. *
* *
*************************************************************

mplayer: could not connect to socket
mplayer: No such file or directory
Processed 4 seconds...



cat batch21787
#!/bin/bash
# Automatically generated batch file by h264enc 9.4.1 on Сбт Дек 3 19:57:55 SAMT 2011

################### START OF COMMANDS ###################

cd "."
test -d "/root/h264enc_21787" || mkdir -p "/root/h264enc_21787"

for i in *; do

if [ -f "$i" ]; then

test -d "/root/.h264enc/job21787" || mkdir -p "/root/.h264enc/job21787"

echo
echo -e "\e[1;32m-> Processing file './$i'\e[0;39;49m"
echo
sleep 3

nice -n 10 /usr/bin/mencoder "$i" -o "/root/h264enc_21787/${i%.*}.avi" -nosub -vf softskip,harddup -oac pcm -ovc x264 -x264encopts crf=20:nointerlaced:preset=fast:keyint=250:keyint_min=25:force_cfr n

test -p "/root/.h264enc/job21787/audio.wav" || mkfifo "/root/.h264enc/job21787/audio.wav"
/usr/local/bin/neroAacEnc -ignorelength -br 96000 -lc -if "/root/.h264enc/job21787/audio.wav" -of "/root/.h264enc/job21787/audio.aac" &
/usr/bin/mplayer "/root/h264enc_21787/${i%.*}.avi" -noconfig all -loop 1 -really-quiet -vc null -vo null -nocache -ao pcm:fast:file="/root/.h264enc/job21787/audio.wav"
sleep 2

echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE Tags SYSTEM \"matroskatags.dtd\">

<Tags>
<Tag>
<Simple>
<Name>Source</Name>
<String>Video file</String>
</Simple>
<Simple>
<Name>Title</Name>
<String>${i%.*}</String>
</Simple>
<Simple>
<Name>Video Filters</Name>
<String>softskip,harddup</String>
</Simple>
<Simple>
<Name>Audio Codec (Track 1)</Name>
<String>LC-AAC Stereo</String>
</Simple>
<Simple>
<Name>Encoder</Name>
<String>MPlayer SVN-r34245 (C) 2000-2010 MPlayer Team</String>
</Simple>
<Simple>
<Name>x264 parameters</Name>
<String>crf=20:nointerlaced:preset=fast:keyint=250:keyint_min=25:force_cfrn</String>
</Simple>
<Simple>
<Name>x264 version</Name>
<String>0.104.1677</String>
</Simple>
<Simple>
<Name>mkvmerge version</Name>
<String>5.1.0</String>
</Simple>
<Simple>
<Name>h264enc parameters</Name>
<String>h264enc -crf -p fast</String>
</Simple>
<Simple>
<Name>Comment</Name>
<String>Tagged by h264enc 9.4.1 on 2011/12/03</String>
</Simple>
</Tag>
</Tags>" > "/root/.h264enc/job21787/mkvtags.xml"
test -e "/root/h264enc_21787/${i%.*}.mkv" && mv -f "/root/h264enc_21787/${i%.*}.mkv" "/root/h264enc_21787/${i%.*}.mkv.old"
/usr/bin/mkvmerge --global-tags "/root/.h264enc/job21787/mkvtags.xml" -A --title "${i%.*}" --track-name 0:"${i%.*}" "/root/h264enc_21787/${i%.*}.avi" --track-name 1:"LC-AAC Stereo" --no-chapters "/root/.h264enc/job21787/audio.aac" -o "/root/h264enc_21787/${i%.*}.mkv"
sleep 2

rm -f "/root/h264enc_21787/${i%.*}.avi"
rm -rf "/root/.h264enc/job21787"

fi

done

#################### END OF COMMANDS ####################




ffmpeg -i dvgrab-2011.11.29_15-12-34.dv
FFmpeg version git-6a7e074, Copyright (c) 2000-2011 the FFmpeg developers
built on Mar 8 2011 10:38:12 with gcc 4.5.2
configuration: --prefix=/usr --extra-cflags='-Wall -g ' --cc='ccache cc' --enable-shared --enable-libmp3lame --enable-gpl --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-postproc --enable-x11grab --enable-libgsm --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libspeex --enable-nonfree --disable-stripping --enable-avfilter --enable-libdirac --disable-decoder=libdirac --enable-libschroedinger --disable-encoder=libschroedinger --enable-version3 --enable-libopenjpeg --enable-libvpx --enable-librtmp --extra-libs=-lgcrypt --disable-altivec --disable-armv5te --disable-armv6 --disable-vis
libavutil 50. 39. 0 / 50. 39. 0
libavcodec 52.113. 2 / 52.113. 2
libavformat 52.102. 0 / 52.102. 0
libavdevice 52. 2. 3 / 52. 2. 3
libavfilter 1. 76. 0 / 1. 76. 0
libswscale 0. 12. 0 / 0. 12. 0
libpostproc 51. 2. 0 / 51. 2. 0
[dv @ 0x8468dc0] Estimating duration from bitrate, this may be inaccurate
Input #0, dv, from 'dvgrab-2011.11.29_15-12-34.dv':
Duration: 00:00:05.92, start: 0.000000, bitrate: 28800 kb/s
Stream #0.0: Video: dvvideo, yuv420p, 720x576, 28800 kb/s, PAR 64:45 DAR 16:9, 25 tbr, 25 tbn, 25 tbc
Stream #0.1: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
At least one output file must be specified

microchip8
3rd December 2011, 17:51
ok got it working :D
great thx :)

love ya and your work :)

ok, last question, where to put nero acc codes to run it under your scrip ?

you can put them in /usr/local/bin

make sure you run h264enc -r after that

microchip8
3rd December 2011, 18:03
@Goga777

you have somehow introduced an illegal character. There's mentioning of an 'n' in the settings and the mkv global tags. I don't know how you introduced that character since I can't replicate here and I followed the exact steps you took

Goga777
4th December 2011, 14:44
yes, with terminal emulator as konsole, gnome-terminal and Yakuake I have the problem with additional 'n'

but with native terminal (ctrl-alt-f1) I don't have the problems with this issue

andara
14th December 2011, 10:56
I used h264enc about a year ago and was really amazed. It just worked out of the box and produced great results. Since then I've updated from Fedora 14 to Fedora 16 and when I tried to use h264enc on my current system, it unfortunately didn't work at all.
First mencoder crashed all the time and I couldn't get anything encoded. Obviously the h264enc version and the mencoder version provided for Fedora 16 on http://rpmfusion.org/ are not compatible. I downloaded the 9.4.1 release of h264enc from sourceforge and manually compiled a current svn version of mencoder. This fixed most of the problems and h264enc almost works as expected now. The only remaining --- but unfortunately huge issue --- is a completely messed up a/v sync.
I get lots of warnings about duplicate frames while encoding and the audio stream is several seconds off compared to the video stream in the resulting file.
If I manually add "-mc 0 -noskip" to all mencoder calls in the created batchfile I don't see any of the duplicate frames warnings and a/v sync seems ok.

Am I the only one seeing this kind of a/v sync problems with the default settings of h264enc, or is this a common problem (with a known fix)?

By the way: I use the h264enc options "-crf -p ehq" to convert a PAL DVD and "COPY" for the audio stream which is an AC-3 stream.

nevertheless: thanks for this great little helper tool!

microchip8
14th December 2011, 11:39
Unfortunately, this can happen at any time. MEncoder is unmaintained and each time it works, we're a bit lucky. I've also had my share of problems with it and am currently using a somewhat older version to bypass some issues in current ones. I don't think there's much I can do about your problem. My only two questions are: 1) does this also happen with other audio codecs? and 2) does this always happen, regardless of the DVD you use?

andara
19th December 2011, 03:06
sorry for the late response
I'm new to the forum and messed up my mail notification settings...

I see the problem with lots of different DVDs

I just checked one DVD with different audio codecs and the problem seems to be restricted to COPY. AAC, VORBIS and even reencoding to AC3 seems to work fine, but when selecting COPY for the AC3 input I get lots of duplicate frames and a/v sync issues in the output file.

Adding "-mc 0 -noskip" to the mencoder calls fixes the a/v issues and I didn't find other artifacts in the output files, but I didn't run exhaustive tests and I'm definitely not an mencoder expert, so I'm not sure if it's a good idea to add it to the COPY preset.

microchip8
19th December 2011, 11:35
yeah, this definitely sounds like a mencoder issue. Unfortunately i can't add -mc 0 -noskip as default for copy as it couldn mess up things in other mencoder versions where this doesn't happen so i think you'll just need to keep adding these options

andara
19th December 2011, 13:44
Thanks for the prompt reply!

Do you think I should report an mencoder bug for this issue?

I know you have considered ffmpeg as alternative to mencoder

Yes, I know about the state of mencoder :)

No, I don't plan in supporting ffmpeg within h264enc as it will require a major rewrite in a lot of parts in the script... Maybe I'll write a new script at some point which uses ffmpeg instead. My main problem with ffmpeg is that it can't directly read from DVDs while mencoder easily can

have you thought about using VLC? Should be no problem to read DVDs, ISO images or VIDEO_TS folders with VLC and there are quite some command line switches for tanscoding.
There might be less compatibility issues which might lead to less maintenance work on your side ;)

microchip8
19th December 2011, 13:58
Even if you report it, I don't think anyone will fix the issue as no one works on mencoder anymore. The main dev of mplayer doesn't care much for mencoder and it's the same with the other handful devs. If you're up to it, report, but don't expect this to get fixed (anytime soon, if at all). I can add an option to the script so the user can pass "additional options" to mencoder... We'll see :)

No, I haven't considered VLC. It's not really a flexible encoding tool

microchip8
19th December 2011, 15:03
btw, I just tried using COPY on a few DVDs. It all works fine on my side. No duplicate or frame skipping issues. Though like I mentioned, I use a somewhat older SVN version of MEncoder - MEncoder SVN-r32792

andara
19th December 2011, 15:28
I use MEncoder SVN-r34401-4.6.2, so it's probably a recently introduced bug...

microchip8
19th December 2011, 15:38
you're right. I just compiled r34450 and I also get duplicates while doing COPY. Definitely something wrong with mencoder

andara
19th December 2011, 15:44
I found a related MEncoder bug and added a reference to this thread
http://bugzilla.mplayerhq.hu/show_bug.cgi?id=1958

Rasi
21st December 2011, 16:47
As much as i love mplayer - mencoder really needs to die. ffmpeg may have its own flaws, but in general its much better suited for encoding nowadays.

microchip8
21st December 2011, 20:58
As much as i love mplayer - mencoder really needs to die. ffmpeg may have its own flaws, but in general its much better suited for encoding nowadays.

And as long as mencoder exists and works "fairly OK", I will keep maintaining h264enc and my other scripts :)

hlmasterchief93
25th December 2011, 09:37
hi, just switch to linux/ubuntu
so i am looking for encoder
whats about other options, FFmpeg ?

microchip8
27th December 2011, 19:31
hi, just switch to linux/ubuntu
so i am looking for encoder
whats about other options, FFmpeg ?

ffmpeg will not be supported by h264enc.

microchip8
1st January 2012, 16:58
ChangeLog for version 9.4.2

* Use a separate variable in config file for setting the default CRF or QP value (DEFAULT_VID_CRFQP). This bumps the config file version to 21
* Renamed the DEFOUTPUT, DEFPATH and DEFBATCHDIR variables to DEFAULT_OUTPUT, DEFAULT_PATH and DEFAULT_BATCHDIR
* Be slightly more portable by using #!/usr/bin/env bash instead of #!/bin/bash shebang
* Replaced some if conditionals in the -sc option by using 'test' directly
* Added an option for passing additional MEncoder parameters. Useful for when the user wants to use something like -mc 0 -noskip, for example
* Added support for encoding to DTS audio through the dcaenc encoder which can be found at http://aepatrakov.narod.ru/dcaenc/
* Minor changes to the video_delogo_func() function. Use $sourcetype, $device, $vid and $MPLAYEROPTS variables. Also use -nosound in MPlayer
* Improved the mkvtags file. Escape special characters like &, <, > and " in the Title field

microchip8
3rd January 2012, 14:56
ChangeLog for version 9.4.3
* Use -vc dummy in MPlayer in the audio code. Seems to work better on some files

Henrikx
15th January 2012, 13:47
Question from the German Debianforum : With Version 9.3.2 is not (more?)possible to multiplex (mux) AAC/AC3 in Avi. Is that correct?
https://debianforum.de/forum/viewtopic.php?f=25&t=133846

microchip8
15th January 2012, 13:51
AAC in AVI is no longer supported. AC3 in AVI however is still supported

If you want to use AAC, you must select at least one of the other supported containers like MP4/MKV/TS

Henrikx
15th January 2012, 18:40
Thx!!!

microchip8
21st February 2012, 20:08
ChangeLog for version 9.4.4
* Only 'sed' mbtree for multi-pass mode
* Don't append "- chapter [id]" to output file when encoding only specific chapters

Goga777
13th March 2012, 00:45
I tried to encode video for my mobile phone Samsung S5230
Normally the phone support AAC, AAC+, mp3 and h264 in mp4 conainer. Resolution should be 320x240
Nevertheless I couldn't obtain the video which will bw play on my phone.
I have the error - unsupported media format or bitrate over

my batchfile is here http://paste.org.ru/?qj93dc


mplayer can play this file, but Samsung couldn't


mplayer H264-29612.mp4
Failed to read /etc/mplayer/mplayer.conf.local: No such file or directory
Warning unknown option include at line 171
MPlayer SVN-r34728 (C) 2000-2010 MPlayer Team
Can't open joystick device /dev/input/js0: No such file or directory
Can't init input joystick
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing H264-29612.mp4.
libavformat version 54.1.100 (internal)
libavformat file format detected.
[lavf] stream 0: video (h264), -vid 0
[lavf] stream 1: audio (mp3), -aid 0, -alang und
VIDEO: [H264] 320x240 24bpp 25.000 fps 981.2 kbps (119.8 kbyte/s)
Clip info:
major_brand: isom
minor_version: 1
compatible_brands: isomavc1
creation_time: 2012-03-12 23:13:16
title: H264-29612
comment: Tagged by h264enc 9.4.4 on Втр Мар 13 03:13:16 SAMT 2012
Load subtitles in ./
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec version 54.3.100 (internal)
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
==========================================================================
Requested audio codec family [mpg123] (afm=mpg123) not available.
Enable it at compilation.
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 44100 Hz, 2 ch, floatle, 131.0 kbit/4.64% (ratio: 16379->352800)
Selected audio codec: [ffmp3float] afm: ffmpeg (FFmpeg MPEG layer-3 audio)
==========================================================================
AO: [alsa] 48000Hz 2ch floatle (4 bytes per sample)
Starting playback...
Unsupported PixelFormat 61
Unsupported PixelFormat 53
Unsupported PixelFormat 81
Movie-Aspect is 1.77:1 - prescaling to correct movie aspect.
VO: [xv] 320x240 => 426x240 Planar YV12
A: 1.1 V: 1.0 A-V: 0.171 ct: -0.036 0/ 0 217% 327% 9.9% 4 0

Exiting... (Quit)


what will be your recommendation to obtain compatible videofile with my phone?

microchip8
13th March 2012, 09:47
I really don't know what your phones supports but I'd suggest using one of the iPhone presets and see if it works

Goga777
20th March 2012, 20:09
thank you for the advice - the Apple iPod Classic preset helped me

Soapm
24th March 2012, 19:10
I am having a lot of trouble using this program. I am a movie novice but some of the questions are kind of confusing.

Like this one for example;

Specify the desired Resolution [default is ??]:

No matter what I put I get an error saying it isn't dividable by 16. Where or how would I find the correct response?

Then after filling out that entire script this is what I get for an output. What's up with this?

Starting to encode in: 5 4 3 2 1
MPlayer SVN-r31918 (C) 2000-2010 MPlayer Team
The hostname option must be an integer: platoon
Struct dvd, field hostname parsing error: platoon
libdvdread: Encrypted DVD support unavailable.
libdvdnav:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.IFO failed
libdvdnav:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.BUP failed
libdvdread: Can't open file VIDEO_TS.BU.
Can't open VMG info!
No stream found to handle url dvd://platoon
Cannot open file/device.

Exiting...
-> MEncoder has exited with a non-zero value!
-> Exiting in function: mencoder_exit()

Lastly, is there a secret to making the scan work? I push 7 for all and get this question;

Specify the DVD title [1-/all]

What in the world is that asking? and what do you put for a response. I tried 1 then I tried all but neither seems to give me an output.

microchip8
25th March 2012, 11:49
@Soapm

You're dealing with an encrypted DVD but your mplayer doesn't have that support
libdvdread: Encrypted DVD support unavailable.

I suspect that's why you get these problems. Compile mplayer yourself or get a package with encrypted support from somewhere

Goga777
25th March 2012, 16:07
seems there is problem withe transcoding aac with faac


-> Track 1: Encoding audio with 'faac' to LC-AAC, please wait...
-> Track 1: This can take a while...


the process is frozen and have to stop it with ctrl-с in 10 minutes after this message
If I will use neroAAC than no problem


h264enc -1p -p ipc


+=============================================================+
|<<<<<<< h264enc - the interactive shell script ripper >>>>>>>|
|-------------------------------------------------------------|
|<<<<<< version: 9.4.4 - (C) 2006-2012, Grozdan Nikolov >>>>>>|
+=============================================================+


Select the Input type [file/dir/dvd/vcd]: file
Provide the Input Video File: Hanna.mp4
Provide a name for the Output File [default is H264-6680]: Hanna.mp4

-> Renaming existing file to 'Hanna.avi.1.old'

Scan for multiple video streams? [y/N]:
Would you like to use Pre/Postprocessing video filters? [y/N]:
Would you like to Crop the Video file? [y/N]:
Would you like to include/rip a Subtitle? [y/N]:

-> Detecting FPS value...
-> Detected 29.750 FPS
-> Number of frames: 5721

Would you like to set/force the Output Frame Rate (FPS)? [y/N]:

-> Detecting original resolution...
-> Original resolution: 480x222
-> Valid iPod Classic resolutions: 320x240

-> Detected Aspect Ratio (AR): 2.1622:1
-> Storage Aspect Ratio (SAR): 2.1621:1
-> Pixel Aspect Ratio (PAR): 1.0000:1
-> Total pixels: 106560

Specify the desired Resolution [default is 480x222]: 320x240

Available Software Scalers
~~~~~~~~~~~~~~~~~~~~~~~~~~
0 --> Fast Bilinear
1 --> Bilinear
2 --> Bicubic
3 --> Experimental
4 --> Nearest Neighbor/Point
5 --> Area Averaging
6 --> Luma Bicubic/Chroma Bilinear
7 --> Gaussian
8 --> Sinc
9 --> Lanczos
10 -> Natural Bicubic Spline

-> Storage Aspect Ratio (SAR): 1.3333:1
-> Pixel Aspect Ratio (PAR): 1.6216:1
-> Total pixels: 76800

Select a Software Scaler [default is 10]:
Specify the Display size/aspect [press 'Enter' to skip]:
Specify the Expand filter parameters [press 'Enter' to skip]:
Would you like to set/force the input Video Aspect Ratio? [y/N]: y

-> Detecting video aspect ratio...
-> Detected: 2.1622

Specify the Aspect Ratio [4:3/16:9/1.3333/1.7778... - default is 2.1622]: 16:9

+=============================+
| H.264 Encoder Configuration |
+=============================+

Specify the desired Video Bitrate in kbps [default is 1000]:

-> Bits Per Pixel value: 0.437 bpp
-> Bits Per Block value: 112.044 bpb
-> Using "Apple iPod Classic" preset

+=====================+
| Audio Configuration |
+=====================+

Scan for multiple Audio streams? [y/N]:

Track 1: Select the Audio Codec [AAC/neroAAC/NOSOUND - default is AAC]: AAC
Track 1: Specify the AAC Average Bitrate [default is 128]:
Track 1: Enable AAC Temporal Noise Shaping? [y/N]:
Track 1: Would you like to use Audio filters? [y/N]:

+=============================+
| Miscellaneous Configuration |
+=============================+

Would you like to set a target file size? [y/N]:
Would you like to pass additional options to MEncoder? [y/N]:
Would you like to inspect the MEncoder options? [y/N]:
Would you like to encode a Sample? [y/N]:
Would you like to save the MEncoder options to a file? [y/N]:
Would you like to convert the final encode from AVI to MKV? [y/N]:
Would you like to convert the final encode from AVI to MP4? [y/N]: y
Specify the Release Year of the content [press 'Enter' to skip]:
Specify a Genre for the content [press 'Enter' to skip]:
Provide a Cover file in jpeg/png format [press 'Enter' to skip]:
Hint the MP4 file for RTP/RTSP streaming sessions? [y/N]:
Would you like to convert the final encode from AVI to TS? [y/N]:

-> Starting to encode the Video file in 1-pass mode
-> Using "Apple iPod Classic" preset
-> Using '/home/goga/Hanna.avi' as output file

Starting to encode in: 5 4 3 2 1
MPlayer SVN-r34809 (C) 2000-2012 MPlayer Team
success: format: 0 data: 0x0 - 0xc53c4c
libavformat version 54.2.100 (internal)
libavformat file format detected.
[lavf] stream 0: audio (aac), -aid 0, -alang und
[lavf] stream 1: video (h264), -vid 0
VIDEO: [H264] 480x222 24bpp 29.750 fps 414.5 kbps (50.6 kbyte/s)
[V] filefmt:44 fourcc:0x34363248 size:480x222 fps:29.750 ftime:=0.0336
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
libavcodec version 54.10.100 (internal)
AUDIO: 44100 Hz, 2 ch, s16le, 120.5 kbit/8.54% (ratio: 15060->176400)
Selected audio codec: [ffaac] afm: ffmpeg (FFmpeg AAC (MPEG-2/MPEG-4 Audio))
==========================================================================
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
Opening video filter: [harddup]
Opening video filter: [scale w=320 h=240 interlaced=0]
Opening video filter: [softskip]
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
Unsupported PixelFormat 61
Unsupported PixelFormat 53
Unsupported PixelFormat 81
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
[swscaler @ 0x8b40c00]Bicubic spline scaler, from yuv420p to yuv420p using MMX2
x264 [warning]: max bitrate less than average bitrate, assuming CBR
x264 [info]: using SAR=213/160
x264 [warning]: VBV bitrate (1000) > level limit (768)
x264 [info]: using cpu capabilities: MMX2 SSE2 SSE3 Cache64
x264 [info]: profile Constrained Baseline, level 1.3
Pos: 1.4s 43f ( 1%) 0.00fps Trem: 0min 0mb A-V:0.056 [0:1536]
Writing header...
ODML: vprp aspect is 16384:9230.
Writing header...
ODML: vprp aspect is 16384:9230.
Pos: 192.3s 5722f (100%) 37.21fps Trem: 0min 57mb A-V:0.036 [963:1535]

Flushing video frames.
Writing index...
Writing header...
ODML: vprp aspect is 16384:9230.

Video stream: 963.942 kbit/s (120492 B/s) size: 23175098 bytes 192.336 secs 5722 frames

Audio stream: 1536.000 kbit/s (191999 B/s) size: 36927492 bytes 192.331 secs
x264 [info]: frame I:81 Avg QP:15.37 size: 14053
x264 [info]: frame P:5641 Avg QP:17.95 size: 3907
x264 [info]: mb I I16..4: 7.0% 0.0% 93.0%
x264 [info]: mb P I16..4: 0.6% 0.0% 5.1% P16..4: 33.8% 35.3% 15.5% 0.0% 0.0% skip: 9.8%
x264 [info]: coded y,uvDC,uvAC intra: 89.4% 97.1% 89.7% inter: 46.5% 60.4% 17.1%
x264 [info]: i16 v,h,dc,p: 33% 42% 9% 17%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 40% 13% 12% 4% 6% 9% 4% 8% 4%
x264 [info]: i8c dc,h,v,p: 35% 15% 39% 11%
x264 [info]: kb/s:963.94

-> Track 1: Encoding audio with 'faac' to LC-AAC, please wait...
-> Track 1: This can take a while...





lushing video frames.
Writing index...
Writing header...
ODML: vprp aspect is 16384:9230.

Video stream: 963.682 kbit/s (120460 B/s) size: 23168857 bytes 192.336 secs 5722 frames

Audio stream: 1536.000 kbit/s (191999 B/s) size: 36927492 bytes 192.331 secs
x264 [info]: frame I:81 Avg QP:15.35 size: 14077
x264 [info]: frame P:5641 Avg QP:17.95 size: 3905
x264 [info]: mb I I16..4: 7.0% 0.0% 93.0%
x264 [info]: mb P I16..4: 0.6% 0.0% 5.1% P16..4: 33.8% 35.3% 15.5% 0.0% 0.0% skip: 9.7%
x264 [info]: coded y,uvDC,uvAC intra: 89.4% 97.1% 89.8% inter: 46.5% 60.4% 17.0%
x264 [info]: i16 v,h,dc,p: 33% 41% 8% 17%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 40% 13% 12% 4% 6% 9% 4% 8% 4%
x264 [info]: i8c dc,h,v,p: 35% 15% 39% 11%
x264 [info]: kb/s:963.68

-> Track 1: Encoding audio with 'neroAacEnc' to LC-AAC, please wait...
-> Track 1: This can take a while...
-> Track 1: Done

-> Converting AVI file to the MP4 container, please wait...
-> Done

-> AVI file size: 57.458 MiB (/home/goga/Hanna.avi)
-> MP4 file size: 25.093 MiB (/home/goga/Hanna.mp4)

Delete the AVI file? [y/N]: y

-> Have a nice day ^_^

microchip8
25th March 2012, 19:45
works fine for me. Can you post your batchfile?

Also make sure your FAAC is compiled with MP4 container support (the -w option)

Soapm
25th March 2012, 20:48
@Soapm

You're dealing with an encrypted DVD but your mplayer doesn't have that support
libdvdread: Encrypted DVD support unavailable.

I suspect that's why you get these problems. Compile mplayer yourself or get a package with encrypted support from somewhere

I just had a chance to dig into it today and I didn't realize my DVD player wasn't mounting. I ended up changing the IDE cable and going cable select and now it seems to be working ok.

The good side is that I installed apt-get install libdvdcss-dev I believe that fixed encryption error. At least it looks that way at this point...

thanks!

Goga777
27th March 2012, 18:13
I think that's the point - MP4 support unavailable. I will use neroAAC

thank you for the tip


faac --help
Freeware Advanced Audio Coder
FAAC 1.28

Usage: faac [options] infiles ...
Options:
-q <quality> Set quantizer quality.
-b <bitrate> Set average bitrate to x kbps. (ABR, lower quality mode)
-c <freq> Set the bandwidth in Hz. (default=automatic)
-o X Set output file to X (only for one input file)
-r Use RAW AAC output file.
-P Raw PCM input mode (default 44100Hz 16bit stereo).
-R Raw PCM input rate.
-B Raw PCM input sample size (8, 16 (default), 24 or 32bits).
-C Raw PCM input channels.
-X Raw PCM swap input bytes
-I <C,LF> Input channel config, default is 3,4 (Center third, LF fourth)

MP4 specific options:
MP4 support unavailable.

Goga777
27th March 2012, 19:05
I'm wondering - why standard in Linux option "--help" doesn't work with h264enc ? only "-help" is working

microchip8
27th March 2012, 19:53
I'm wondering - why standard in Linux option "--help" doesn't work with h264enc ? only "-help" is working

it's to be consistent with the other options, which are all short ones like -v, -r, -iso, etc :)

Goga777
28th March 2012, 19:07
for me more logical will be "-h" and "--help", not "-help". Of course it is up to you

microchip8
28th March 2012, 19:53
for me more logical will be "-h" and "--help", not "-help". Of course it is up to you


if it really bothers you, you can always modify the script and add --help to the case statement :P

mdoyounos
6th April 2012, 07:07
Have a lot of trouble in Linux

Goga777
7th April 2012, 11:06
everything is fine under linux & h264enc

microchip8
7th April 2012, 16:01
ChangeLog for version 9.4.5
* Don't require FAAC to be compiled with MP4 container support (the -w option).
Some distro's do not compile FAAC with MP4 support so play it safe and assume FAAC isn't compiled with MP4 support

microchip8
16th April 2012, 21:47
ChangeLog for version 9.4.6

* Bugfix: FAAC encoding was using wrong language TID in mkvmerge. Should be 0 instead of 1 as we no longer encapsulate AAC in MP4
* Removed --no-chapters mkvmerge option for FAAC encoding. It's no longer needed as we no longer store the AAC audio in MP4 container

lib3rty1
7th May 2012, 22:03
Hi,
I got latest version of h264enc but I got error like



Starting to encode in: 5 4 3 2 1
MEncoder SVN-r1.0~rc3+svn20090426-4.4.3 (C) 2000-2009 MPlayer Team
-nosub is not an MEncoder option

Exiting... (error parsing command line)
-> MEncoder has exited with a non-zero value!
-> Exiting in function: mencoder_exit()


I use

h264enc -2p -p flhq


any idea how to fix it ?

microchip8
7th May 2012, 22:07
Please upgrade your MPlayer. It's 3 years old for God's sake!

lib3rty1
7th May 2012, 23:24
ok, now it does work perfect ;-)

I have question.

When I use -2p -p flhq I got about 3 fps and when I use other options a got a lot more fps and better speed of conversion.

Do you know why it might be like that ?

microchip8
8th May 2012, 10:01
I don't really know. You need to provide more info like what CPU you have and which are those other options you're running

lib3rty1
8th May 2012, 16:04
OK so other option is

h264enc -2p -hq

I am using VPS on OpenVZ 40 GB SSD 8 GB MEM and 4x2 GHz CPU

I have question about subs.

If I am adding subtitles to include in a time to use coding. In what kind of way I add coding ?

I mean like: UTF8 or utf8

microchip8
11th May 2012, 22:21
I don't know why you get low speeds, but make sure all your CPUs are maxed out by the encoding. This should be done automatically as h264enc uses threads=0 which tells libx264 to use all CPUs you throw at it

I don't understand your second question, can you be more clear?

microchip8
26th September 2012, 20:01
ChangeLog for version 9.4.7
* Change bad default bitrate value in DTS audio encoding to 384kbps.

microchip8
1st October 2012, 20:16
ChangeLog for version 9.4.8

* Added bluray_compat=1 parameter to the Blu-ray and AVCHD presets
* Use 'true' instead of 'false' where appropriate
* Updated the man page

lib3rty1
4th February 2013, 20:23
hi again
I have new question....
what should I do to have polish letters in encodes. I mean like ź, ż, ć as i don`t have them only empty fields

microchip8
10th February 2013, 14:12
hi again
I have new question....
what should I do to have polish letters in encodes. I mean like ź, ż, ć as i don`t have them only empty fields

No idea, really :/

microchip8
11th April 2013, 15:07
ChangeLog for version 9.4.9

* Use ffmpeg's MPEG12 decoder instead of the libmpeg12 one

microchip8
21st May 2013, 11:41
ChangeLog for version 9.5.0

* Bugfix: add missing 384 kbps option for AC3 audio
* Notify the user when we first create the config file
* SAR is Sample Aspect Ratio, not Storage Aspect Ratio. Corrected this mistake

microchip8
28th May 2013, 00:48
ChangeLog for version 9.5.1

* Use aften for AC3 audio encoding as MEncoder is currently broken. This bumps up the config file version to 22

microchip8
28th May 2013, 11:38
ChangeLog for version 9.5.2

* Fix OGM muxing with AC3 audio

microchip8
29th May 2013, 08:41
ChangeLog for version 9.5.3

* Removed workarounds for older MP4Box versions. As of this release, only gpac 0.5.0 and higher is supported.
SVN version is highly recommended, though
* Improved AC3 and MP3 audio handling
* Removed turbo option. It is no longer needed
* When using AC3 audio, language TID for MKV was set to 1. It should be 0

microchip8
7th June 2013, 19:15
ChangeLog for version 9.5.4

* Improved the expand filter code
* Optimized the Blu-ray/AVCHD HQ presets for better quality

microchip8
8th June 2013, 00:09
ChangeLog for version 9.5.5

* Enable weightp for the Blu-ray/AVCHD HQ presets. In order to have a broader compatibility with older Blu-ray players
(mostly ones with buggy MediaTek chips), weightp is set to 1 and not 2
* Set VBV maxrate to 40000 and VBV buffer to 30000 for the Blu-ray presets
* Set color primaries, transfer characteristics and matrix coeffs to bt709 for the Blu-ray/AVCHD presets
* Set default position of the expand filter to after the scale filter

microchip8
9th June 2013, 09:30
ChangeLog for version 9.5.6

* Add rc_lookahead to the Blu-ray/AVCHD presets
* When input is file, detect and display info about audio codec, channels, sample rate and bitrate

microchip8
10th June 2013, 18:39
ChangeLog for version 9.5.7

* Add fake_interlaced flag to 25fps/29.970fps content when using the Blu-ray presets. It allows to encode progressive 25p and 30p
content but flags it as interlaced for Blu-ray compliance

microchip8
11th June 2013, 10:22
ChangeLog for version 9.5.8

* Set VBV maxrate to 18k and VBV bufsize to 17k for the AVCHD presets
* Added support for frame packing for 3D video
* Add fake_interlaced to the AVCHD presets

microchip8
11th June 2013, 18:04
ChangeLog for version 9.5.9

* Set correct color prims, transfers and matrix coeffs for Blu-ray/AVCHD SD resolutions
* Removed space between two questions
* Removed the sd* and hd* presets. They are useless
* Updated the man page

microchip8
2nd July 2013, 10:19
ChangeLog for version 9.6.0

* Fix audio TID for MKV when using neroAacEnc as encoder

Achajr
29th July 2013, 16:53
For I encode with 2 audios, what I have to do, because when I am in part:
Specify the Audio Stream ID [default is 0]
s'me the option to track one, not me the option to track 2.

What do I do?

microchip8
29th July 2013, 17:20
you can only encode multiple audio streams when encoding from DVDs. I haven't added support for this when encoding from file

microchip8
20th October 2013, 20:45
ChangeLog for version 9.6.1
* Added support for encoding to 640 kbps AC3 audio

microchip8
22nd October 2013, 15:13
ChangeLog for version 9.6.2
* Added -readtoeof 1 option to the aften AC3 encoder. This ignores WAV header signaling and fixes encoding from a named pipe

microchip8
23rd October 2013, 09:54
ChangeLog for version 9.6.3

* Added support for setting the Dynamic Range Compression (DRC) profile for AC-3 audio
* Renamed aften $AC3 variable to $AC3ENC
* Use AC-3 instead of AC3 naming in metadata info

microchip8
26th October 2013, 22:26
ChangeLog for version 9.6.4

* Restrict the AVCHD presets to AC-3 and COPY audio
* Update the audio selection for the Blu-ray presets. DTS audio was supported but it wasn't displayed in the selection
* Renamed function track_echo_func() to audio_track_echo_func() for consistency

microchip8
27th October 2013, 21:37
ChangeLog for version 9.6.5
* Bugfix: codec detection for 2nd and 3rd audio track from DVDs did not work correctly

microchip8
28th October 2013, 13:22
ChangeLog for version 9.6.6

* Added support for the Opus audio codec. Requires opusenc and a recent version of mkvtoolnix with support for Opus
* Updated the man page

microchip8
28th October 2013, 22:30
ChangeLog for version 9.6.7

* Implemented support for 2nd and 3rd audio track when using "file" as input
* Bugfix: when using Opus audio, calculating target file size was not possible
* Added support for setting the AC-3 Exponent strategy search size
* Allow applying an LFE filter to the AC-3 audio
* Improved aften and opusenc options passing

microchip8
29th October 2013, 01:38
ChangeLog for version 9.6.8

* Added -demuxer lavf for more reliable detection of audio streams in file input mode
* Implemented virtually infinite support for the amount of audio tracks. This introduces a new variable in
the config file, MAX_AMOUNT_AUD_TRACKS, where the user can specify how many audio tracks he/she wants h264enc to support.

microchip8
29th October 2013, 04:43
ChangeLog for version 9.6.9
* Various bugfixes for multi-track audio support

microchip8
29th October 2013, 14:27
ChangeLog for version 9.7.0
* Fix copying of subsequent audio tracks

microchip8
30th October 2013, 09:54
ChangeLog for version 9.7.1

* Enabled multi-channel support for Opus audio
* Moved the MKV audio filters metadata after the audio codec/language metadata
* Fixed copy and pcm audio encoding
* If user chooses PCM for subsequent audio tracks, don't error out but just skip the track
* Some minor clean-ups

microchip8
31st October 2013, 13:06
ChangeLog for version 9.7.2

* Fixed exporting of the NERORMAUD variable to the batch file
* Implemented support for virtually an infinite amount of subtitles. This introduces a new variable,
MAX_AMOUNT_SUBS, to the config file where the user can set the amount of subtitles he/she wants h264enc to support
* Added output name to the message of the mail notification feature
* Fixed the nosound audio option
* renamed the rmtemp() function to exit_func()
* Return proper exit codes. 0 on success, 1 on error and 2 on user interrupt

microchip8
1st November 2013, 07:30
ChangeLog for version 9.7.3

* Merged the file and dvd audio detection/selection code
* Merged the audio code for the first and subsequent tracks
* Set a default audio ID based on input (ie, 0 for file and 128 for DVD)
* Use -demuxer lavf for file and dir input
* Small improvements to the subtitles code
* Renamed the -help switch to -h
* Improved the way audio tracks information is presented to the user
* Make destination dir if it doesn't exist for saving to the batchfile
* Updated the man page

microchip8
2nd November 2013, 19:36
ChangeLog for version 9.7.4

* Fixed copying of E-AC-3 audio
* Set default value for 3D frame packing to 3 (side by side)
* Moved some audio selection code into the new set_audio_codec_func() function.
Reduces some code duplication and removes the default_audio_codec_func() function

microchip8
8th November 2013, 15:02
ChangeLog for version 9.7.5

* Added support for importing a chapters file for MKV/MP4/OGM when input is file
* Added support for setting the audio language code for MKV/MP4/OGM/TS when input is file
* Added support for setting the subtitle language code when importing subs into MKV/MP4/OGM

microchip8
15th November 2013, 13:12
ChangeLog for 9.7.6

* Allow importing of PGS subtitles into the MKV container
* Improved chapters file handling for MKV/MP4/OGM when input is file

microchip8
3rd January 2014, 23:09
ChangeLog for version 9.7.7

* Allow relative paths when storing options to the batchfile
* Updated copyright dates

microchip8
18th January 2014, 19:59
ChangeLog for version 9.7.8

* New variable in the config file, DELETE_AVI_AFTER_REMUX, to automatically delete the AVI file after remuxing. This updates the config file version to 27
* Renamed the 480 and 576 params of the colorprim_func() function to ntsc and pal

microchip8
2nd February 2014, 21:18
ChangeLog for version 9.7.9

* Added support for hardcoding embedded subtitles in files
* Use -nosub for hadrcoding an external subtitle to prevent auto-loading of any embedded subtitles in the input
* Use -ao null instead of -nosound

Selur
4th February 2014, 19:43
Use -ao null instead of -nosound
Shouldn't they do different things?
"-ao null" = should dump the audio output to null, but still do audio processing (scanning for audio streams)
"-nosound" = disable all audio processing
since '-ao null' is an mplayer only option, don't you also use mencoder?

microchip8
4th February 2014, 20:06
Shouldn't they do different things?
"-ao null" = should dump the audio output to null, but still do audio processing (scanning for audio streams)
"-nosound" = disable all audio processing
since '-ao null' is an mplayer only option, don't you also use mencoder?

Current SVN mplayer, when used with -nosound, seems to process the whole input even though I told it to just process 1 frame (-frames 1). I accidentally found this while trying to "unlock" a DVD disc. It was trying to process the whole disc while the intended behavior should be to just process 1 frame. Replacing -nosound with -ao null brought back the intended behavior

-ao null is only used in the mplayer code, not mencoder

Selur
5th February 2014, 04:51
Yeah, latest mplayer is broken in a lot of place, see: https://trac.mplayerhq.hu/ticket/2172#comment:5 (seems like trac.mplayerhq.hu is down atm.)
-ao null is only used in the mplayer code, not mencoder
ah okay, if you find a way in mencoder to avoid -nosound and still disable audio processing, please let me know.

microchip8
13th February 2014, 03:04
ChangeLog for version 9.8.0
* Bugfix: dumping subs did not work when input is a VIDEO_TS DVD folder. Patch by Harry Gunnarsson

Selur
28th February 2014, 21:35
Stumbled over https://sourceforge.net/p/opencore-amr/mailman/message/31945744/ (I'm also interested to include aac-enc into Hybrid on MacOSX and would also require pipe support) and read:
This means that you're trying to write a 32 bit float wav. It only supports 16 bit integer wav files. I'm not sure how to specify this in mplayer syntax though.
If you add "-af format=s16le" to your mplayer call the output should be 16bit.

microchip8
28th February 2014, 21:59
Stumbled over https://sourceforge.net/p/opencore-amr/mailman/message/31945744/ (I'm also interested to include aac-enc into Hybrid on MacOSX and would also require pipe support) and read:

If you add "-af format=s16le" to your mplayer call the output should be 16bit.

Ah, thanks! But I'm waiting until the named pipe support is available in upstream before I add support for fdk-aac, so users don't have to compile a "special" branch from git

Selur
1st March 2014, 09:22
Did it work for you?
I just tested:
1. created fifo:
mkfifo -m 777 /Users/selur/Desktop/temp/HybridTempPipe_08_04_53_9610_02_audio.wav
2. connected main process to pipe:
"/Users/selur/aac-enc" -r 128000 -t 2 "/Users/selur/TempPipe_08_04_53_9610_02_audio.wav" "/Users/selur/Desktop/temp/iId_1_aid_0_DELAY_-43ms_08_04_53_9610_02.aac"
3. feed pipe:
"/Users/selur/ ffmpeg" -y -threads 2 -v -10 -i "/Users/selur/Desktop/temp/iId_1_aid_0_DELAY_-43ms_08_04_53_9610_01.aac" -ac 2 -ar 44100 -f sox - | "/Users/selur/sox" --multi-threaded --ignore-length --temp "/Users/selur/Desktop/temp" --buffer 524288 -S -t sox - -b 16 -t wav "/Users/selur/Desktop/temp/TempPipe_08_04_53_9610_02_audio.wav" rate 48k
problem is that the output is only 682 byte large.
(the sox part is used to make sure the output is 16 bit wav)

My guess is that something like 'ignore length' might be needed. (since the header of the wave sox will output, will have a wrong length)
If I don't use the named pipe but simply use intermediate files everything works, so seems to me that the pipe support isn't working. :(

Cu Selur

Ps.: open an issue in the bug tracker

microchip8
1st March 2014, 10:32
Doesn't work here either, get a 512 bytes output and a message "Could not seek to start, WAV size headers not updated!"

Selur
1st March 2014, 19:03
Got some feedback to the issue in the bug tracker and sox seems to use slightly other wav headers than ffmpeg -> I'll have to wait for sox wave header support ;)
Update:
-> sox problem got fixed by using normal and not named pipes :)
But now I found a new problem, aac-enc doesn't like wav files with more than 2 channels. :(

microchip8
12th March 2014, 17:12
Martin told me to pull the latest from this branch https://github.com/mstorsjo/fdk-aac/commits/read-streamed-wav
So I did and compiled it. It now works when encoding from a named pipe

mkfifo audio.wav
/usr/local/bin/aac-enc -r 96000 -t 2 -a 1 audio.wav output.aac &
mplayer Sample720p60.ts -vo null -vc dummy -af format=s16le -ao pcm:fast:file=audio.wav

This produces a file that can be played by both mplayer and vlc (didn't test others)

So when these changes land in the stable branch, I'll add support for this encoder in h264enc :)

Selur
12th March 2014, 18:54
Yup, now multi-channel input works fine. :)

microchip8
21st March 2014, 00:49
ChangeLog for version 9.8.1

* Set the default crop rounding value to 4 for more accurate cropping
* Initial support for the FDK AAC audio encoder. Requires latest git from https://github.com/mstorsjo/fdk-aac/commits/read-streamed-wav

microchip8
22nd March 2014, 19:39
ChangeLog for version 9.8.2

* Bugfix: for subsequent audio tracks, when using neroAacEnc as encoder, the value of --aac-is-sbr used for HE-AAC by mkvmerge was set to 1:1. It should be 0:1
* Use the AACTYPE variable instead of the aacprof variable to check which type of AAC the user wants in the neroaac_audio_func() function
* In VBR mode for audio encoders that support it, indicate which values result in better quality, ie based on the encoder a lower value results in higher quality or the reverse

microchip8
23rd March 2014, 19:04
ChangeLog for version 9.8.3

* Bugfix: If using nosound and dumping subsequent subs, the audio option for MEncoder was set to -ao null which is not recognized by MEncoder.
Change it to -nosound instead

microchip8
24th March 2014, 17:54
ChangeLog for version 9.4.8

* Add audio encoder info to the MKV global tags
* Renamed the mencoder_opts() function to mencoder_opts_func() for consistency reasons
* Fixed subtitles metadata info in the MKV global tags

microchip8
28th March 2014, 18:48
ChangeLog for version 9.8.5

* Use a single variable for keyint for the Blu-ray/AVCHD presets. Reduces a bit of duplication
* Reduced some duplication in the check_audio_codec_func() function by moving some of the error messages into a new audio_codec_exit_func() function
* Allow muxing to TS when using neroAacEnc and/or FDKAAC in LC-AAC mode
* Merged the NEROAAC/FDKAAC parts in the mkvmerge code as they're identical, thus we reduce a bit of duplication
* Updated the man page

microchip8
28th March 2014, 19:41
ChangeLog for version 9.8.6

* Fix a syntax error

microchip8
29th March 2014, 13:42
ChangeLog for version 9.8.7

* Merged the neroaac/fdkaac part of the MP4Box code as they're identical
* Use a case statement to decide between --bluray and --avchd for tsMuxeR
* A few more function renaming to carry the _func at the end

microchip8
7th April 2014, 20:06
ChangeLog for version 9.9.0

* Initial, basic support for encoding from Blu-ray discs/ISOs/directories. Requires MPlayer to be compiled with libbluray. As libbluray doesn't support encrypted Blu-rays,
it is not possible to encode such Blu-rays. Encryption must first be stripped before encoding with h264enc
* Reduced some duplication in the audio code for the first track for MKV
* Adjusted the vbv_maxrate and vbv_bufsize for the bd40 and bdhq40 presets to comply with the level limits

microchip8
8th April 2014, 08:25
ChangeLog for version 9.9.1

* Fixed not being able to calculate video bitrate for target file size when input is Blu-ray, due to missing $demuxer variable when calling MPlayer
* Fixed DVD scanning in the -scan option
* Support Blu-ray scanning in the -scan option
* Display in the -sc option if MEncoder has Blu-ray support
* Warn and exit if user chooses Blu-ray as input but MEncoder doesn't support it
* Placed the $device and $vid variables after the $MPLAYEROPTS one in order for the custom MPlayer options not to possibly overwrite these variables
* Modified the get_devices_func() function to allow files/folders as input so that a user can scan a DVD ISO or VIDEO_TS directory, not just discs
* Fixed the colorprim code. $device and $vid variables were missing when calling MPlayer to get the resolution height

microchip8
9th April 2014, 16:25
ChangeLog for version 9.9.2

* Allow importing of mks (Matroska stream) subtitles into MKV. Such files are usually created when dumping subs with the GUI version of mkvmerge
* Add -nosub when importing external subtitles into MKV/MP4/OGM to prevent auto-loading of any embedded subs in the input file
* Use case statements to check the values of the $MAX_AMOUNT_AUD_TRACKS and $MAX_AMOUNT_SUBS variables
* Auto-cropping was not possible when input is Blu-ray due to missing bd param in the case statement
* Set default audio channels decode option to 6 when input is Blu-ray

microchip8
10th April 2014, 19:50
ChangeLog for version 9.9.3

* Display the length in seconds and minutes for every found Blu-ray title
* Implemented basic chapters encoding support for Blu-rays
* Rewrote the code for subtitles imports for MKV/MP4/OGM
* For DVDs/BDs, set default channels value to 6 when using other than copy for audio

microchip8
12th April 2014, 00:08
ChangeLog for version 9.9.4

* Cosmetics: add an echo between the total found titles for Blu-ray and the info about each title
* Cosmetics: remove double-quotes in empty echo's
* Display full seconds value for each found Blu-ray title
* Small code optimization to Blu-ray chapters info. Use a single variable that holds the title we need to scan for chapters
* Warn and fallback to 8 channels in case user provides more than 8 channels
* Added support for PCM audio for subsequent audio tracks

microchip8
12th April 2014, 14:56
ChangeLog for version 9.9.5

* Improved resolution detection for Blu-rays
* Improved the nlq preset
* Don't call the audio_channels_decode_func when copying the audio as audio is copied 1:1 thus we don't need to set any channels
* Insert the channels filter in case the user wishes to have 4 or 5 audio channels when decoding higher or lower amount of channels
* Various small code improvements

microchip8
13th April 2014, 12:37
ChangeLog for version 9.9.6

* Rewrote the audio_channels_decode_func() function. It is now possible to output channels different that the decoded
channels amount. Note that this filter is very basic which means it will output silent channels if the decoded channels
are less than the output channels
* Added chanfilter variable to the aac_hev2_func() function
* Support all supported channels in the PCM bitrate code for target file size calculation
* Removed channels variable for MEncoder when copying audio for subsequent tracks as it has no effect
* Display an informative message if the user has set a default audio codec in the config file. Also check if we support it
or print an error message and exit
* Updated the channels metadata info code due to changes in the audio_channels_decode_func() function
* Modifications to the audio_filters_func() and audio_filters_var_func() functions
* Some small code cleanups

lib3rty1
14th April 2014, 22:16
hi,
is there chance to set up hardcoded subtitles size ?

microchip8
14th April 2014, 22:39
hi,
is there chance to set up hardcoded subtitles size ?

What do you mean? You want to scale subs in size? Like make them bigger or smaller? If so, I looked at the manpage of MPlayer and could only find the subfont-text-scale but it did not work as expected. If you do find out, drop me a message and I can add it to the script

lib3rty1
14th April 2014, 22:47
What do you mean? You want to scale subs in size? Like make them bigger or smaller? If so, I looked at the manpage of MPlayer and could only find the subfont-text-scale but it did not work as expected. If you do find out, drop me a message and I can add it to the script

Yes I wish to make them bigger as autoscale makes them too small.

I know that there is only subfont-text-scale,
It didn`t work as you expected ? what do you mean by that ?
have you used true type fonts ?
maybe it was font problem ?

microchip8
14th April 2014, 22:53
Yes I wish to make them bigger as autoscale makes them too small.

I know that there is only subfont-text-scale,
It didn`t work as you expected ? what do you mean by that ?
have you used true type fonts ?
maybe it was font problem ?

Yes, used true type fonts. That said, I'm not very good with subs (barely use them) so if you know how to do it, post the parameters and I'll add it to the script

microchip8
15th April 2014, 12:00
ChangeLog for version 9.9.7

* Allow the channels filter for the portable device presets
* Reorder the audio filters positions
* Placed the $MENCOPTS variable in front in MEncoder in order for it to not overwrite the options already set
* For AC-3 audio, default to 384 kbps instead of 192 kbps and default to "Film Standard" as DRC profile
* For MP3 audio, default to 192 kbps instead of 128 kbps when doing CBR encodes and to "standard" when using a preset
* For NEROAAC and FDKAAC, default to 128 kbps instead of 96 kbps when using LC-AAC mode
* Better wording in what the Output option does in the audio_channels_decode_func() function
* Modification to the audio_codec_exit_func() function. Use this function also to exit in case of an unsupported audio codec.
By using this function, some repeatability is removed
* Fixed a bug in the PCM audio code for the calculation of video bitrate for a target file size. Variable $AUDIO_BITRATE should
be an array variable instead of a normal one
* Added support for Blu-ray angle encoding
* Reduced some duplication by placing the message into a single variable when we exit in case an audio encoder is missing
* MEncoder currently has issues with copying audio. Work it around by using -mc 0 -msglevel demuxer=-1 options which disable
its automatic A/V sync. With this, MEncoder may report 0 or some large random number on some files for the audio but one can
safely ignore it. Audio is still being copied
* If the user chooses audio copy and selects to remux the encode to MKV, the global tags did not contain the audio encoder string.
Fix this by adding "Unknown (Stream Copy)" since we don't know which program was used to encode the audio
* In case we try to copy AAC audio from the input, we need to pass the correct format to MEncoder or it will error out. Thus, use
-fafmttag 0x706d if we detect AAC
* Fixed a bug where copying AAC audio as as subsequent track did not result in that track being added when remuxing to MP4 due
to a missing ffaac param in the case statement
* When doing video bitrate calculations for a target file size and copying the audio, try to better detect the audio bitrate. If we
can't detect it or it's reported as 0 kbps, default to 0 kbps
* Small improvements and cleanups here and there

microchip8
16th April 2014, 09:47
ChangeLog for version 9.9.8

* Use proper extensions when copying the audio as MP4Box has a problem with recognizing the .raw extension
* Renamed the named pipe from audio.wav to audio.pipe. Also placed it in a variable to reduce some minor duplication
* Added support for subtitle scaling for when hardcoding an external sub or hardcoding an embedded one. Requested by
lib3rty1 from the the Doom9.org forum
* Added --no-chapters option to mkvmerge for when encoding with neroAacEnc in order not to auto-copy chapters
info from the container
* Instead of defaulting to 0 kbps if we can't detect the audio bitrate when copying audio and needing to calculate the
video bitrate for a target file size , ask the user to provide it in case he knows it or can figure it out
* Set the default exponent strategy value for AC-3 to 16
* Placed frequently used MPlayer options into a single variable, $MPOPTS, in order not to write them over and over
again when we need them. These options are not used everywhere as sometimes we need other specific ones when detecting something
* Improved priority level checks for regular users if the PRIORITY variable is set in the config file
* Bugfix: audio resampling was not possible for Blu-rays due to missing bd param in the case statement
* Merge the Blu-ray output code with that of the file/vcd as it's identical
* Some minor code optimizations

microchip8
17th April 2014, 19:04
ChangeLog for version 10.0.0

* Allow the video_subtitles_align_func() function for mks matroska subtitles
* Display the warning message in red for when something goes wrong when importing/hardcoding subs.
Do the same for when checking support for a sub format for MKV/MP4/OGM
* Added support for subtitles for Blu-ray encodings. Note that only hardcoding of external sub or importing
of external subs into the MKV/MP4/OGM containers is supported
* Removed some duplication by placing the code for hardcoding an external sub or importing external subs
into its own video_subtitles_option_func() function
* Increased the rc_lookahead value for the ehq, uhq and ihq presets to 80, 90 and 100, respectively
* When copying audio and using some of the portable device presets, also add the -mc 0 -msglevel demuxer=-1
options to MEncoder
* More code optimizations and minor fixes

microchip8
22nd April 2014, 07:41
ChangeLog for version 10.0.1

* Bugfix: wrong var used, $chanuse instead of $chandec, for setting the decode channels
* Only call the video_subtitles_scale_func() function if the user actually provides an external sub for hardcoding

microchip8
23rd April 2014, 08:08
ChangeLog for version 10.0.2

* Bugfix: in case user chooses audio copy, the metadata info for tagging always defaulted to "Stereo".
Fix this by running MPlayer to detect the proper amount of channels

microchip8
26th April 2014, 08:49
ChangeLog for version 10.0.3

* Removed unused $AUDFIFO variable
* Small bugfix: audio language for metadata tagging wasn't added to the global tags for MKV when input is Blu-ray due to missing 'bd' param in the case statement

microchip8
22nd May 2014, 18:02
ChangeLog for version 10.0.4

* Bugfix: $demuxer var was missing in the AUDCH array var which resulted in incorrect channel info being added to the tags when copying audio.
DVD input was not affected by this bug, but file/dir/bd input was as they all use the $demuxer var

microchip8
24th May 2014, 13:20
ChangeLog for version 10.0.5

* Fixed the detect_fps_func() function for detecting the NTSC type
* Lowered the spugauss (variance param for gauss subtitle scaling) from 0.7 to 0.4 as 0.7 does too much blurring in my opinion

microchip8
12th June 2014, 07:13
ChangeLog for version 10.0.6

* Added support for dumping chapters info from MKV/MP4 input files. This updates the config file version to 30 as mkvextract is needed
* Made the audiofmt variable an array variable
* Moved asking for sample encoding before asking to inspect or save the options to a file

microchip8
15th June 2014, 13:25
ChangeLog for version 10.0.7

* Use an if instead of a case when dumping chapters from files
* Also export chapter extraction commands to the batch file
* Display mkvextract availability when using the sanity check option (-sc)
* Add the path and name to the comment block of the batch file. Makes it easy to focus on the comment block to know for which file the commands are instead of needing to inspect the code itself to find out

microchip8
16th June 2014, 20:15
ChangeLog for version 10.0.8

* New method to detect and display audio info when input is file or blu-ray. In comparison to the previous basic method, the new one will display for each found audio track the codec, channels, language, bitrate and sample rate info. It does take slightly longer to detect in case there are many audio tracks, but it is more descriptive and accurate

microchip8
17th June 2014, 13:44
ChangeLog for version 10.0.9

* Bugfix: only call audio filters on subsequent tracks when running MPlayer to decode since for the first track we already pass these filters to MEncoder, thus if we also use them when running MPlayer we'll get a double effect
* Add a ^ (caret) at the beginning of grep when trying to get the [lavf] text to make sure we only grep the correct instances
* Set default CRF/QP value to 19 and for bitrate based encodes to 2000 kbps
* For the volume audio filter, set the default value to 3 as 5 is a bit high

microchip8
18th June 2014, 08:53
ChangeLog for version 10.1.0

* When scanning for audio tracks when input is file or blu-ray, rename DCA (as reported by lavf) to DTS to not confuse the user. Also rename AC3 to AC-3 for consistency
* In case audio encoder is fdkaac, add to the MKV tags the audio format used (eg, Signed 16-bit little endian)
* When dumping chapters from files, use the file extension .chaps for MKV. Also test to see if there's already a chapters file with the same name and rename it to .chaps.old
* aac-enc name in the MKV tags is not very descriptive, so add (fdkaac) to it
* Cosmetics

microchip8
19th June 2014, 11:18
ChangeLog for version 10.1.1

* Added support for the internal lavc AC-3 audio encoder. Now one can choose between the lavc encoder (default) and the aften encoder. The lavc encoder is set to default as aften has seen very little development in the past years and is not as good as the lavc one which is actively developed by the ffmpeg devs
* Fine-tune the volume filter by setting it to 4 after some tests
* Delete the file stored in the $AUDINFO variable
* When storing the MKV global tags while operating in batch mode, test the variable $DIRTAGS for not being empty
* Cosmetics: add a few echo's at specific places to separate the cmd lines in the batch file for better readability. Also add a comment block for the start of the MKV, MP4, TS and/or OGM muxing
* Bugfix in the MKV/MP4 tags: do not add channel info when using MP3. If we add channel info, it could result in "MP3 5.1" being added to the audio tags, which is obviously wrong as MP3 only supports stereo and mono channels
* Opus supports sampling rates from 8 kHz to 48 kHz. Support this in the resampling code

microchip8
20th June 2014, 08:42
ChangeLog for version 10.1.2

* Fix a possible problem when detecting audio tracks when input is file or blu-ray. We only grep for the generic word 'audio' which could result in also printing lines that are not audio tracks but somehow carry the 'audio' word in their tags. Fix it by using 'awk' before 'grep' to only print the fourth column where lavf reports what type of track it is
* Set default DTS bitrate to 755 kbps. Also check if we don't exceed the highest legal bitrate of 1509 kbps
* Due to a bug in the dcaenc encoder, floating-point WAV files get wrongly interpreted as 32-bit integer ones. Work around this by adding the format=s16le filter
* The 1536 kbps bitrate reported by MPlayer on some DTS files is technically 1509 kbps, if we have to be accurate. Account for this by substracting 27 kbps from the reported bitrate. Do the same for the reported 768 kbps bitrate which is actually 755 kbps
* Report the kHz in addition to the Hz when displaying audio info for found tracks
* When remuxing to MKV/MP4/OGM, instead of checking if a file is created to make a decision if it was successful or not, use return codes from the remuxing applications. Should be more reliable in telling the user if it really succeeded or not. Unfortunately tsMuxeR doesn't return anything so there's no other way than checking if there's an output file.
* Lowered the scale factor in the calcbits() function from 3 to 2. Also use | instead of @ as delimiter
* Tune a bit the subq values of the ani & anihq presets. Also turn on trellis on all decisions (trellis=2) for the anihq preset

microchip8
23rd June 2014, 21:05
ChangeLog for version 10.1.3

* Set the DRC profile for Aften to none
* Allow the volume filter to be used even if the volnorm one is used
* Added support for setting the DRC when using lavc for AC-3
* Added support for encoding to E-AC-3 audio through lavc

microchip8
24th June 2014, 18:49
ChangeLog for version 10.1.4

* Removed -mc 0 when encoding to E-AC-3 audio. It is not needed after some tests and A/V sync will be better in some cases
* Use a case statement instead of an if conditional when checking if audio encoder is fkdaac or dcaenc in order to insert the format filter
* Encode to AAC through MEncoder instead of using faac directly
* Renamed the aac_audio_func() function to faac_audio_func(). Also renamed the $MENCIN var to $MENCINPUT

microchip8
25th June 2014, 14:51
ChangeLog for version 10.1.5

* Updated the info on audio codecs supported by containers
* Updated the set_audio_codec_func() function
* Set the default IVTC filter to filmdint
* Accept floating point values for CRF/QP ratecontrol in the config file

microchip8
29th June 2014, 11:09
ChangeLog for version 10.1.6

* Add -mc 0, after some testing, for when encoding to E-AC-3 audio
* A lot of the supported audio codecs do not support more than 6 channels so limit the channels to a maximum of 6
* If aften is missing and user has selected it as encoder to use, fall back to the lavc encoder instead of exiting

microchip8
30th June 2014, 08:22
ChangeLog for version 10.1.7

* Renamed the variable priority_level to nicelevel
* Be more clear about the language code the user may use by mentioning that it's used for tagging
* Be more clear on the channels filter by stating it is very basic and it will create empty channels in case the output channels are higher than the input ones
* Add a 0 to the counter_func() function
* mkvmerge version 7.0.0 and higher automatically adds statistics tags to the created file. Offer an option in the config file to disable this. Updates the config file version to 31
* Add a note to the skeleton presets.cfg file that one must start the params with a : (colon)

microchip8
1st July 2014, 00:13
ChangeLog for version 10.1.8

* Fix syntax error in the ratio_and_pixels_func() function

microchip8
2nd July 2014, 00:04
ChangeLog for version 10.1.9

* Add -noskip to where -mc 0 is used
* Document the exit values used by the exit_func() function
* Made the sed syntax consistent
* Currently, we calculate the ratio and pixels in two places. One for when we don't scale and one for when we scale. Merge the code into the ratio_and_pixels_func() function to reduce some duplication
* When printing info on files/bd, increase the -channels to 8
* Tune the higher quality presets and the anime ones by tweaking the adaptive quants, psy and inloop deblocker for better quality
* Bugfix: in case we skip the audio channels filter when the provided channels is higher than 6, the array var audchannels was not reset

microchip8
4th July 2014, 20:05
ChangeLog for version 10.2.0

* We currently try to auto-detect resolutions and fps in order to set the fake interlaced option and color prims/transfers/matrices when using the Blu-ray/AVCHD presets. The problem is that this auto-detection cannot be made very reliable and there's a high chance it will misdetect something. Make it simple instead and ask the user if to set the prims and/or fake interlaced options
* Tune the Blu-ray/AVCHD high-quality presets for better quality
* Both the aften and lavc encoders for AC-3 audio share the same bitrate code. Move it out of the encoder functions to a new ac3_bitrate_func() function to reduce some duplication
* Removed some commented out code
* In addition to reporting file sizes in MiB after encoding finishes, also report them in GiB

microchip8
15th August 2014, 00:11
ChangeLog for version 10.2.1

* Support copying Dolby TrueHD audio into the MKV container
* When detecting audio, change the TRUEHD reported by MPlayer to Dolby TrueHD

microchip8
17th August 2014, 11:23
ChangeLog for version 10.2.2

* Merge the eac3 and truehd part in the case statement as they're identical
* Rename MP3FLOAT as reported by MPlayer to MP3 and EAC3 to E-AC-3
* Since we now set -nosound when copying a TrueHD track, it is no longer necessary to modify the text files for encoding, so remove the sed part

microchip8
14th September 2014, 07:33
ChangeLog for version 10.2.3

* Add back checking for aften in the sanity check (-sc) option
* Support disabling of MKV global tags. Bumps up the config file version to 32
* Use -frames 0 to workaround possible problems when detecting audio bitrates

microchip8
15th September 2014, 08:40
ChangeLog for version 10.2.4

* Fix Blu-ray input: -demuxer lavf is used by default for BD input as it provides extra info for audio detection. The problem is that -demuxer lavf forces MPlayer to read the whole(!) BD even when -frames 0 or 1 is used as option. This fix works around the problem by using the -cache option which seems to make -demuxer lavf behave as it should. Thanks to Andy Furnis on the MPlayer mailing list for providing the workaround

microchip8
16th September 2014, 08:49
ChangeLog for version 10.2.5

* Set the -cache option needed for BD input in a single variable inside the code for BD input. Reduces detection time of resolution/audio codecs if input is not BD since the -cache option won't be used for such inputs
* Make some words uppercase in the crop function to ease the focus on them
* Reduced some duplication by placing the chapters examples text into its own chapters_example_func() function

microchip8
17th September 2014, 09:20
ChangeLog for version 10.2.6

* Fix crop detection for Blu-ray input

microchip8
25th September 2014, 20:33
ChangeLog for version 10.2.7

* Fix incorrect Aspect Ratio (AR) and Pixel Aspect Ratio (PAR) calculations for cropped resolutions
* Do not run the get_resolution_func() function if we do cropping as it's needless
* Calculate and display the AR and PAR when we do scaling

microchip8
26th September 2014, 17:44
ChangeLog for version 10.2.8

* Get rid of the get_resolution_func() and audio_stream_copy_func() functions
* Detecting Blu-ray resolution can be sometimes problematic when using -vo null -ao null. Switch to using -nosound instead of -ao null
* Check the value set, if any, in the DEFAULT_VID_CRFQP variable in the config file and restrict the maximum to 51
* Add the $cache var for Blu-rays to the audio_resample_func() function and to the audio detection code for stream copy
* For audio copy, move the audio detection into its own audio_copy_func() function. It makes it possible to correctly copy TrueHD audio regardless of the preset used, except for restricted presets that do not support audio copy. DTS HD MA is not supported yet as there's no way detecting it due to no decode support in libavcodec
* Remove the -nocache option from the MPOPTS var
* Cosmetics

microchip8
27th September 2014, 13:09
ChangeLog for version 10.2.9

* Colorize the output of detected subtitles and DVD/VCD titles
* Merge the two case statements of the ratio_and_pixels_func() function
* All audio encoders we currently use support a max of 6 audio channels. Check the detected audio channels amount and warn per track if we detect more than 6
* Minor default filters values tuning

microchip8
29th September 2014, 08:13
ChangeLog for version 10.3.0

* Get rid of the $RATIO var in the ratio_and_pixels_func() function
* Support disabling of all video filters at once through the config file
* Support disabling of cropping and subtitles
* Support disabling of all audio filters at once
* Support disabling of asking for DVD/BD angles and chapters encode

microchip8
30th September 2014, 08:18
ChangeLog for version 10.3.1

* Fix a syntax error in the ratio_and_pixels_func() due to missing var

microchip8
2nd October 2014, 19:46
ChangeLog for version 10.3.2

* Add the $cache var to a few more places in the audio code
* Reorder the audio codec conditionals in the case statements for better readability
* When using external audio encoders, we currently only check if the encoder has produced a file. Make it a bit more reliable and check if the audio file is at least 20 KiB in size as most encoders that output a file but error out, produce files less than 20 KiB. A more reliable method would be to check the return code of the background encoder process itself with $! to get its PID and using wait $PID; RET=$? to capture the signal, but this will result in a hacky way of doing it. I do not rule it out for the future

microchip8
20th January 2015, 17:34
ChangeLog for version 10.3.3

* Improved original resolution detection. Patch by Markus Grunwald
* Update copyright dates

microchip8
23rd January 2015, 12:37
ChangeLog for version 10.3.4

* Added support for setting a default software scaler in the config file
* Ask for color primaries/transfers/matrics when using any preset, not just the Blu-ray ones

microchip8
11th March 2015, 15:25
ChangeLog for version 10.3.5

* Support mono and tile format frame packing. Requires latest x264
* Improved crop detection for files

microchip8
16th March 2015, 10:30
ChangeLog for version 10.3.6

* Revert the previous change to crop detect for files as it misdetects too often

microchip8
4th April 2015, 13:02
ChangeLog for version 10.3.7

* Added support for EDL list files. Updates the config version to 35. By default, EDL is disabled as I don't think many people know what it is or how to make such files, so you have to enable it in the config file. Requested by Shibby7

microchip8
30th April 2015, 22:22
ChangeLog for version 10.3.8

* Fixed an issue in the EDL code where tab completion wasn't working due to missing -e option to read

microchip8
3rd May 2015, 10:32
ChangeLog for version 10.3.9

* Add a check for x264 in the sanity test
* Fix a typo in the x264params var for multi-pass encoding

microchip8
3rd May 2015, 16:39
ChangeLog for version 10.4.0

* Accept relative paths for the output file
* Do a second crop detection run in case the first try fails

microchip8
23rd June 2015, 22:08
ChangeLog for version 10.4.1

* Modified the mail func for dir batch encodes to report the input directory instead of the last encoded file from it
* Get rid of some commented out code which is no longer used
* The -a52drc option only has an effect if input audio is AC-3. Since we currently don't store the audio codec detected into a usable var, disable this option for the time being.
* Increased the detault audio bitrate for AAC from 128 to 192kbps

microchip8
6th September 2015, 03:37
ChangeLog for version 10.4.2

* Increased the default audio bitrate/quality value for Vorbis audio
* Added mov file extention to the supported formats for chapter dumps
* New ASCII art banner
* Updated the man page

microchip8
8th September 2015, 17:43
ChangeLog for version 10.4.3

* Removed the $ from the index of array variables
* Be more portable and use eval instead of seq in loops as seq is too Linux-specific

microchip8
10th September 2015, 14:23
ChangeLog for version 10.4.4

* Portability improvements. It should now work on other UNIXes

microchip8
14th September 2015, 17:52
ChangeLog for 10.4.5

* Fixed a small issue in the detection of aspect ratio when forcing it

microchip8
21st September 2015, 13:19
ChangeLog for 10.4.6

* Clean up the config file a bit
* Added support for setting the MAX_AMOUNT_SUBS and MAX_AMOUNT_AUD_TRACKS to "auto". When set to "auto" it will ask for as many audio tracks/subs as detected
* New variable in the config file, MAX_AMOUNT_EXT_SUBS, for setting the amount of times we get asked for importing external subs into mkv/mp4/ogm

microchip8
19th January 2016, 20:23
ChangeLog for version 10.4.7

* Added support for the video rotate filter. Requested by Thomas Troeger
* Updated copyright dates