VideoHelp Forum
+ Reply to Thread
Results 1 to 8 of 8
Thread
  1. I'm using AVISynth and I only just discovered that there was an "Average" option for the YV12 ColorMatrix setting. I love the way the color turns out while using it. The problem is, when using it on an HD MP4 file, I get massive slowdown.

    Is there a way to fix this at all? The temporary solution is just downsizing it to 640 or 720. I understand if this filter just can't handle HD video at all.
    Quote Quote  
  2. Groucho2004
    Guest
    Originally Posted by smike View Post
    I'm using AVISynth and I only just discovered that there was an "Average" option for the YV12 ColorMatrix setting.
    The Colormatrix plugin does not have that parameter.
    Quote Quote  
  3. If smike means to say ConvertToYV12(matrix="average")...

    There's normally no speed difference between color matrices, but looking into the source code,
    I was a little surprised to see that calling ConvertToYV12 with no arguments invokes a faster routine:
    Code:
    http://avisynth2.cvs.sourceforge.net/viewvc/avisynth2/avisynth/src/convert/convert.cpp...ew=markup#l307
    
    AVSValue __cdecl ConvertToYV12::Create(AVSValue args, void*, IScriptEnvironment* env)
    {
      PClip clip = args[0].AsClip();
      const VideoInfo& vi = clip->GetVideoInfo();
    
      if (vi.IsYUY2() && !args[3].Defined() && !args[4].Defined() && !args[5].Defined())  // User has not requested options, do it fast!
        return new ConvertToYV12(clip,args[1].AsBool(false),env);
    
      return ConvertToPlanarGeneric::CreateYV12(args,0,env);
    }
    ...so any matrix argument will slow down the conversion, not only "average."
    But not by very much, or someone would have complained before now eh?

    I haven't noticed a "massive slowdown."
    Last edited by raffriff42; 11th Nov 2016 at 06:29. Reason: 'looking into the source code'
    Quote Quote  
  4. Groucho2004
    Guest
    Originally Posted by raffriff42 View Post
    If smike means to say ConvertToYV12(matrix="average")...

    There's normally no speed difference between color matrices, but calling ConvertToYV12 with no arguments invokes a faster routine:
    Code:
    http://avisynth2.cvs.sourceforge.net/viewvc/avisynth2/avisynth/src/convert/convert.cpp...ew=markup#l307
    
    AVSValue __cdecl ConvertToYV12::Create(AVSValue args, void*, IScriptEnvironment* env)
    {
      PClip clip = args[0].AsClip();
      const VideoInfo& vi = clip->GetVideoInfo();
    
      if (vi.IsYUY2() && !args[3].Defined() && !args[4].Defined() && !args[5].Defined())  // User has not requested options, do it fast!
        return new ConvertToYV12(clip,args[1].AsBool(false),env);
    
      return ConvertToPlanarGeneric::CreateYV12(args,0,env);
    }
    ...so any matrix argument will slow down the conversion, not only "average."
    But not by very much, or someone would have complained before now eh?

    I haven't noticed a "massive slowdown."
    Did some testing with AVSMeter:

    Script:
    Code:
    colorbars(width = 1920, height = 1080, pixel_type = "rgb32").killaudio().assumefps(25, 1).trim(0, 1999)
    
    #converttoyv12()
    #or
    #converttoyv12(matrix = "average")
    "ConvertToYV12" without any args:
    Code:
    [Runtime info]
    Frames processed:               2000 (0 - 1999)
    FPS (min | max | average):      122.2 | 128.0 | 127.2
    Memory usage (phys | virt):     402 | 400 MiB
    Thread count:                   1
    CPU usage (average):            25%
    ConvertToYV12(matrix = "average"):
    Code:
    [Runtime info]
    Frames processed:               2000 (0 - 1999)
    FPS (min | max | average):      122.3 | 128.0 | 127.3
    Memory usage (phys | virt):     402 | 400 MiB
    Thread count:                   1
    CPU usage (average):            25%
    Using different source colour spaces also did not reveal any difference in speed.
    Quote Quote  
  5. My mistake, It's "ConvertToYV12" Matrix. Going back through my script, the slowdown comes from using that, in conbination with a ConvertToRGB Matrix setting.



    Like I said, I like the picture it produces, but I don't think that those two options together can handle an HD MP4.



    Originally Posted by Groucho2004 View Post
    Originally Posted by raffriff42 View Post
    If smike means to say ConvertToYV12(matrix="average")...

    There's normally no speed difference between color matrices, but calling ConvertToYV12 with no arguments invokes a faster routine:
    Code:
    http://avisynth2.cvs.sourceforge.net/viewvc/avisynth2/avisynth/src/convert/convert.cpp...ew=markup#l307
    
    AVSValue __cdecl ConvertToYV12::Create(AVSValue args, void*, IScriptEnvironment* env)
    {
      PClip clip = args[0].AsClip();
      const VideoInfo& vi = clip->GetVideoInfo();
    
      if (vi.IsYUY2() && !args[3].Defined() && !args[4].Defined() && !args[5].Defined())  // User has not requested options, do it fast!
        return new ConvertToYV12(clip,args[1].AsBool(false),env);
    
      return ConvertToPlanarGeneric::CreateYV12(args,0,env);
    }
    ...so any matrix argument will slow down the conversion, not only "average."
    But not by very much, or someone would have complained before now eh?

    I haven't noticed a "massive slowdown."
    Did some testing with AVSMeter:

    Script:
    Code:
    colorbars(width = 1920, height = 1080, pixel_type = "rgb32").killaudio().assumefps(25, 1).trim(0, 1999)
    
    #converttoyv12()
    #or
    #converttoyv12(matrix = "average")
    "ConvertToYV12" without any args:
    Code:
    [Runtime info]
    Frames processed:               2000 (0 - 1999)
    FPS (min | max | average):      122.2 | 128.0 | 127.2
    Memory usage (phys | virt):     402 | 400 MiB
    Thread count:                   1
    CPU usage (average):            25%
    ConvertToYV12(matrix = "average"):
    Code:
    [Runtime info]
    Frames processed:               2000 (0 - 1999)
    FPS (min | max | average):      122.3 | 128.0 | 127.3
    Memory usage (phys | virt):     402 | 400 MiB
    Thread count:                   1
    CPU usage (average):            25%
    Using different source colour spaces also did not reveal any difference in speed.
    Quote Quote  
  6. Originally Posted by smike View Post
    My mistake, It's "ConvertToYV12" Matrix. Going back through my script, the slowdown comes from using that, in conbination with a ConvertToRGB Matrix setting.



    Like I said, I like the picture it produces, but I don't think that those two options together can handle an HD MP4.

    Post your full script, and information about your source file (e.g. mediainfo view=>text)
    Quote Quote  
  7. Script


    LoadPlugin("C:\Users\#####\Documents\#####\ffms2.d ll")
    Import("C:\Program Files (x86)\AviSynth\plugins\FFMS2.avsi")
    AudioDub(FFAudioSource("TOSP.mp4"),FFVideoSource(" TOSP.mp4",threads=1))


    #SincResize(640,480)
    ConvertToRGB(matrix="PC.709")
    ConvertToYV12(matrix="AVERAGE")

    MediaInfo

    General
    Complete name TOSP.mp4
    Format : MPEG-4
    Format profile : Base Media / Version 2
    Codec ID : mp42
    File size : 818 MiB
    Duration : 24mn 15s
    Overall bit rate mode : Variable
    Overall bit rate : 4 716 Kbps
    Encoded date : UTC 2016-08-03 08:59:18
    Tagged date : UTC 2016-08-03 08:59:26
    ©TIM : 00:07:20:15
    ©TSC : 25
    ©TSZ : 1

    Video
    ID : 1
    Format : AVC
    Format/Info : Advanced Video Codec
    Format profile : Main@L4.1
    Format settings, CABAC : Yes
    Format settings, ReFrames : 3 frames
    Codec ID : avc1
    Codec ID/Info : Advanced Video Coding
    Duration : 24mn 15s
    Bit rate : 4 372 Kbps
    Width : 1 920 pixels
    Height : 1 080 pixels
    Display aspect ratio : 16:9
    Frame rate mode : Constant
    Frame rate : 25.000 fps
    Standard : PAL
    Color space : YUV
    Chroma subsampling : 4:2:0
    Bit depth : 8 bits
    Scan type : Progressive
    Bits/(Pixel*Frame) : 0.084
    Stream size : 759 MiB (93%)
    Language : English
    Encoded date : UTC 2016-08-03 08:59:18
    Tagged date : UTC 2016-08-03 08:59:18
    Color primaries : BT.709
    Transfer characteristics : BT.709
    Matrix coefficients : BT.709

    Audio
    ID : 2
    Format : AAC
    Format/Info : Advanced Audio Codec
    Format profile : LC
    Codec ID : 40
    Duration : 24mn 15s
    Source duration : 24mn 15s
    Bit rate mode : Variable
    Bit rate : 317 Kbps
    Maximum bit rate : 420 Kbps
    Channel(s) : 2 channels
    Channel positions : Front: L R
    Sampling rate : 48.0 KHz
    Compression mode : Lossy
    Delay relative to video : 40ms
    Stream size : 55.1 MiB (7%)
    Source stream size : 55.1 MiB (7%)
    Language : English
    Encoded date : UTC 2016-08-03 08:59:18
    Tagged date : UTC 2016-08-03 08:59:18
    Quote Quote  
  8. Maybe it makes only a tiny bit of difference here but, for fastest results you're supposed to list the video first when using AudioDub.

    Unless you need the audio, try running your script without it:

    FFVideoSource(" TOSP.mp4",threads=1)
    ConvertToRGB(matrix="PC.709")
    ConvertToYV12(matrix="AVERAGE")


    And it seems silly to me to use ColorMatrix just because you 'like the picture it produces'.
    Quote Quote  



Similar Threads

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