VideoHelp Forum


Try DVDFab Video Downloader and rip Netflix video! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 5 of 5
Thread
  1. Hi everyone,

    I've just completed capturing and converting over 50 8mm analog home video tapes using AviSynth thanks to the help from these forums, so thanks again to all who have taken the time to comment on my previous posts!

    My process was to capture using HuffYUV, deinterlace with QTGMC along with minor corrections and adding titles in AviSynth. Ultimately creating an x264/MP4 file for storing on a hard drive and playing on a TV, along with an intermediate deinterlaced ProRes/MOV file for possible future editing, since my main computer is a Mac.

    My next set of video tapes is from a Sony Digital8 camcorder, so source files will be DV format. Many years ago, I already transferred a number of these tapes, and depending on how I did it back then, I have files that are either a .mov extension or .dv extension - did it on a Mac so none are .avi.

    I would like to try to use the same general process, using AviSynth for QTGMC, crop/add borders, and title my clips, but I am a little confused on the things I need to change to get this working correctly for DV files with regards to colorspaces and conversion scripts once I have my AviSynth script done.

    1. FFVideoSource or FFMPEGSource2?: I've got the DV files opening in AviSynth with FFVideoSource. Any issues with that so far? It seems to work although it does seem very slow the first time I open the video (60 seconds spinning blue circle) - after that it's not slow. I use AVSPmod as my script editor with the built in preview window. Do I need atrack=1 here? What's the difference between FFVideoSource and FFMPEGSource2?

    Here is my baseline script:

    Code:
    SetFilterMTMode("QTGMC", 2)           
    FFVideoSource("sampleDVfile.dv")       #do I need atrack=1 ?
    Trim(10,5000)                       
    ConvertToYV12(interlaced=true)        #colorspace needed for certain filters - do not convert to YV12 for prores! (unless filter needs it, then convert back to YUY2)
    #AssumeTFF()  #not for DV
    QTGMC(Preset="slower", Edithreads=2, Sharpness=0.8)    
    ColorYUV(gain_y=3, off_y=-6, cont_y=0, cont_u=0, cont_v=0, gamma_y=5)   
    Crop(8,0,-16,-8).AddBorders(12,2,12,6)  
    BilinearResize(640,height)   
    
    /* generate intro */
    intro = BlankClip(last, length=300)    
    intro = intro.Subtitle("DV Test\n" + \ 
                                                     "\n" + \
                                    "Line 2\n" + \
                                    "Line 3", \
                                    lsp=30, font="Cambria", size=35, text_color=$FFFFFF, spc=10, x=-1, y=175) 
                                    
    intro.fadeio0(30)++last.fadeio0(30)      
    
    #Turnright.Histogram.Turnleft()      
    
    PreFetch(4)
    2. ConverttoYV12: My baseline script above from when working with YUY2 videos seems to work for DV without changing much, aside from using FFVideoSource, removing AssumeTFF and adding ConverttoYV12. I had ConverttoYV12 commented out in my original script in case any filters needed it but none that I was using ever did. I thought DV files were already YV12 but it seems that I need ConverttoYV12 in order for QTGMC to work. Without it, I get the following error: "MVTools: no BLITCHROMA function for block size 4x16." Converting to YV12 (interlaced=true) works, but I don't understand why. I have a note to myself as well, if I have to convert to YV12 for a filter and I'm going to ProRes, I should convert back to YUY2 at the end of the script. Which leads me to #3...

    3. Running the script and converting: With my YUY2 AVI sources, I was running the following batch command to convert to ProRes. I assume with DV, I should stay in DV for intermediate files? Or.. am I just losing quality if I save my deinterlaced DV files as DV? It also doesn't seem correct to go from DV to ProRes, but should I..??? Either way, I need some guidance on if I need to change anything when working with DV source files, and some guidance on what format is appropriate for an intermediate editing copy for future. (And do I need to convert to YUY2 in AviSynth script before running this?)

    Code:
    for %%a in ("*.avs") do (
    	"C:\Program Files\ffmpeg64\bin\ffmpeg.exe" -i "%%a" ^
       	 -c:v prores ^
    	 -profile:v 2 ^
    	 -c:a copy ^
      	  "C:\Users\user\Videos\Exports - Editing - ProRes MOV\%%~na_pro.mov" )
    pause
    4. Converting to the MP4 file: This was the script I was using to convert my ProRes files to H264/MP4. I was running this on a Mac in terminal, just to free up the Windows computer in my "assembly line" of conversions. Based on the answer to #3 above, I am wondering if there is anything I need to change here. (If answer to #3 is ProRes for intermediate, then I assume it's fine, but if it's DV/MOV, does anything need to change?

    Code:
    for f in *.mov;do ffmpeg -i "$f" -c:v libx264 -preset slow -crf 14 -g 50 -movflags +faststart -pix_fmt yuv420p -profile:v high -level:v 3.1 -colorspace smpte170m -color_range tv -acodec aac -b:a 256000 "${f%mov}mp4";done
    5. Or AviSynth -> MP4? Last question, if answer to #3 for intermediate file is DV, but it's better to go from my AVISynth script -> MP4 without lossy intermediate step between, what would need to change in this batch script to allow for DV source, if anything?

    Code:
    for %%a in ("*.avs") do (
    	"C:\Program Files\ffmpeg64\bin\ffmpeg.exe" -i "%%a" ^
    	-c:v libx264 -preset slow -crf 14 -g 50 ^
    	-movflags +faststart ^
    	-pix_fmt yuv420p -profile:v high -level:v 3.1 -colorspace smpte170m -color_range tv ^
    	-acodec aac -b:a 256000 ^
    	"C:\Users\user\Videos\Exports - Delivery - H264 MP4\%%~na.mp4" )
    pause
    Thank you!
    Last edited by Christina; 28th Feb 2021 at 19:56. Reason: Added FFMPEGSource2 question to #1
    Quote Quote  
  2. Originally Posted by Christina View Post
    It seems to work although it does seem very slow the first time I open the video (60 seconds spinning blue circle) - after that it's not slow. I use AVSPmod as my script editor with the built in preview window. Do I need atrack=1 here? What's the difference between FFVideoSource and FFMPEGSource2?
    The 1st time is to index the file, so it's slower. Normal and expected.

    FFMPEGSource2() is a wrapper function that includes audio. It's basically FFVideoSource+FFAudioSource.



    My baseline script above from when working with YUY2 videos seems to work for DV without changing much, aside from using FFVideoSource, removing AssumeTFF and adding ConverttoYV12. I had ConverttoYV12 commented out in my original script in case any filters needed it but none that I was using ever did. I thought DV files were already YV12 but it seems that I need ConverttoYV12 in order for QTGMC to work. Without it, I get the following error: "MVTools: no BLITCHROMA function for block size 4x16." Converting to YV12 (interlaced=true) works, but I don't understand why.
    NTSC DV has 4:1:1 chroma subsampling. FFVideoSource returns the original colorspace . You can decide on which algorithm to upsample the chroma. Default is "bicubic" in avisynth




    3. Running the script and converting: With my YUY2 AVI sources, I was running the following batch command to convert to ProRes. I assume with DV, I should stay in DV for intermediate files? Or.. am I just losing quality if I save my deinterlaced DV files as DV? It also doesn't seem correct to go from DV to ProRes, but should I..??? Either way, I need some guidance on if I need to change anything when working with DV source files, and some guidance on what format is appropriate for an intermediate editing copy for future. (And do I need to convert to YUY2 in AviSynth script before running this?)
    Anytime you decode something (that includes any usage of avisynth), it becomes uncompressed video. If you re-encode with a lossy format, such as DV or Prores, you incur generation losses. DV decoded then re-encoded DV, is more lossy than DV to Prores .

    If you're not doing any processing or using avisynth anything, just keep the original DV (actually just keep the original DV anyways as archival)



    4. Converting to the MP4 file: This was the script I was using to convert my ProRes files to H264/MP4. I was running this on a Mac in terminal, just to free up the Windows computer in my "assembly line" of conversions. Based on the answer to #3 above, I am wondering if there is anything I need to change here. (If answer to #3 is ProRes for intermediate, then I assume it's fine, but if it's DV/MOV, does anything need to change?
    If that was a previous conversion to prores (from a previous avs script that already deinterlaced and resized to square pixel equivalents) , it looks ok

    If it's DV input , you'd either need to encode interlaced and flag the AR, or resize to square pixel equivalent (or flag) after deinterlacing.
    Quote Quote  
  3. Originally Posted by poisondeathray View Post
    You can decide on which algorithm to upsample the chroma. Default is "bicubic" in avisynth
    Thanks! I think I'm clear on everything except the above statement. QTGMC wouldn't work until I added ConverttoYV12. Are you saying there is a different option I could use instead of YV12? Or that I should be converting back to something else afterwards? I don't understand what "upsample the chroma" means.


    Anytime you decode something (that includes any usage of avisynth), it becomes uncompressed video. If you re-encode with a lossy format, such as DV or Prores, you incur generation losses. DV decoded then re-encoded DV, is more lossy than DV to Prores .

    If you're not doing any processing or using avisynth anything, just keep the original DV (actually just keep the original DV anyways as archival)
    I am using AviSynth to deinterlace, add titles, crop/add borders, and convert to square pixels, so I don't think there's any way around it. But this makes sense now. Thanks.
    Quote Quote  
  4. Originally Posted by Christina View Post
    Originally Posted by poisondeathray View Post
    You can decide on which algorithm to upsample the chroma. Default is "bicubic" in avisynth
    Thanks! I think I'm clear on everything except the above statement. QTGMC wouldn't work until I added ConverttoYV12. Are you saying there is a different option I could use instead of YV12? Or that I should be converting back to something else afterwards? I don't understand what "upsample the chroma" means.



    4:1:1 means 1/4 width color samples

    720x480 of Y information would have 180x480 pixels of CbCr color information

    "Up or downsampling" the chroma means essentially means "resizing" the chroma planes. Converting to RGB (e.g. for display) is also called "upsampling the chroma" , because RGB has full color samples

    QTGMC does not work with 4:1:1. ConvertToYV12(interlaced=true) means you resample the chroma planes to 1/2 width, 1/2 height or 360x240 in an interlace aware manner. This is certainly more than enough chroma resolution for a NTSC source

    But if you were going to prores std or hq, they are 4:2:2 - so it would be better to use YV16 which is 4:2:2 planar or 360x480 for the chroma planes. It saves you resampling twice. Resampling is not lossless operation, unless you use nearest neighbor (duplicating and dropping pixels in powers of 2)

    Different resampling algorithms produce different results. Some are sharper, some are more blurry. Often "nearest neighbor" is used for speed in applications but this produces "blocky" color samples. Sometimes it's wanted, sometimes it's not (e.g. it might be wanted in some keying workflows, or ones where you have multiple stages of up/downsampling the chroma). The point is when you start with the original colorspace, this gives you control over how the color is up or downsampled

    For example look at the tests in this thread linked below . The "blockiness" is depending on what chroma resampling algorithm is used to up/downsampled
    https://forum.videohelp.com/threads/390949-Canopus-ADVC-100-has-a-TBC-after-all
    Quote Quote  
  5. [QUOTE=poisondeathray;2612359][QUOTE=Christina;2612350]
    Originally Posted by poisondeathray View Post
    But if you were going to prores std or hq, they are 4:2:2 - so it would be better to use YV16 which is 4:2:2 planar or 360x480 for the chroma planes. It saves you resampling twice. Resampling is not lossless operation, unless you use nearest neighbor (duplicating and dropping pixels in powers of 2)
    Ohhh, OK. I see.

    So, if I use QTInput and I'm going to ProRes, which is likely, do I just let it use the default method of upsampling to 4:2:2 and don't do any conversions? Or is there a way to force QTInput to open the file in its original format and then use ConverttoYV16(interlaced=true) afterwards so I know what it's doing?
    Quote Quote  



Similar Threads