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
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