Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > General > Linux, Mac OS X, & Co

Reply
 
Thread Tools Search this Thread Display Modes
Old 6th March 2009, 23:01   #261  |  Link
microchip8
ffx264/ffhevc author
 
microchip8's Avatar
 
Join Date: May 2007
Location: /dev/video0
Posts: 1,843
Quote:
Originally Posted by ranger0293 View Post
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
__________________
ffx264 || ffhevc || ffxvid || microenc
microchip8 is offline   Reply With Quote
Old 9th March 2009, 00:31   #262  |  Link
ranger0293
Registered User
 
Join Date: Jan 2009
Posts: 2
Quote:
Originally Posted by froggy1 View Post
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.
ranger0293 is offline   Reply With Quote
Old 29th March 2009, 13:31   #263  |  Link
cooool
Registered User
 
Join Date: Jan 2009
Posts: 6
Resizing 16:9 video and mp4 output problem

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.
cooool is offline   Reply With Quote
Old 31st March 2009, 11:06   #264  |  Link
microchip8
ffx264/ffhevc author
 
microchip8's Avatar
 
Join Date: May 2007
Location: /dev/video0
Posts: 1,843
Quote:
Originally Posted by cooool View Post
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

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

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

Code:
mencoder file.avi -oac copy -ovc copy -of rawvideo -o output.h264
mencoder file.avi -oac copy -ovc copy -of rawaudio -o output.aac
Quote:
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
__________________
ffx264 || ffhevc || ffxvid || microenc
microchip8 is offline   Reply With Quote
Old 31st March 2009, 12:53   #265  |  Link
nm
Registered User
 
Join Date: Mar 2005
Location: Finland
Posts: 2,641
Quote:
Originally Posted by cooool View Post
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):
Code:
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:
Code:
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.

Last edited by nm; 31st March 2009 at 12:56.
nm is offline   Reply With Quote
Old 3rd April 2009, 05:57   #266  |  Link
cooool
Registered User
 
Join Date: Jan 2009
Posts: 6
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?
cooool is offline   Reply With Quote
Old 3rd April 2009, 09:30   #267  |  Link
nm
Registered User
 
Join Date: Mar 2005
Location: Finland
Posts: 2,641
Quote:
Originally Posted by cooool View Post
@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:
Code:
crop=w:h:x:y,dsize=640:480,scale=640:480
nm is offline   Reply With Quote
Old 5th April 2009, 16:20   #268  |  Link
cheerow
Registered User
 
Join Date: Jan 2004
Posts: 17
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...

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

regards
cheerow is offline   Reply With Quote
Old 6th April 2009, 15:39   #269  |  Link
microchip8
ffx264/ffhevc author
 
microchip8's Avatar
 
Join Date: May 2007
Location: /dev/video0
Posts: 1,843
Quote:
Originally Posted by cheerow View Post
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...

Code:
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
__________________
ffx264 || ffhevc || ffxvid || microenc
microchip8 is offline   Reply With Quote
Old 6th April 2009, 15:54   #270  |  Link
nm
Registered User
 
Join Date: Mar 2005
Location: Finland
Posts: 2,641
Quote:
Originally Posted by froggy1 View Post
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?

Quote:
Originally Posted by cheerow
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, ...?
nm is offline   Reply With Quote
Old 6th April 2009, 16:05   #271  |  Link
microchip8
ffx264/ffhevc author
 
microchip8's Avatar
 
Join Date: May 2007
Location: /dev/video0
Posts: 1,843
Quote:
Originally Posted by nm View Post
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
__________________
ffx264 || ffhevc || ffxvid || microenc
microchip8 is offline   Reply With Quote
Old 6th April 2009, 18:55   #272  |  Link
cheerow
Registered User
 
Join Date: Jan 2004
Posts: 17
What about allowing quantizer based audio encoding for encodes without target size e.g. crf/qp modes?
cheerow is offline   Reply With Quote
Old 6th April 2009, 21:29   #273  |  Link
microchip8
ffx264/ffhevc author
 
microchip8's Avatar
 
Join Date: May 2007
Location: /dev/video0
Posts: 1,843
Quote:
Originally Posted by cheerow View Post
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
__________________
ffx264 || ffhevc || ffxvid || microenc
microchip8 is offline   Reply With Quote
Old 7th April 2009, 09:08   #274  |  Link
cheerow
Registered User
 
Join Date: Jan 2004
Posts: 17
Quote:
Originally Posted by froggy1 View Post
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!
cheerow is offline   Reply With Quote
Old 12th April 2009, 17:02   #275  |  Link
microchip8
ffx264/ffhevc author
 
microchip8's Avatar
 
Join Date: May 2007
Location: /dev/video0
Posts: 1,843
ChangeLog for version 8.7.3
Code:
* 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
__________________
ffx264 || ffhevc || ffxvid || microenc
microchip8 is offline   Reply With Quote
Old 13th April 2009, 20:33   #276  |  Link
crazee_canuck
Registered User
 
Join Date: Dec 2002
Location: Finland
Posts: 6
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:

Code:
$ 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:
Quote:
[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
crazee_canuck is offline   Reply With Quote
Old 14th April 2009, 00:55   #277  |  Link
microchip8
ffx264/ffhevc author
 
microchip8's Avatar
 
Join Date: May 2007
Location: /dev/video0
Posts: 1,843
Quote:
Originally Posted by crazee_canuck View Post
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
__________________
ffx264 || ffhevc || ffxvid || microenc
microchip8 is offline   Reply With Quote
Old 14th April 2009, 11:00   #278  |  Link
microchip8
ffx264/ffhevc author
 
microchip8's Avatar
 
Join Date: May 2007
Location: /dev/video0
Posts: 1,843
ChangeLog for version 8.7.4
Code:
* 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
__________________
ffx264 || ffhevc || ffxvid || microenc
microchip8 is offline   Reply With Quote
Old 22nd April 2009, 09:19   #279  |  Link
microchip8
ffx264/ffhevc author
 
microchip8's Avatar
 
Join Date: May 2007
Location: /dev/video0
Posts: 1,843
ChangeLog for version 8.7.5 - small improvement/fix
Code:
* Dump first subtitle during the first pass of a multipass encode to avoid possible delay problems
__________________
ffx264 || ffhevc || ffxvid || microenc
microchip8 is offline   Reply With Quote
Old 26th April 2009, 09:47   #280  |  Link
microchip8
ffx264/ffhevc author
 
microchip8's Avatar
 
Join Date: May 2007
Location: /dev/video0
Posts: 1,843
ChangeLog for version 8.7.6
Code:
* 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
__________________
ffx264 || ffhevc || ffxvid || microenc
microchip8 is offline   Reply With Quote
Reply

Tags
h264enc, ipod, mencoder, ps3, xbox360

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:15.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.