View Full Version : How to use SelectRangeEvery on this?


JimmyBarnes
7th July 2014, 13:50
Most Blu-rays seem to have M2TS files containing H.264 or VC-1 video but some have MPEG Video v2, Main@High (profile).

It's no problem using SelectRangeEvery on an M2TS containing H.264 or VC-1 video, but when I try to use it with an M2TS containing MPEG Video v2 as DirectShowSource and convert with VFAPI Reader Codec 1.05, it hangs.

Clues please

LoRd_MuldeR
7th July 2014, 14:47
First of all, what are you trying to achieve with SelectRangeEvery()?

Secondly, my first guess would be that DirectShowSource(), and whatever DirectShow-Filters are involved, can't cope with the access pattern produced by SelectRangeEvery. What DirectShow filters are you using in particular?

Also: Why not use DGMPGDec (http://rationalqm.us/dgmpgdec/dgmpgdec.html) instead of DirectShowSource? DirectShowSource is notorious for producing all kinds of strange problems...

JimmyBarnes
7th July 2014, 15:20
First of all, what are you trying to achieve with SelectRangeEvery()?

My AVS contains these 2 lines:

DirectShowSource("Z:\BDMV\STREAM\00001.m2ts")
SelectRangeEvery(300,30)

I am using it as a "compression test" to get an estimate of the final size using various parameters, but in a tenth of the time.

Secondly, my first guess would be that DirectShowSource(). and whatever DirectShow-Filters are involved, can't cope with the access pattern produces by SelectRangeEvery. What DirectShow filters are you using in particular?

Also: Why not use DGMPGDec (http://rationalqm.us/dgmpgdec/dgmpgdec.html) instead of DirectShowSource? DirectShowSource is notorious for producing all kinds of strange problems...

What would the specific line using DGMPGDec in the AVS look like?

LoRd_MuldeR
7th July 2014, 15:22
What would the specific line using DGMPGDec in the AVS look like?

What part of the DGDecode manual exactly you did not understand? :confused:

http://rationalqm.us/dgmpgdec/DGDecodeManual.html

foxyshadis
7th July 2014, 15:35
Don't use DirectShowSource? (And if you must, use DSS2.) Seeking under DirectShowSource is unreliable at best, and crashes at worst, as you've seen, so consider using L-SMASH Source or FFMS2 instead.

If you need to use DSS, we'll need more info to help. Get GraphStudioNext and load both a working (H.264) mpls and a failing (MPEG-2) mpls, and compare them. Is one using a completely different decoder filter? You might need to tweak your filter priorities, or enable MPEG-2 decoding for your preferred filter. Even if they're the same, you need to open the filter properties and check whether anything special is being done: Is it using hardware decoding for one or both? Disabling that for MPEG-2 might help if there's a bug. If all else fails, disable decoding that way, install another filter (like LAV, ffdshow, or gabest) and test with that instead.

Edit: I forgot that dgmpgdec was upgraded to work with mpls. Great idea, Mulder!

JimmyBarnes
7th July 2014, 15:36
What part of the DGDecode manual exactly you did not understand? :confused:

http://rationalqm.us/dgmpgdec/DGDecodeManual.html

The DGDecode 1.5.8 Usage Examples do not include any references to M2TS files

LoRd_MuldeR
7th July 2014, 15:41
The DGDecode 1.5.8 Usage Examples do not include any references to M2TS files
DGDecode, part of the DGMPGDec package, is an MPEG-1/2 decoder plug-in designed for AviSynth [...] It's able to decode any MPEG-1 or MPEG-2 stream readable by DGIndex.
You need to index the file first, using the DGIndex (http://rationalqm.us/dgmpgdec/DGIndexManual.html#WhatIsDGIndex) program. This results in a .d2v project file that you can load via DGDecode...

Groucho2004
7th July 2014, 18:15
The DGDecode 1.5.8 Usage Examples do not include any references to M2TS files
If DGIndex does not handle the m2ts file, you'll have to de-multiplex the video stream first (use eac3to) and then index it.

Edit: Alternatively, use "LWLibavVideoSource". It's frame accurate and handles the m2ts just fine.

JimmyBarnes
8th July 2014, 01:13
If DGIndex does not handle the m2ts file, you'll have to de-multiplex the video stream first (use eac3to) and then index it.

DGIndex handles DVD/VOB but not Blu-ray/M2TS, at least the ones I've tried - results in a horrible green display.

I know how to demux the video, how to "index" it to a filetype that DGIndex supports?

Edit: Alternatively, use "LWLibavVideoSource". It's frame accurate and handles the m2ts just fine.

LWLibavVideoSource(source="source.m2ts", stream_index=-1, threads=0, cache=true, seek_mode=0, seek_threshold=10, dr=false, repeat=false, dominance=0, stacked=false, format="")

but what else is needed in the AVS to make the above work?

videoh
8th July 2014, 01:20
DGIndex handles DVD/VOB but not Blu-ray/M2TS, at least the ones I've tried - results in a horrible green display. DGIndex should work with M2TS containing MPEG2 video. Can you post a link to a sample that doesn't work for you?

Remember, DGIndex works only with MPEG1/2, not AVC or VC1.

but what else is needed in the AVS to make the above work? You have to load the filter DLL using loadplugin(), or put it in your Avisynth autoload directory.

LoRd_MuldeR
8th July 2014, 01:26
DGIndex handles DVD/VOB but not Blu-ray/M2TS, at least the ones I've tried - results in a horrible green display.

DGIndex should support M2TS. There's even a remark about demuxing audio tracks from M2TS/BluRay files in the DGIndex manual.

But DGMPGDec only supports MPEG-1 and MPEG-2 video. So are you 100% sure your M2TS file contains MEPG-2 video?

I know how to demux the video, how to "index" it to a filetype that DGIndex supports?

You can try to demux the elementary MPEG-2 stream from the M2TS file using a tool like eac3to (http://forum.doom9.org/showthread.php?t=125966) or tsMuxeR (http://www.videohelp.com/tools/tsMuxeR).

Indexing is what the DGIndex program does and what will produce the required .d2v project file. You can't use DGDecode in another way.

JimmyBarnes
8th July 2014, 02:51
DGIndex should support M2TS. There's even a remark about demuxing audio tracks from M2TS/BluRay files in the DGIndex manual.

But DGMPGDec only supports MPEG-1 and MPEG-2 video. So are you 100% sure your M2TS file contains MEPG-2 video?


This is what MediaInfo 0.7.68 says:
Video
ID : 4113 (0x1011)
Menu ID : 1 (0x1)
Format : MPEG Video
Format version : Version 2
Format profile : Main@High

videoh
8th July 2014, 02:53
Can you post a link to a sample? You can cut it with DGSplit.

JimmyBarnes
11th July 2014, 14:11
Can you post a link to a sample? You can cut it with DGSplit.

I took a punt and did the full 14 hr encode, results look reasonable.

M2TSs with MPEG video are relatively uncommon fortunately, will try some of these suggestions next time...

videoh
11th July 2014, 14:17
I took a punt and did the full 14 hr encode, results look reasonable.

M2TSs with MPEG video are relatively uncommon fortunately, will try some of these suggestions next time... But you had said this:

DGIndex handles DVD/VOB but not Blu-ray/M2TS, at least the ones I've tried - results in a horrible green display. Are you saying now that you made an error? Maybe it wasn't MPEG2? If there is a problem in DGMPGDec, it's important to get it fixed. Thanks for any clarification you can offer.

JimmyBarnes
11th July 2014, 14:41
But you had said this:

Are you saying now that you made an error? Maybe it wasn't MPEG2? If there is a problem in DGMPGDec, it's important to get it fixed. Thanks for any clarification you can offer.

I do my Blu-ray encodes in TMPGEnc 4.0 Xpress, not by using DGIndex. Only used the latter for DVD encodes - rare now.

The object of this thread was to find a way to do compression tests using SelectRangeEvery(300,30). No probs with M2TS containing H.264 or VC-1 video, but freezes with "MPEG video, version 2".

videoh
11th July 2014, 15:14
I do my Blu-ray encodes in TMPGEnc 4.0 Xpress, not by using DGIndex. Only used the latter for DVD encodes - rare now.

The object of this thread was to find a way to do compression tests using SelectRangeEvery(300,30). No probs with M2TS containing H.264 or VC-1 video, but freezes with "MPEG video, version 2". I'll try once more...

You said that DGMPGDec produced a horrible green screen with an MPEG2 M2TS. Are you still claiming that? If so, can you post a link to a sample?

DGIndex handles DVD/VOB but not Blu-ray/M2TS, at least the ones I've tried - results in a horrible green display.

JimmyBarnes
12th July 2014, 04:06
I'll try once more...

You said that DGMPGDec produced a horrible green screen with an MPEG2 M2TS. Are you still claiming that? If so, can you post a link to a sample?

Yes

Eat your heart out
http://www.mediafire.com/download/u72h6iximtumi2g/01876.m2ts

videoh
12th July 2014, 04:24
Eat your heart out
Thanks, I'll have a look. Can't really understand your tone, though, when I am trying to help you.

EDIT: Everything works fine for me in DGMPGDec 1.5.8 with that stream. I'm sure others will confirm it.

Sharc
12th July 2014, 09:19
EDIT: Everything works fine for me in DGMPGDec 1.5.8 with that stream. I'm sure others will confirm it.
confirmed.

Added:
Works well here, even with DS:
1) demux the .m2ts with tsMuxer
2) Script:
DirectShowSource("C:\Temp\ABTF promo.track_4113.mpv")
selectrangeevery(300,30)

JimmyBarnes
21st July 2014, 11:19
I have an idea that demuxing the MPEG v2 stream from the M2TS with eac3to, wrapping the former in a temporary MKV and using that with DS will also work.

Anyway thanks for the ideas which have been suggested here, all I need now is some time and diligence to try them...