Hello.
So I've been burning a DVD for the band I filmed and in AVS during the video encoding ffmpeg uses an incorrect SAR value of 64:45 for DAR of 16:9, which is an incorrect value, as 64:45 = 1,42222..., the correct value for Sample Aspect Ratio widescreen PAL is 512:351= 1,458689...
Is there an option to remedy that in AVS interface so that ffmpeg is corrected?
+ Reply to Thread
Results 1 to 30 of 96
-
-
Read this:
https://en.wikipedia.org/wiki/Pixel_aspect_ratio
There is no such thing as 'Sample Aspect Ratio' SAR stands for Storage Aspect Ratio which is almost always 720*576 for PAL DVD. So maybe you mean Pixel Aspect Ratio and the table quoted confirms that 64:45 is correct for 16:9 PAL.
You can not do a simple division because dvd pixels are non-square. -
ffmpeg uses the term SAR - Sample Aspect Ratio for the Pixel Aspect Ratio, not Storage Aspect Ratio.
The table on wikipedia is wrong, because it was made by morons who has no idea how SD video works and 64:45 is not correct.
Would you like a long, or a short story why?
Yes, the video on DVD is 720x576 ans yes pixels are not square, but their width/height ratio is not 64:45.
Beside, your comment does not answer my question.
This page has correct informations:
https://bjohas.de/wiki/Tutorials/Video/Pixel_Aspect_Ratio
The "NLE" values do not conform to the SD video stanadrds desctibed in REC.470 and 601, also proper NLEs use proper values, such as Vegas Pro, somehow it is able to use proper Pixel Aspect Ratio, unfortunately ffmpeg can't.
Also, if you dig deep enough, the ITU-R documents use the term Sample, not Pixel.Last edited by SF01; 24th Aug 2020 at 08:48. Reason: Additional info, so as not to double post.
-
If you are encoding to mpeg2 you can use a video filter in a ffmpeg commandline:
ffmpeg -i inputvideo -vf setsar=1:1 -aspect 16:9 -c:v mpeg2video -b:v 6000k -an output.mpg
If you already have your mpg video, you can change the display aspect ratio (DAR) with DVD Patcher without recoding.
Read also this discussion:
https://forums.whirlpool.net.au/thread/1470507#r13Last edited by ProWo; 24th Aug 2020 at 09:27.
-
The project is done through AVS2DVD, because the ffmpeg encodes incorrect pixel aspect ratio I have to first render the project to a DV file and then put it into AVS.
Is there an option in AVS to override ffmpeg settings or put additional command line parameters?
The AVS goes straight into DVD folder structure, ISO, or DVD. To change parameters I would have to stop before the muxing is completed, so basically encode the fiels manually, mux manually and then burn the DVD.
Is there an option to inclde cropping information to the DVD stream? So that the media players will properly stretch the image and then crop the blanking at the edges? -
The true moron does not recognize that he's a moron.
The problem is it's not thw whole 720 pixels that store video information, or at least should according to REC.601. In Pal only the 702 pixels carry video signal, while in NTSC it's 704.
So 702 / 351 * 512 = 1024, 1024 / 16 * 9 = 576
Similar calculations regard 4:3 and NTSC.
The link I privided goes more in depth than wikipedia, which in many places displays inaccurate informationaand sometimes even straight false. -
Well always looking to expand on my miniscule knowledge I did read the article you linked to - the one with the 'correct' information.
Reminds me to visit the optician given the last line in the quoted table.
Might also want to read the 'what is' link at top of page. The relevant line there is:
"16:9 Anamorphic (only supported by 720x576)" -
I don't have the DVD spec. But someone who did once posted here and said that the DVD spec refers to the MPEG 2 spec for aspect ratio information. Only two of the four MPEG 2 aspect ratios are valid for DVD: 4:3 and 16:9 (the other two are 2.25:1 DAR and 1:1 SAR). MPEG 2 video doesn't indicate the sampling aspect ratio directly, it indicates only the display aspect ratio. And it clearly states that the entire frame constitutes the DAR, not a 704x480 or 702x576 portion thereof. So the MPEG 2 spec indicates (indirectly) the SAR (sample aspect ratio) for a 720x576 16:9 frame is 64:45. That is at odds with the ITU spec for digitizing analog 16:9 SD video where the SAR is approximated as 16:11 (assumes a 704x576 frame), or 512:351 (assumes a 702x576 frame -- more accurate).
So AVS2DVD and ffmpeg are using the correct SAR as specified by the MPEG 2 spec.
In my experience, most DVDs made by digitizing analog tape sources just take the full 720x576 ITU frame and write it to the DVD, ignoring the difference between the ITU and MPEG 2 specs. If you have such a DVD you can fix it yourself by cropping, resizing, and/or forcing the SAR. -
One other thing about avstodvd. If you input dvd-compliant video then you can set a flag in the program not to re-encode it. So while 702*576 might be PAL-compliant it is not dvd-compliant. Only 704*576 is. And regardless of that if you input DV you are not inputting compliant video so the program must re-encode. And since 702|704 * 576 are not valid for 16:9 dvd the program inevitably will add borders to the frame to come back to the 720*576 you might have started with (you can check that by reading the avisynth script that avstodvd creates internally.
But what do I know ? -
Yes and no, because upon playback via analog video connectors the 720 pixels are transmitted correctly according to ITU as 53,333 µs line, so only when the Pixel Aspect ratio is correct and the active image is contained in 702 pixels those will constitute the 52 µs as specified in ITU documents.
The problem is with playback on PC though, as prgrams will treat the 720 pixels as full active image without cropping the digital equivalent of analog blanking.
The full 720x576 frame made from analog recordings is correct because it has ITU-compliant format of 128:117 Sample Aspect Ratio, because the devices sample (or at least should) the 53,333 µs with 13,5MHz sampling rate resulting in 720 samples, out of those only 702 (52*13,5) contain active image.
The problem appears when I put a video with different resolution than 720x576, then it needs to be resized and is resized with incorrect (according to ITU) SAR, for example to make a DVD from 1920x1080 video it will be converted to 64:45 SAR, to avoid that I first render it to DV as Vegas supports proper pixel aspect ratios, so it results in added black bars to the sides, when doing the same in avs via ffmpeg it does not happen.
Therefore for proper playback on PC the encoded SAR should be different than the one resulting from ffmpeg. I have read somewhere, but can't find it, that additional cropping information can be encoded in DVD so it is read during playback on PC so that it cropps the edges and then expands the remaining portion to the desired aspect ratio, but since I can't find it anymore I don't know if I remember it correctly.
So the solution would be to run the command line and force proper SAR into ffmpeg. -
Additional AR information in a MPEG2 stream can be included as sequence_display_extension.
But not all hardware or software players interpret this information correctly or consistently; and not all software encoders can apply it (ffmpeg cannot). You can patch it afterwards on an elementary stream with restream -
-
-
-
My experience is the same as jagabo's
And 100% correct for every single NTSC Hollywood DVD's - they all use 32:27 instead of 40:33 for 16:9
Did you mean direct PC playback on a normal monitor ? Or connected externally to a secondary device or display?
That is not correct for PC - A 1920x1080 source should use 64:45 for 720x576 full frame size . A 1920x1080 source has a perfect 16:9 DAR.
16/9 = 720/576 * 64/45
A PC player should display it as 1024 width 576 height exactly 1024/576 = 16/9 . -
1. From what I've read this change occured around 2006.
2. 1920x1080 should still use 512:351 for 720x576 to be ITU-compliand and this is what I am trying to achieve, though I can't make it happen in the AVS with command line edit. The cropping information allegedly could be used to crop the blanking and then the PC player would display the cropped image with proper aspect ratio as 1024x576.
The guy here:
https://superuser.com/questions/1214635/error-while-merging-two-mp4-video-files-with-ffmpeg
has a file with proper SAR and DAR for ITU compliand SD video, how he got it I don't know. -
-
They should, at least via the cropping in all applications.
The change of SAR encoding on Hollywood DVDs, when they switched from ITU-compliant to the non-compliant values:
http://forum.doom9.org/archive/index.php/t-158604.html
To be ITU-compliand 1920x1080 converted to 720x576 should still maintain SAR of 512:351, which is what I require, but can't achieve.
There is an interesting archive of ffmpeg dev chat:
https://ffmpeg-devel.ffmpeg.narkive.com/9D1UB5Qi/patch-nvenc-compensate-for-hardware-t...-content#post2, the most interesting bit is:
Code:In other words, it should happen immediately when FFmpeg reads contents that is "probably" BT601: Input stream #0:0: Video: mpeg2video (Main), yuv420p(tv), 720x576 [SAR 64:45 DAR 16:9] should be fixed into: Input stream #0:0: Video: mpeg2video (Main), yuv420p(tv), 720x576 [SAR 512:351 DAR 640:351] That way, the laws of geometry and arithmetic are respected, the size of the pixels is correct, and it will work will all encoders, not just nvenc.
Last edited by SF01; 24th Aug 2020 at 13:36.
-
You're misunderstanding what is being said in that thread.
A 1920x1080 source uses the full active image area . Don't confuse that with an analog SD PAL source, or some other analog source.
MPEG2 for DVD only supports 16:9 and 4:3 . Setting the SAR to some other value is not supported . This is not like AVC stream, where almost all players universally accept it . If it were AVC, you could use almost any SAR value and it would work to resize the display. That's not the same thing as crop. The entire frame is resized. AVC supports a crop flag as well, but that is different than SAR . Crop is not the same thing as SAR
But if it were AVC in MP4 or MKV, you would still use 720x576 and 64:45 for a 1920x1080 source . The geometry is perfect. You can test it yourself. This will display as 1024x576. Perfect. You can test with a perfect circle graphic overlayed in 1920x1080 frame . It works.
For an MPEG2 stream, sequence_display_extension specifies the active image area that is scaled to 16:9 or 4:3. Functionally it would be like a crop and resize. But not all players (hardware and software) support this. Very few do. I already mentioned ffmpeg cannot do this. restream can patch it, but almost no player will respect it. -
I probably am misunderstanding something, I'm not best at english anyway.
1920x1080 uses full frame yes, but when converting it to SD PAL of 720x576 the SAR should be 512:351, not 64:45 so that it's ITU-compliant.
So the cropping information will occur after the 720x576 frame is expanded to the set aspect ratio of 4:3, or 16:9? It won't work in the manner of first cropping 720 to 702 and then the player will stretch the cropped to 702x576 frame to the set aspect ratio, will it?
But it's completely against REC.601, the mat is there and 720x576 with SAR of 64:45 stretched to 26:9 aspect ratio will produce geometrically correct image (chech the link in post #3), but it is not ITU-compliant and shouldn't be used in applications that must be ITU compliant, otherwise it will produce distorted image.
So it can be done, therefore the specified active image are ahouls be 702x576 for PAL material which should be stretched to 16:9, or 4:3, well then the software ans hardware should support it. So the solution would be to keep the DAR as is in AVS2DVD ffmpeg, but fix it in restream. I have now started running ffmpeg via AVS2DVD with aspect changed from 4:3 (I am currently transffering VHS to DVD) to 128:117 in the command line SAR and DAR values are displayed as 128:117 and 160:117 respectivaly, which is correct for ITU compliant SD video, I will see if I get an error after it's converted.
It will at least be properly displayed in like all players through analog output, that's the whole idea of REC.601, so that amongst others DV video would be displayed properly on analog equipment, you know the little thing called backwards compaibility. It's really lazy for manufacturers not to make sure their digital TVs, players and software can't follow... -
Not for a PC player. That's what was being discussed above.
So the cropping information will occur after the 720x576 frame is expanded to the set aspect ratio of 4:3, or 16:9? It won't work in the manner of first cropping 720 to 702 and then the player will stretch the cropped to 702x576 frame to the set aspect ratio, will it?
https://ffmpeg.org/ffmpeg-bitstream-filters.html#h264_005fmetadata
But AVC cannot be used for DVD, so it's irrelevant for this discussion anyways
But it's completely against REC.601, the mat is there and 720x576 with SAR of 64:45 stretched to 26:9 aspect ratio will produce geometrically correct image (chech the link in post #3), but it is not ITU-compliant and shouldn't be used in applications that must be ITU compliant, otherwise it will produce distorted image.
So it can be done, therefore the specified active image are ahouls be 702x576 for PAL material which should be stretched to 16:9, or 4:3, well then the software ans hardware should support it. So the solution would be to keep the DAR as is in AVS2DVD ffmpeg, but fix it in restream. I have now started running ffmpeg via AVS2DVD with aspect changed from 4:3 (I am currently transffering VHS to DVD) to 128:117 in the command line SAR and DAR values are displayed as 128:117 and 160:117 respectivaly, which is correct for ITU compliant SD video, I will see if I get an error after it's converted.
It will at least be properly displayed in like all players through analog output, that's the whole idea of REC.601, so that amongst others DV video would be displayed properly on analog equipment, you know the little thing called backwards compaibility. It's really lazy for manufacturers not to make sure their digital TVs, players and software can't follow... -
That's the flaw in the PC software, that they can't properly interpret SD video, which is why I am interested in the cropping.
OK, so what should I set in Restream to set the flags that the video needs to be cropped to 702 pixels to be displayed properly in digital equipment that has no idea what REC.601 is? -
Enter the horizontal display size - that's the portion that is supposed to be displayed on screen. eg. 702. It generally does not work correctly (most players ignore). It's part of the mpeg2 spec, but it's an optional component for decoders
Why not resize and pillarbox to make the content AR match whatever you want when using 64:45. At least this will work correctly for DVD. -
So I should check the "Correct Sequence Estension length" and in Sequence display extension select "change" and replace the 540 with 702 and check "with color".
Because I am making an ITU-compliant DVD, while it will play correctly on all DVD players through analog, I am trying to find a way to make it at least possible to play on digtal quipment that is capable of extracting and using the cropping information.
Similar Threads
-
FFMpeg setsar and setdar video filter does not exactly set the sar and dar
By alexander121 in forum Video ConversionReplies: 2Last Post: 15th Oct 2017, 08:57 -
MeGUI SAR
By koberulz in forum Newbie / General discussionsReplies: 17Last Post: 28th Sep 2017, 12:19 -
XviD4PSP doesn't accept SAR value
By TeNSoR in forum Newbie / General discussionsReplies: 3Last Post: 24th Oct 2016, 09:43 -
How to Change SAR in megui??
By anime12345 in forum Video ConversionReplies: 2Last Post: 2nd Nov 2015, 02:01