VideoHelp Forum
+ Reply to Thread
Page 1 of 2
1 2 LastLast
Results 1 to 30 of 37
Thread
  1. Member
    Join Date
    Jul 2007
    Location
    United Kingdom
    Search Comp PM
    Hi folks,

    I've got a video which is an HDTV capture from Brazilian TV, Globo Multishow HD to be precise. As far as I know the video should be 1080i, H.264 at 29.97fps interlaced, pretty standard right?. Looking at the file in mediainfo it agrees however when it comes to trying to encode this file I'm getting very odd results.

    The original file format is MKV. If I load that original file with directshowsource into VDub with no other filters it reports that it's 25fps. If I load it with FFmpegsource2 Vdub reports that it's 59.938fps. The same thing happens loading into HCEnc so of course that means an ever bigger mess when I start adding other filters.

    I tried demuxing the file with MKVdemux but then loading the resulting h.264 file HCEnc crashes with Directshowsource and with FFmpegsource2 it gives me an error of invalid initial pts and dts.

    The only way I could get things working is by adding the fps on the input (directshowsource("filei.mkv", fps=29.97)) but on encoding a sample with this full script:

    Load_Stdcall_Plugin("C:\Program Files (x86)\AviSynth 2.5\plugins\yadif.dll")
    directshowsource("filei.mkv", fps=29.97)
    AssumeTFF()
    Yadif(mode=1, order=1)
    Spline64Resize(720,480)
    SeparateFields()
    SelectEvery(4,0,3)
    Weave()
    ColorMatrix(mode="Rec.709->Rec.601", clamp=0)
    ConvertToYUY2()
    But that gave me an output which looked ok but I can see interlacing problems. HCEnc also said this in the log:

    *** WARNING, 1878 frames found with small mismatch errors
    *** ERROR, 44 frames found with large mismatch errors
    I only encoded the first 2000 frames so that is nearly all of them.

    What is going on with this file? Here is a sample of the original MKV, just split with MKVmergegui - http://www.mediafire.com/?s16tmwss1j4xh44

    Thanks in advance.
    Quote Quote  
  2. aBigMeanie aedipuss's Avatar
    Join Date
    Oct 2005
    Location
    666th portal
    Search Comp PM
    mediainfo can't find any framerate for it. most other programs that will load it say either 60i or 25, hard to say what the original was. maybe shot at 25fps and broadcast at 60i? after running through mkvmergegui to remove the header stripping a program i found that will convert it to usable h264 30p is vidcoder. leave detelecine and decomb on auto, deinterlace off. manually set the frame rate to 29.97
    Image Attached Files
    --
    "a lot of people are better dead" - prisoner KSC2-303
    Quote Quote  
  3. The file worked fine for me. MediaInfo reports 29.97 fps interlaced. DirectShowSource() gives 29.97 fps interlaced (without specifying the fps). HcGUI encoded your AVS script properly, 29.97 fps interlaced, top field first.
    Quote Quote  
  4. Member
    Join Date
    Jul 2007
    Location
    United Kingdom
    Search Comp PM
    Originally Posted by jagabo View Post
    The file worked fine for me. MediaInfo reports 29.97 fps interlaced. DirectShowSource() gives 29.97 fps interlaced (without specifying the fps). HcGUI encoded your AVS script properly, 29.97 fps interlaced, top field first.
    Weird, that certainly isn't the case for me here. If I just load with DSS and nothing else framrate is reported to be 25fps in both HC and VDub.

    With the script above forcing 29.97fps and the rest of the script this is my output of the first 2000 frames of the video - http://www.mediafire.com/?36sbkv8vc8bqd3t

    Doesn't look right to me. Plus there is the frame mismatch error from HC that I mentioned.
    Quote Quote  
  5. The DSS() issue may be a matter of what MKV reader/splitter you have installed. I used LAV Filters.

    I suspect the frame mismatch errors in HcEnc may have to do with the fact that DSS() isn't frame accurate. Ie, if the encoder asks for frame N multiple times it may not get the same frame each time. It may get N+1 or N-1 instead. I would try an alternative like ffmpegsource2().

    Your M2V file is a bit odd. MediaInfo doesn't report that it's interlaced. DgIndex show it changing from interlaced to progressive throughout the video. Playback is jerky in VLC, ok in MPCHC.
    Quote Quote  
  6. Member
    Join Date
    Jul 2007
    Location
    United Kingdom
    Search Comp PM
    Indeed, and it was encoded with the exact script I posted in the OP. I was going to encode with ffmpegsource2 but what is the syntax to force 29.97fps? ffmpegsource2("filei.mkv", fps=29.97) doesn't work.
    Quote Quote  
  7. what is the syntax to force 29.97fps?
    FFMpegSource2("filei.mkv", atrack=-1, fpsnum=30000, fpsden=1001)
    Quote Quote  
  8. Member
    Join Date
    Jul 2007
    Location
    United Kingdom
    Search Comp PM
    Originally Posted by poisondeathray View Post
    what is the syntax to force 29.97fps?
    FFMpegSource2("filei.mkv", atrack=-1, fpsnum=30000, fpsden=1001)
    Thanks but for some reason adding those lines cause HC to crash. If I leave them off it loads but it reports the output framerate would be 60.0130.
    Quote Quote  
  9. aBigMeanie aedipuss's Avatar
    Join Date
    Oct 2005
    Location
    666th portal
    Search Comp PM
    Originally Posted by jagabo View Post
    The DSS() issue may be a matter of what MKV reader/splitter you have installed. I used LAV Filters.

    it's not the lav splitter that is the difference between you and us not getting correct info. what else is in your chain?

    Click image for larger version

Name:	2012-04-27_104242.png
Views:	225
Size:	185.2 KB
ID:	12200
    --
    "a lot of people are better dead" - prisoner KSC2-303
    Quote Quote  
  10. Lav -> CoreAVC

    I just disabled CoreAVC and used ffdshow. That worked fine for me too.
    Last edited by jagabo; 27th Apr 2012 at 11:01.
    Quote Quote  
  11. Originally Posted by Killer3737 View Post
    Originally Posted by poisondeathray View Post
    what is the syntax to force 29.97fps?
    FFMpegSource2("filei.mkv", atrack=-1, fpsnum=30000, fpsden=1001)
    Thanks but for some reason adding those lines cause HC to crash. If I leave them off it loads but it reports the output framerate would be 60.0130.

    You can try this

    Code:
    FFVideoSource("filei.mkv")
    AssumeFPS(30000,1001)
    ffms2 and ffmpeg have well known documented issues with h.264 interlaced transport streams . I haven't looked at the file, but likely this was originally a transport stream, just re-wrapped into mkv
    Quote Quote  
  12. ffvideosource() screws up for me too. It will get the first frame of video but when I seek I get "AviSynth read error: FFVideoSource: Insanity detected: decoder returned and empty frame". seekmode=0 doesn't help either.
    Quote Quote  
  13. Directshow works ok for me too; using haali + ffdshow , or lav + ffdshow

    Certain versions of lav had problems, so you can try updating that as well
    Quote Quote  
  14. Member
    Join Date
    Jul 2007
    Location
    United Kingdom
    Search Comp PM
    Originally Posted by poisondeathray View Post
    Originally Posted by Killer3737 View Post
    Originally Posted by poisondeathray View Post
    what is the syntax to force 29.97fps?
    FFMpegSource2("filei.mkv", atrack=-1, fpsnum=30000, fpsden=1001)
    Thanks but for some reason adding those lines cause HC to crash. If I leave them off it loads but it reports the output framerate would be 60.0130.

    You can try this

    Code:
    FFVideoSource("filei.mkv")
    AssumeFPS(30000,1001)
    ffms2 and ffmpeg have well known documented issues with h.264 interlaced transport streams . I haven't looked at the file, but likely this was originally a transport stream, just re-wrapped into mkv
    The script loads with that but crashes when I hit encode. The file WAS a TS originally, the person I got it from said he changed the container to MKV to save space. One thing I'm not sure on though, he said the original TS was 14.1GB and the MKV file was 11.6GB. He said it was just a container change but that seems like too big a drop in size to me and when I remuxed the MKV into TS it was only 12.xGB. Shouldn't it have been the same as the original TS?
    Quote Quote  
  15. Originally Posted by Killer3737 View Post

    The script loads with that but crashes when I hit encode. The file WAS a TS originally, the person I got it from said he changed the container to MKV to save space. One thing I'm not sure on though, he said the original TS was 14.1GB and the MKV file was 11.6GB. He said it was just a container change but that seems like too big a drop in size to me and when I remuxed the MKV into TS it was only 12.xGB. Shouldn't it have been the same as the original TS?

    Nope, transport stream overhead can be anywhere ~ 5-10%

    You can try it yourself, demux the streams, use tsmuxer to wrap into transport stream. Notice the size balloon
    Quote Quote  
  16. Member
    Join Date
    Jul 2007
    Location
    United Kingdom
    Search Comp PM
    That's what I'm saying, I did remux it into a TS and it came out at 12GB or thereabouts, ~2GB less than what he said the original TS was.
    Quote Quote  
  17. It should be the same, if you used the same kind of transport stream and muxing parameters, if there were no errors. You can mux with different buffer and muxrates that can change the size. Sometimes demuxing can drop packets if there were errors in the stream to begin with

    Ask him to do test the same using the same programs you used (demux, mux) and note the sizes

    Or maybe there were other errors? e.g transmission errors. How did you get the file?
    Quote Quote  
  18. Member
    Join Date
    Jul 2007
    Location
    United Kingdom
    Search Comp PM
    Through torrent and verified with an md5 hash. I've just asked which tools he used. Going back to something I said earlier, has anyone had any luck with a demuxed h264 file? When I did that and tried to encode I got an invalid initial pts and dts error from avisynth.
    Quote Quote  
  19. md5 hash check is useless if the original MKV is b0rked. As soon as you demux or rewrap a transport stream it can give you errors.

    The reason why broadcasters use transport streams is they are very robust. That extra overhead contains timing data and recovery information. When you re-wrap, you lose a lot of that - often you get glitches and desync whereas the original transport stream will play fine. So only if the original stream was pristine without transmission errors, can you safely re-wrap it.



    For avisynth, you can index it with DGNVtools. It's probably the most robust solution, but not free and requires compatible Nvidia card. DGDiAVC should also work (but requires 2 licenses, 1 from DiAVC and 1 from neuron)

    DGAVCIndex is depreciated, and will give you stream errors with PAFF streams like this one (you will see macroblocking)

    The only free solution that is semi consistent is using directshow for interlaced avc - directshow can often ignore errors and keep sync. Anyways, directshow seems to work ok here for me (probably because it ignores many problems) . ffmpeg/ffmbc report a gazillion errors
    Quote Quote  
  20. aBigMeanie aedipuss's Avatar
    Join Date
    Oct 2005
    Location
    666th portal
    Search Comp PM
    who's the band anyway?
    --
    "a lot of people are better dead" - prisoner KSC2-303
    Quote Quote  
  21. Member
    Join Date
    Jul 2007
    Location
    United Kingdom
    Search Comp PM
    Foo Fighters is the band.

    Originally Posted by poisondeathray View Post
    md5 hash check is useless if the original MKV is b0rked. As soon as you demux or rewrap a transport stream it can give you errors.

    The reason why broadcasters use transport streams is they are very robust. That extra overhead contains timing data and recovery information. When you re-wrap, you lose a lot of that - often you get glitches and desync whereas the original transport stream will play fine. So only if the original stream was pristine without transmission errors, can you safely re-wrap it.
    Yeah I know, I just meant the MKV I have was identical to his so no problem with the download. I've just asked him and he said he changed it to MKV with gdsmux.exe. Can't say I've ever used that myself but could you see that causing the problems? I've asked if he still has the original TS that he can cut a sample of for me/you to look at and see if it still has problems like the MKV.



    For avisynth, you can index it with DGNVtools. It's probably the most robust solution, but not free and requires compatible Nvidia card. DGDiAVC should also work (but requires 2 licenses, 1 from DiAVC and 1 from neuron)

    DGAVCIndex is depreciated, and will give you stream errors with PAFF streams like this one (you will see macroblocking)

    The only free solution that is semi consistent is using directshow for interlaced avc - directshow can often ignore errors and keep sync. Anyways, directshow seems to work ok here for me (probably because it ignores many problems) . ffmpeg/ffmbc report a gazillion errors
    Thanks, I'll have a look at these options if the problem is the same on the original TS or I can't get it.
    Quote Quote  
  22. aBigMeanie aedipuss's Avatar
    Join Date
    Oct 2005
    Location
    666th portal
    Search Comp PM
    Originally Posted by Killer3737 View Post
    Foo Fighters is the band.
    ah i thought it looked familiar - the hdtv version of back and forth?
    --
    "a lot of people are better dead" - prisoner KSC2-303
    Quote Quote  
  23. aBigMeanie aedipuss's Avatar
    Join Date
    Oct 2005
    Location
    666th portal
    Search Comp PM
    wrong one - lollapolooza brasil earlier this month?

    720p full concert on youtube if you want it - http://www.youtube.com/watch?v=OO-e8_-bMv8 - sounds ok
    --
    "a lot of people are better dead" - prisoner KSC2-303
    Quote Quote  
  24. Member
    Join Date
    Jul 2007
    Location
    United Kingdom
    Search Comp PM
    Originally Posted by aedipuss View Post
    wrong one - lollapolooza brasil earlier this month?

    720p full concert on youtube if you want it - http://www.youtube.com/watch?v=OO-e8_-bMv8 - sounds ok
    That is sourced from this MKV.
    Quote Quote  
  25. Did you fiddle with lav splitter ? I made a mistake earlier: haali does have some issues with that mkv. Go with lav for this one

    Although lav splitter reports 29.97 , it's not quite correct for DVD (it's an approximation), so in your script you should put AssumeFPS(30000,1001) anyways

    Eitherway, I tried it with HCEnc and it reported frame mismatch between the passes too - probably because of directshow. So to get around that, you can encode to lossless intermediate first (using the SD re-reinterlace script, but add AssumeFPS(30000,1001) ), then use AVISource to encode with HCEnc . When I examined the output, it's fine (except for the first couple of frames where you cut it)
    Quote Quote  
  26. Member
    Join Date
    Jul 2007
    Location
    United Kingdom
    Search Comp PM
    Never used LAV before but thanks, I'll give that a try.

    Just to be clear, you're suggesting to load this script:

    Load_Stdcall_Plugin("C:\Program Files (x86)\AviSynth 2.5\plugins\yadif.dll")
    directshowsource("split-006.mkv")
    AssumeFPS(30000,1001)
    AssumeTFF()
    Yadif(mode=1, order=1)
    Spline64Resize(720,480)
    SeparateFields()
    SelectEvery(4,0,3)
    Weave()
    ColorMatrix(mode="Rec.709->Rec.601", clamp=0)
    ConvertToYUY2()
    Into VDub and outputting as a lossless AVI, then just encoding that lossless AVI with HCEnc? Because I tried encoding straight through HC but using the lossless intermediate file option and there were no frame mismatch errors but the output was still that bad mix of interlaced and progressive frames.

    EDIT: Lossless output from Vdub is the same.
    Last edited by Killer3737; 28th Apr 2012 at 08:43.
    Quote Quote  
  27. I don' t know then - must be some problems with your directshow system if the AVI shows the problems. Use graphstudio and render the mkv, make sure you are using lav, not some other splitter

    Exactly what do you mean by: "bad mix of interlaced and progressive frames?"

    When I didn't use the AVI, there were field swaps and misordered frames so you get a jerky motion effect in the encoded file (perhaps because of the mismatches from HCEnc from using directshow between the passes)
    Quote Quote  
  28. aBigMeanie aedipuss's Avatar
    Join Date
    Oct 2005
    Location
    666th portal
    Search Comp PM
    jag and pdr are you guys using a 32bit o.s.? the OP and i are 64bit win7. maybe difference in results?
    --
    "a lot of people are better dead" - prisoner KSC2-303
    Quote Quote  
  29. I'm running 64 bit Win7 but I'm using 32 bit AviSynth. Keep in mind that the 32 bit and 64 bit subsystems are completely separate in 64 bit windows. You need all 32 bit components to when using any 32 bit component; you need all 64 bit components when using any 64 bit component. So since I was using 32 bit AviSynth I was also using 32 bit LAV filters, 32 bit x264, and/or 32 bit VirtualDub.
    Quote Quote  
  30. ^What jagabo said.

    But there are 64bit builds of avisynth, but everything in the chain has to be 64-bit. This includes all the filters in the script like yadif, colormatrix etc... There is only a fraction of filters that are available in native 64-bit. Also 64bit avisynth is not the most stable. 32bit avisynth is the most consistent and stable with access to all the filters
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!