This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

[BUG] AviSynth x86 + MPG = wrong aspect ratio and frame count (missing 88%)
#1
Bug 
Using Hybrid Dev 2021.04.15.1

Using AviSynth 32 bit and .mpg file. Mpg file is muxed DVD VOB's with just video (no re-encoding).

General
Count                                    : 331
Count of stream of this kind            : 1
Kind of stream                          : General
Kind of stream                          : General
Stream identifier                        : 0
Count of video streams                  : 1
Video_Format_List                        : MPEG Video
Video_Format_WithHint_List              : MPEG Video
Codecs Video                            : MPEG Video
Complete name                            : E:\USER\fin\test\DVD Mux\test.mpg
Folder name                              : E:\USER\fin\test\DVD Mux
File name extension                      : test.mpg
File name                                : test
File extension                          : mpg
Format                                  : MPEG-PS
Format                                  : MPEG-PS
Format/Extensions usually used          : mpeg mpg m2p vob vro pss evo
Commercial name                          : MPEG-PS
Internet media type                      : video/MP2P
File size                                : 4845105152
File size                                : 4.51 GiB
File size                                : 5 GiB
File size                                : 4.5 GiB
File size                                : 4.51 GiB
File size                                : 4.512 GiB
Duration                                : 7435880
Duration                                : 2 h 3 min
Duration                                : 2 h 3 min 55 s 880 ms
Duration                                : 2 h 3 min
Duration                                : 02:03:55.880
Duration                                : 02:03:55:22
Duration                                : 02:03:55.880 (02:03:55:22)
Overall bit rate mode                    : VBR
Overall bit rate mode                    : Variable
Overall bit rate                        : 5212677
Overall bit rate                        : 5 213 kb/s
Frame rate                              : 25.000
Frame rate                              : 25.000 FPS
Frame count                              : 185897
Stream size                              : 96417662
Stream size                              : 92.0 MiB (2%)
Stream size                              : 92 MiB
Stream size                              : 92 MiB
Stream size                              : 92.0 MiB
Stream size                              : 91.95 MiB
Stream size                              : 92.0 MiB (2%)
Proportion of this stream                : 0.01990
File creation date                      : UTC 2021-05-04 19:02:27.735
File creation date (local)              : 2021-05-04 15:02:27.735
File last modification date              : UTC 2021-05-04 19:02:53.578
File last modification date (local)      : 2021-05-04 15:02:53.578

Video
Count                                    : 378
Count of stream of this kind            : 1
Kind of stream                          : Video
Kind of stream                          : Video
Stream identifier                        : 0
StreamOrder                              : 0
FirstPacketOrder                        : 0
ID                                      : 224
ID                                      : 224 (0xE0)
Format                                  : MPEG Video
Format                                  : MPEG Video
Commercial name                          : MPEG-2 Video
Format version                          : Version 2
Format profile                          : Main@Main
Format settings                          : BVOP
Format settings, BVOP                    : Yes
Format settings, BVOP                    : Yes
Format settings, Matrix                  : Default
Format settings, Matrix                  : Default
Format settings, GOP                    : M=3, N=13
Format settings, picture structure      : Frame
Internet media type                      : video/MPV
Duration                                : 7435880
Duration                                : 2 h 3 min
Duration                                : 2 h 3 min 55 s 880 ms
Duration                                : 2 h 3 min
Duration                                : 02:03:55.880
Duration                                : 02:03:55:22
Duration                                : 02:03:55.880 (02:03:55:22)
Bit rate mode                            : VBR
Bit rate mode                            : Variable
Bit rate                                : 5108945
Bit rate                                : 5 109 kb/s
Maximum bit rate                        : 7200000
Maximum bit rate                        : 7 200 kb/s
Width                                    : 720
Width                                    : 720 pixels
Height                                  : 576
Height                                  : 576 pixels
Sampled_Width                            : 720
Sampled_Height                          : 576
Pixel aspect ratio                      : 1.896
Display aspect ratio                    : 2.370
Display aspect ratio                    : 2.40:1
Frame rate                              : 25.000
Frame rate                              : 25.000 FPS
Frame count                              : 185897
Standard                                : PAL
Color space                              : YUV
Chroma subsampling                      : 4:2:0
Chroma subsampling                      : 4:2:0
Bit depth                                : 8
Bit depth                                : 8 bits
Scan type                                : Interlaced
Scan type                                : Interlaced
Scan order                              : TFF
Scan order                              : Top Field First
Compression mode                        : Lossy
Compression mode                        : Lossy
Bits/(Pixel*Frame)                      : 0.493
Delay                                    : 540.000000
Delay                                    : 540 ms
Delay                                    : 540 ms
Delay                                    : 540 ms
Delay                                    : 00:00:00.540
Delay_DropFrame                          : No
Delay, origin                            : Container
Delay, origin                            : Container
Delay_Original                          : 35999800
Delay_Original                          : 9 h 59 min
Delay_Original                          : 9 h 59 min 59 s 800 ms
Delay_Original                          : 9 h 59 min
Delay_Original                          : 09:59:59.800
Delay_Original_Settings                  : drop_frame_flag=0 / closed_gop=0 / broken_link=0
Delay_Original_DropFrame                : No
Delay_Original_Source                    : Stream
Time code of first frame                : 09:59:59:20
Time code source                        : Group of pictures header
GOP, Open/Closed                        : Open
GOP, Open/Closed                        : Open
Stream size                              : 4748687490
Stream size                              : 4.42 GiB (98%)
Stream size                              : 4 GiB
Stream size                              : 4.4 GiB
Stream size                              : 4.42 GiB
Stream size                              : 4.423 GiB
Stream size                              : 4.42 GiB (98%)
Proportion of this stream                : 0.98010
Buffer size                              : 229376
colour_description_present              : Yes
colour_description_present_Source        : Stream
Color primaries                          : BT.601 PAL
colour_primaries_Source                  : Stream
Transfer characteristics                : BT.470 System B/G
transfer_characteristics_Source          : Stream
Matrix coefficients                      : BT.470 System B/G
matrix_coefficients_Source              : Stream
intra_dc_precision                      : 10

When loading .mpg file into Hybrid, it shows correct frame count of 185,897.

But even if just passing the video straight through to only re-encode as .mp4, the job ends too soon, only processing 21,333 frames. It doesn't error... it shows job finished successfully... but it's only 21,333 instead of 185,897 frames. This is replicated in the previewer.

Also, when viewing in the previewer, the aspect ratio is off. The source .mpg is 720x576 PAL. (Flagged interlaced but actually progressive). The correct stretched aspect ratio should be 1024x576. But Hybrid stretches it on output or the previewer to 1366x576.

I PM'd you a Google Drive link to the .mpg file in case it will help.

Script:

ClearAutoloadDirs()
SetFilterMTMode("DEFAULT_MT_MODE", MT_MULTI_INSTANCE)
LoadPlugin("C:\PROGRA~1\Hybrid\32bit\AVISYN~1\DGDecode.dll")
# loading source: E:\USER\fin\test\DVD Mux\test.mpg
#  color sampling YV12@8, matrix: bt470, scantyp: progressive, luminance scale: limited
MPEG2Source(d2v="mpg_f5d9e8b592bb9f82f1c267d316f6ecbe_853323747.d2v")
# current resolution: 720x576
# filtering
PreFetch(8)
# setting output fps to 25.000fps
AssumeFPS(25,1)
#  output: color sampling YV12@8, matrix: bt470, scantyp: progressive, luminance scale: limited
return last

Log file:

.zip   HybridDebugOutput.zip (Size: 21,81 KB / Downloads: 4)



I tried re-muxing the DVD .VOB files to a single .VOB file without re-encoding:

1) The aspect ratio is still wrong at 1366x576

2) The frame count is still way too low, but it changed to 34,489 frames (missing 81.45% of the frames).

Debug:

.zip   HybridDebugOutput.zip (Size: 26,06 KB / Downloads: 3)
Reply
#2
As a side note: looking at the MediaInfo data the delay_original (= delay in the video stream itself) seems to be wrong.

Quote:Also, when viewing in the previewer, the aspect ratio is off.
No clue what that is, but usually wrong aspect ratio happens if the input isn't properly flagged.
According to the flags in the mpg file 'Pixel aspect ratio : 1.896' is used.
With this PAR 720x576 will be (720*1.896 ~ 1365 ~1366)x576
-> not Hybrids fault that your source if buggy.

=> Whatever you used (no clue why you did it) to create a mpg file out of multiple vob files didn't make a good job.

Quote: the job ends too soon, only processing 21,333 frames.
My guess is that the frame that were encoded are just the frames of the first .vob.
MPEG2Source probably used the time codes inside the mpg file which probably start with each added vob new,...


-> I'll download the file and have a short look at it, your best option is probably to remux to .mkv using mkvtoolnix, which has quite a bit of code to deal with buggy input. Hybrid is not designed for broken input.

Cu Selur
Reply
#3
Frame count is handled correctly by Hybrid version 2020.11.25.1.

First VOB file on DVD (VTS_01_1.VOB) has 34,093 frames. Doing a VOB mux is closer to this but not exact (34,489 frames)... MPG mux is way off.

Aspect ratio is still wrong in Hybrid 2020.11.25.1, probably because of incorrect aspect ratio in source, like you said. VOB files loaded into MKVToolNix show correct pixels in GUI of 1024x576, again, probably due to MKVToolNix handling bad sources well.

Is muxing DVD VOB's to MKV the preferred way to handle DVD? For video only, I always used ffmpeg to mux to mpg, since mpg is the format DVD uses.
Reply
#4
Can't reproduce the issue here with your source:

using Vapoursynth:
  • D2VSource: 185896 frames
  • dgdecodenv.DGSource: 185896 frames
  • LWLibavSource (with hardware decoding): 185896 frames
using Avisynth (32bit):
  • DGSource: 185896 frames
  • MPEG2Source: 185896 frames
  • LWLibavVideoSource: 29827 frames
  • D2VSource: 185896 frames

-> only decoder that's wrong here is LWLibavVideoSource which usually isn't used for decoding.

Quote:, I always used ffmpeg to mux to mpg, since mpg is the format DVD uses.
a. ffmpeg isn't really meant to handle dvd input
b. if really want to use ffmpeg to concatenate vob files you need to tell ffmpeg to recalculate the time codes otherwise the output will be 'broken'
better use:
- mencoder to remux to mpg since it can handle DVD input
- mkvtoolnix or MakeMKV if you want to remux .vob files to mkv
- PGCDemux to demux to raw streams, this is probably the 'best' way since it is the best in handling pgcs.

Quote:Frame count is handled correctly by Hybrid version 2020.11.25.1.
like I wrote before, works fine here,... Smile (since MPEG2Source hasn't be updated for ages and works fine here: no clue whats happening on your end)

Quote:Is muxing DVD VOB's to MKV the preferred way to handle DVD?
Depends on what you want to do. The best way is probably using PGCDemux if your source has multiple pcs, otherwise mkvtoolnix or MakeMKV are probably the best way.


Cu Selur
Reply
#5
Wink 
The latest Hybrid version I have is 2021.04.15.1. Is that what you used? I'm pretty sure I didn't see LWLibavVideoSource getting used.

If not, maybe I should try the latest dev version? Wink
Reply
#6
Libav only get's used if a few options are combined.
Will send you a link to the current dev version,...
Reply
#7
Thanks. I tried muxing the VOB's into a MKV using MKVToolNix and that works fine in Hybrid 2020.04.15.1. Will check MPG in latest dev version. But it looks like MKV is the way to go.

Thanks again for the fast reply and spending time on this. Wink
Reply
#8
Lightbulb 
I tried loading the mpg in the 2021.05.25.1 dev version, and the AviSynth previewer still has the problem... it ends at 21,332 frames.

(I removed the C:\Users\Administrator\AppData\Roaming\hybrid folder before running.)

Hybrid will show the correct frames when the source file loads. But it will end at 21,332 frames in the AviSynth previewer, or on a job process. (Did you click the AviSynth previewer button and click "end" to go to the end frame in the previewer?)

As I mentioned, with all the exact same settings, the mpg will load and go to the correct end frame (185,895) in the AviSynth previewer in Hybrid version 2020.11.25.1.

Not sure if you want to spend time on this or not, but anyways, here are logs:


Hybrid 2021.05.25.1 (ends at incorrect frame 21,332 in AviSynth previewer):

.zip   HybridDebugOutput_20210525.zip (Size: 20,85 KB / Downloads: 2)


Hybrid 2020.11.25.1 (ends at correct frame 185,895 in AviSYnth previewer):

.zip   HybridDebugOutput_20201125.zip (Size: 20,69 KB / Downloads: 4)




Looks like the problem is not a Hybrid problem, but a problem with the new 2.0.0.2 version of DGIndex.exe that is now included with Hybrid. If I replace it with the older 1.5.8 version that Hybrid 2020.11.25.1 uses, then the problem goes away. (Full 185,896 frames load into AviSynth previewer or output.)

I can confirm this if I run each DGIndex.exe directly and load the mpg file.



Looks like this problem was solved in DGMPGDec Version 2.0.0.5. It appears DGIndex.exe and DGDecode.dll from dgmpgdec2005.zip works with Hybrid and solves the mpg issues above.
Reply
#9
Good to know I'll update the DGindex&DGDecode version.

Cu Selur
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)