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 > Announcements and Chat > General Discussion
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 28th February 2017, 17:25   #1  |  Link
maniac78
Registered User
 
Join Date: Apr 2013
Posts: 9
Help with encoding NTSC DV to H.264

I'm having a hard time getting the aspect ratio correct and could use some help. I know a lot has been posted on this and I've read everything I can but maybe I'm not just understanding something so would appreciate some help and guidance and please no "go look it up" answers as I have done that. Thank you in advance!

I'm helping a non-profit encode all their old NTSC DV AVIs into H.264 for ease of use and possible web posting, etc. It's been a long time since I've done this so I've been reviewing the proper ways to do it, mainly when it comes to the correct aspect ratios, etc.

From what I've gathered, (especially from this post) is that I should crop to 704, apply "--sar 10:11" and then encode. So I tried that but playing the resulting file on PC makes everything looked squished vertically with long faces, etc. It's not horrible but noticeable but then if I play it on my TV it looks more natural, how it should look. However I noticed that the original DV AVI is the same -- played on TV it's fine but on PC it's squished. I can also tell my software video player to use a "TV-Out 4:3 AR" and both versions look fine on PC but I can't expect end users to know to do that.

And, what confuses me further is that several different programs give me different info on the original DV AVI. For example:
Mediainfo: DAR 4:3
StaxRip: DAR 1.367 (roughly 15/11, right?) and PAR 10/11
ffmpeg: SAR 8:9 and DAR 4:3
Hybrid: PAR 8/9
Premier Pro: PAR 0.9091 (10/11, right?)

So I guess my question is, is there a way to encode so the image looks the same on PC as it does on the TV or is that not the correct way to do it? If this is "just the way it is" then that's fine, I just need to be able to tell this organisation that as right now they don't like the way it looks on PC and want me to get the encoded file to look more like it does on TV.

I've also included a small sample of the way the video looks on TV vs PC. Unfortunately they don't want me posting a full sample or clips but hopefully this is enough so you can understand what I'm talking about.

Thank you very much for any help and guidance you can provide.

Oh, I'm also using Hybrid for the encoding so any specific settings to help me get all this encoded correctly would be much appreciated. Thank you!!
Attached Images
  

Last edited by maniac78; 28th February 2017 at 18:59.
maniac78 is offline   Reply With Quote
Old 1st March 2017, 00:57   #2  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,079
Hi maniac78,

I live in PAL land, but I have a few old NTSC DV AVIs from a friend in the US. They are 720 x 480, interlaced BFF.

MediaInfo detects them as 3:2, StaxRip as DAR 1.386 and PAR 10:11.

Converting them with StaxRip to H.264 was no problem. I did not crop the source files and did not resize them. StaxRip added the parameter "--sar 10:11" to the command line, and the resulting MKV played with the correct AR in MPC-HC, VLC and Tiny Player (a stripped down DirectShow player).


Please note that such source files are usually interlaced with BFF field order. When you convert them to H.264 you can either use a software deinterlacer before the encoder, or you have to encode in interlaced mode (use "--tff" or "--bff" in the X264 command line).

Maybe you can upload a section of one of your source AVIs to a file hoster like SendSpace, ZippyShare or WeTransfer...


Cheers
manolito
manolito is offline   Reply With Quote
Old 1st March 2017, 01:02   #3  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,695
NTSC DV AVI is 720x480 with a PAR of 0.909. To encode to square pixels you use 654x480.

The 704 vs. 720 has always confused me. The 16 extra pixels are for "digital blanking," whatever that is. However, I've never seen any video -- either from NTSC analog or from a DV camcorder -- that had any black on the sides. Therefore, I've done almost all of my work using 720, and when doing as you want to do, I use 654x480.

There are smarter people than me in this forum, and they may have a more correct answer. However, what I've been doing all these years does seem to produce an end result that doesn't looked squished or stretched.
johnmeyer is offline   Reply With Quote
Old 1st March 2017, 05:02   #4  |  Link
maniac78
Registered User
 
Join Date: Apr 2013
Posts: 9
Thank you manolito and johnmeyer for the input, I appreciate it.

Unfortunately the people I'm doing this project for do not want me to post any part of the video so that makes getting help a little challenging. I posted two images of a screen cap from a small part of the video which helps illustrate my point and I think that's all I can do unfortunately but thank you for the suggestion.

I like and usually use Hybrid and StaxRip, they are both awesome programs. For this project I want to use Hybrid as I think the deinterlacer is better and I'm not sure how to configure StaxRip to use the same one, but that's not super important right now, I just need to get the ratio thing figured out.

I've always cropped to 704 for a few reasons:
a) that's what I gathered was "correct"
b) the source I have has some "junk" on the sides that needed to be cropped off anyway so it seemed perfect.
But maybe it's not actually the way to do it?

@manolito: I've tried in StaxRip several times and I also noticed it added the "--sar 10:11" parameter but it still doesn't look good. But maybe that's because I need to encode at the full 720? I'll try doing that tomorrow and see. Oh, and I'm also using PotPlayer as my main player and it allows switching the AR around between different types of devices, and settings, etc. or just using the encoded default. I've also tried with MPC-HC as well and it generally displays the same as PotPlayer.

@johnmeyer: Thanks for your tips. Are you suggesting I:
1: don't crop at all
2: resize to 654x480
3: don't specify a specific SAR when encoding
I'll give this a try as well tomorrow and see what happens. Thanks for the help.
maniac78 is offline   Reply With Quote
Old 1st March 2017, 05:57   #5  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,079
If you encode to H.264 (preferably into an MKV container) you can either not resize at all and specify the DAR in the container. Any compliant player should respect this aspect ratio. In StaxRip this would lead to the "--sar 10:11" parameter.

The other option is to resize the source to square pixels. In StaxRip you just need to tick the "Resize" option and use the resize slider to get the desired frame size. In this case there will be no "--sar" parameter for X264. Be careful if you do this for interlaced sources. You cannot resize an interlaced source vertically without deinterlacing it first.


Cheers
manolito
manolito is offline   Reply With Quote
Old 1st March 2017, 09:22   #6  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,997
maniac78:
A sample would really help to give you better advice; but my blind proposal would be:
1. Your DV NTSC source is most probably 720x480i interlaced, PAR 38800:42651 = 0.90971 (ITU), which is very closely approximated by PAR 10:11=0.90909.....(MPEG4), intended for playback at DAR 4:3
2. If you have some annoying crud left and right, top and bottom, crop it off and add black borders such as to preserve the original 720x480 overall size
3. Encode with x264 --sar 10:11, --bff (or --tff)

(Don't resize unless you have a specific reason)

Last edited by Sharc; 1st March 2017 at 14:43.
Sharc is offline   Reply With Quote
Old 1st March 2017, 15:42   #7  |  Link
maniac78
Registered User
 
Join Date: Apr 2013
Posts: 9
Thanks for the advice everyone. I will try out the different settings mentioned and see how it goes.

Sharc and manolito: You are right, a sample would be best. This is kind of out of my control as the copyright holder asked me not to share anything but I'll try to explain the situation to them again and see if I can get them to let me post something even if just a tiny clip.

Thank you!
maniac78 is offline   Reply With Quote
Old 1st March 2017, 16:34   #8  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,695
If you can see video on the two side edges, why would you crop it?? It will then be gone forever.

So no, I would not crop it.
johnmeyer is offline   Reply With Quote
Old 1st March 2017, 16:51   #9  |  Link
maniac78
Registered User
 
Join Date: Apr 2013
Posts: 9
Well, there is a large 16 pixel black bar on the left side. Not sure why but it's very old footage so maybe it just wasn't done properly or something. So it would be nice to crop it but don't have to if it will cause problems with displaying properly.
maniac78 is offline   Reply With Quote
Old 1st March 2017, 16:57   #10  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,997
johnmeyer:
Yes, that's why I suggested that he should only crop the garbage (if there is any) and replace it by clean black borders.
Cropping and re-adding borders neither changes the PAR nor the DAR, so not knowing more about the source I thought this is the safest way to re-encode the clip.
Sharc is offline   Reply With Quote
Old 1st March 2017, 17:54   #11  |  Link
maniac78
Registered User
 
Join Date: Apr 2013
Posts: 9
Got the OK to post a small clip. I hope they aren't too small... I left out the audio to help keep the file sizes down. The link is at the bottom of this post.

Also, I've attached two pictures. The company I'm doing this for thinks that the one named "TV.PNG" looks best (this is using "TV OUT 4:3" AR in PotPlayer) and the file named "PC.PNG" is how the video plays on a PC in almost every player. These are from the original DV AVI.

I'm not sure what to think, but if you guys say "this is the way it should be encoded and this is the way it should look" then that's great and I'll tell the company that this is just the way it is.

Thanks again for all the help!!

https://www.sendspace.com/filegroup/...KnW%2FB14ydzAg
Attached Images
  
maniac78 is offline   Reply With Quote
Old 1st March 2017, 18:59   #12  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,997
I encoded your BAF.avi with --sar 10:11 --tff. No cropping, no resizing. Muxing with tsMuxer to .ts file.
The ball can serve as reference for a circular shape.
- The result is perfect with MPC-HC
- The result is perfect when I stream the file to the TV
Of course the left black border is part of the 4:3 picture.
I don't see a problem......

Edit:
Of course your player has to respect the --sar signalling of the stream. If it ignores it, the picture will be distorted.

Last edited by Sharc; 1st March 2017 at 19:39.
Sharc is offline   Reply With Quote
Old 1st March 2017, 21:28   #13  |  Link
maniac78
Registered User
 
Join Date: Apr 2013
Posts: 9
I just copied what you said you did and I agree, the output is fine. I will tell "them" that this is just the way it is.
maniac78 is offline   Reply With Quote
Old 1st March 2017, 21:56   #14  |  Link
maniac78
Registered User
 
Join Date: Apr 2013
Posts: 9
Thank you all for the advice, it's very appreciated.
maniac78 is offline   Reply With Quote
Old 1st March 2017, 22:24   #15  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,079
Played a little with the BAF.avi using StaxRip, and the resulting MKV was fine in all players.

(BTW Sharc used the "--tff" command which is wrong. The source is clearly BFF)


Some interesting notes:
First I did the conversion without any cropping and resizing. StaxRip added the "--sar 10:11" parameter. Result was fine.

Then I made another conversion without resizing, but this time I cropped the source heavily so it was in portrait mode. Again StaxRip used the "--sar 10:11" parameter, and to my surprise the result also looked perfect on all players. The MKV container seems to be pretty smart...

For the next conversion I used the StaxRip resize function. I adjusted the size so that the source was only resized horizontally, the vertical size stayed at 480. The target frame size was now 656 x 480. This time Stax did not add any "SAR" parameter, and the result which now had square pixels was perfect again.

And for the last conversion I used heavy cropping plus horizontal resizing. No "SAR" parameter, and again a result which played perfectly.


So it seems clear that No Resizing should be the preferred way, but only if the intended player software or hardware respects the aspect ratio in the MKV. Resizing to square pixels should be more player friendly, but you have to be careful to only resize horizontally. And surprisingly in both cases the cropping was handled gracefully - maybe this is unique to StaxRip...


Cheers
manolito

Last edited by manolito; 1st March 2017 at 22:47.
manolito is offline   Reply With Quote
Old 1st March 2017, 22:41   #16  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 3,997
Quote:
Originally Posted by manolito View Post
(BTW Sharc used the "--tff" command which is wrong. The source is clearly BFF)
Correct. Sorry for the typo. It should have been --bff. DV is Bottom Field First.
Quote:
Then I made another conversion without resizing, but this time I cropped the source heavily so it was in portrait mode. Again StaxRip used the "--sar 10:11" parameter, and to my surprise the result also looked perfect on all players. The MKV container seems to be pretty smart...
Cropping does not change the PAR (Pixel Aspect Ratio), so --sar 10:11 is still correct. The --sar is written to the stream, so a player which reads it should play it undistorted, irrespective of the container.

Quote:
For the next conversion I used the StaxRip resize function. I adjusted the size so that the source was only resized horizontally, the vertical size stayed at 480. The target frame size was now 656 x 480. This time Stax did not add any "SAR" parameter, and the result which now had square pixels was perfect again.
A missing --sar is equivalent to --sar 1:1 in x264, AFAIK. So again, no surprise that it played back correctly.....

Edit:
Just a note for the sake of completeness:
When you author the file to a DVD or Blu-Ray disc, the video (including any borders) will be played back on TV either as 4:3 or 16:9, ignoring the PAR (--sar in x264) of the video stream. This means that the picture must be sized accordingly, which usually requires adding black borders in order to obtain an undistorted playback at 4:3 or 16:9.

Last edited by Sharc; 2nd March 2017 at 09:00.
Sharc is offline   Reply With Quote
Old 2nd March 2017, 20:34   #17  |  Link
maniac78
Registered User
 
Join Date: Apr 2013
Posts: 9
Quote:
Originally Posted by manolito View Post
(BTW Sharc used the "--tff" command which is wrong. The source is clearly BFF)

For the next conversion I used the StaxRip resize function. I adjusted the size so that the source was only resized horizontally, the vertical size stayed at 480. The target frame size was now 656 x 480. This time Stax did not add any "SAR" parameter, and the result which now had square pixels was perfect again.
I also noticed the TFF/BFF error and adjusted for that but thanks for pointing it out.

It's odd that 656 x 480 worked for you as that definitely did not work for me in StaxRip, the output was obviously too squished and made everything look tall and thin.

But after reading all the advice I do think I have it figured out now and if the people I'm doing this for don't like it then I guess they'll just have to deal with it. :-)

Thanks for all the help.
maniac78 is offline   Reply With Quote
Old 2nd March 2017, 20:37   #18  |  Link
maniac78
Registered User
 
Join Date: Apr 2013
Posts: 9
Quote:
Originally Posted by Sharc View Post
Cropping does not change the PAR (Pixel Aspect Ratio), so --sar 10:11 is still correct. The --sar is written to the stream, so a player which reads it should play it undistorted, irrespective of the container.
That's very good to know.

Quote:
Originally Posted by Sharc View Post
Edit:
Just a note for the sake of completeness:
When you author the file to a DVD or Blu-Ray disc, the video (including any borders) will be played back on TV either as 4:3 or 16:9, ignoring the PAR (--sar in x264) of the video stream. This means that the picture must be sized accordingly, which usually requires adding black borders in order to obtain an undistorted playback at 4:3 or 16:9.
That's good to know if they ever want the masters converted to one of those formats. Thanks!

Like I told manolito, after reading all the advice I think I have it figured out now and if the people I'm doing this for don't like it then I guess they'll just have to deal with it. :-)

Thanks for all the help.
maniac78 is offline   Reply With Quote
Reply


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 04:41.


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