Log in

View Full Version : h264enc for Linux


Pages : 1 2 3 [4] 5 6 7 8 9 10 11 12 13 14 15

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!