VideoHelp Forum
+ Reply to Thread
Page 2 of 2
FirstFirst 1 2
Results 31 to 51 of 51
Thread
  1. Captures & Restoration lollo's Avatar
    Join Date
    Jul 2018
    Location
    Italy
    Search Comp PM
    used format supports is generally an avi container with lossless codec; in my case (HuffYUV), not even the DAR flag is respected
    Quote Quote  
  2. Your choice,...
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  3. Formerly 'vaporeon800' Brad's Avatar
    Join Date
    Apr 2001
    Location
    Vancouver, Canada
    Search PM
    Originally Posted by dellsam34 View Post
    Originally Posted by Brad View Post
    Technically, your script should include ColorMatrix(mode="Rec.601->Rec.709") or your ffmpeg command-line should do this conversion. Currently you're starting with 601 and then telling x264 that it's 709.
    The resized file is still lossless AVI, the conversion to rec.709 is only needed when encoding to h.264 which I believe the ffmpeg commend does convert to 709, Doesn't it?
    Two points:
    1. When uploading your lossless AVI to YouTube, it's going to assume based on its "HD" frame dimensions that it's Rec.709, and thus the colors will be somewhat wrong if you don't do the color matrix conversion step.
    2. Your ffmpeg command is only telling x264 to add tags stating that the file is Rec.709 -- which it isn't, unless you add a separate color matrix conversion step (either Avisynth or extra ffmpeg commands).
    My YouTube channel with little clips: vhs-decode, comparing TBC, etc.
    Quote Quote  
  4. Capturing Memories dellsam34's Avatar
    Join Date
    Jan 2016
    Location
    Member Since 2005, Re-joined in 2016
    Search PM
    I do during outputting the HD file using vdub2 output in the format tab as shown, I just couldn't see any difference at all with or without conversion, What are we looking at in terms of differences? Could you show us some differences using the lossless sample provided that left unchanged?
    Image Attached Thumbnails Click image for larger version

Name:	output.png
Views:	37
Size:	29.5 KB
ID:	65085  

    Image Attached Files
    Quote Quote  
  5. Captures & Restoration lollo's Avatar
    Join Date
    Jul 2018
    Location
    Italy
    Search Comp PM
    Code:
    video_org=aviSource("TV Commercial.avi")
    
    ### upscale without change color matrix
    upscaled=video_org.nnedi3_rpow2(rfactor=2, nns=4, qual=2, cshift="Spline36Resize", fwidth=1440, fheight=1080)
    
    ### upscale with change color matrix
    upscaled_cm=video_org.Colormatrix("Rec.601->Rec.709").nnedi3_rpow2(rfactor=2, nns=4, qual=2, cshift="Spline36Resize", fwidth=1440, fheight=1080)
    
    f_Subtract_Compare(upscaled,upscaled_cm,"upscaled","upscaled_cm")
    
    
    function f_Subtract_Compare(clip c1, clip c2, string t1, string t2)
    {
    c3=Subtract(c1, c2).Levels(65, 1, 255-64, 0, 255, coring=false)
    c4=Compare(c1, c2)
    
    stackvertical(\
    stackhorizontal(\
    subtitle(c1,t1,size=20,align=2),\
    subtitle(c2,t2,size=20,align=2)\
    ),\
    stackhorizontal(\
    subtitle(c3,"subtract"+" "+t1+" "+t2,size=20,align=2),\
    subtitle(c4,"compare"+" "+t1+" "+t2,size=20,align=2)\
    )\
    )
    }
    Image
    [Attachment 65089 - Click to enlarge]
    Quote Quote  
  6. Capturing Memories dellsam34's Avatar
    Join Date
    Jan 2016
    Location
    Member Since 2005, Re-joined in 2016
    Search PM
    Exactly. I don't think SD analog formats even the pro ones have enough rich data that can be unleashed when converting to 709 besides just upscaling to HD, There is nothing there to begin with. I do keep converting it to 709 though in vdub2 during output from avspmod, just for the sake of being politically correct.
    Quote Quote  
  7. Captures & Restoration lollo's Avatar
    Join Date
    Jul 2018
    Location
    Italy
    Search Comp PM
    The sample you provided is almost all gray/white; where there are colors there is a difference!

    When working with HuffYUV videos having no tags on color format, a Colormatrix("Rec.601->Rec.709") is suitable before upscaling.
    Quote Quote  
  8. Capturing Memories dellsam34's Avatar
    Join Date
    Jan 2016
    Location
    Member Since 2005, Re-joined in 2016
    Search PM
    I wouldn't call that a difference but oh well, I like to compare things with my own eyes.
    Quote Quote  
  9. Originally Posted by dellsam34 View Post
    the conversion to rec.709 is only needed when encoding to h.264 which I believe the ffmpeg commend does convert to 709, Doesn't it?
    If you're talking about the command in post #5
    Originally Posted by dellsam34 View Post
    Encoding:
    Code:
    ffmpeg -i Input.avi -vf setsar=sar=1/1 -c:v libx264 -crf 18 -x264opts colorprim=bt709:transfer=bt709:colormatrix=bt709:force-cfr -c:a aac -b:a 192k -movflags +faststart Output.mp4
    That does not convert the video from rec.601 to rec.709 colors. It only flags the video as rec.709. The colors remain whatever they were on input. That is doubly a mistake with rec.601 video, almost guarantying the wrong colors at playback. Players that assume HD is rec.709 will play with the wrong colors. And players that follow the flagged colormatrix will also play with the wrong colors. To convert you need to add colormatrix=bt601:bt709 to the -vf section.
    Last edited by jagabo; 31st May 2022 at 23:39.
    Quote Quote  
  10. Originally Posted by dellsam34 View Post
    I wouldn't call that a difference but oh well, I like to compare things with my own eyes.
    Image
    [Attachment 65130 - Click to enlarge]


    See the difference now?
    Quote Quote  
  11. Capturing Memories dellsam34's Avatar
    Join Date
    Jan 2016
    Location
    Member Since 2005, Re-joined in 2016
    Search PM
    Again, I do convert using vdub2 -see post #34, I just don't see a huge difference in my own videos, In other words I don't think it's that important as originally shot HD videos.
    Quote Quote  
  12. So nice things can be done with Hybrid I love..

    I testing
    Filtering->Vapoursynth->DeBlock->Deblock_QED, and
    Filtering->Vapoursynth->DeGrain->TemporalDeGrain

    and Add grain.

    Still my file is from pioneer dvr560 but this time is direct from hdd and was recorded in XP+ mode ~ 15Mb/s bitrate.
    Image Attached Thumbnails Click image for larger version

Name:	Zrzut ekranu z 2022-06-10 23-23-04.png
Views:	241
Size:	4.24 MB
ID:	65326  

    Quote Quote  
  13. Captures & Restoration lollo's Avatar
    Join Date
    Jul 2018
    Location
    Italy
    Search Comp PM
    Sure! Deblock_QED and TemporalDegrain are 2 excellent filters

    Be careful to do not overdo and create plastic looks.
    Quote Quote  
  14. So, is there a correct method to convert colormatrix from 601 to 709 using filters in VirtualDub2 only? Suppose my workflow starts from SD and ends with upscaled HD. I googled around, ten-year old answers say that VDub works with 601 only. Will the setting in dellsam34's post convert to selected format (601 or 709), or will it only flag it as the selected format? There is a similar question from 8 years ago; the author self-answered showing "convert format" filter. Is this the correct approach?
    Quote Quote  
  15. Capturing Memories dellsam34's Avatar
    Join Date
    Jan 2016
    Location
    Member Since 2005, Re-joined in 2016
    Search PM
    Vdub2 has the capability to convert 601 to 709 but without flagging, The script I posted only sets the 709 flag. because having 709 without flag may not let some TV's, media players or software to properly display values especially when sharing or delivering the contents to other people, so you want to make sure it's properly converted and the flag is there. What we've discussed above is whether there is a big difference or not for consumer sources, And the members stated there is.
    Quote Quote  
  16. Member
    Join Date
    Aug 2018
    Location
    Wrocław
    Search PM
    Originally Posted by prodarek View Post
    Hello,
    I am trying my hand but to no avail.. someone can show me how should look property cutting and upscaling? I will be very grateful
    1. Check the REAL color range in your file.
    There is no color range information (Full or Limited) in your file. So my bet is that, similar to my Panasonic DVD-Recorder, it is 16-254.

    2. This is my ffmpeg command line:
    ffmpeg.exe -i in.mpg -vf "scale=in_range=full:out_range=full,lut='y=(va l-16)*1.067',yadif=1,crop=702:564:6:2" -c:v libx264 -crf 17 -colorspace:v "bt709" -color_primaries:v "bt709" -color_trc:v "bt709" -color_range 2 -c:a aac -b:a 256k "out (full range+recode+yadif).mp4"


    Filtry po kolei:
    • scale=in_range=full:out_range=full -- information that it is a full range to full range conversion
    • lut='y=(val-16)*1.067' -- brightness conversion from 16-254 to 0-254 (this nicely increases the contrast and the VHS gray becomes blacker)
    • yadif=1 -- deinterlace from 25fps interlaced to 50fps progressive (yadif also decently removes mpg blocks)
    • crop=702:564:6:2 - removing edge distortions - the values must be manually selected (out_w:out_h:x:y)
    • -colorspace:v "bt709" -color_primaries:v "bt709" -color_trc:v "bt709" -color_range 2 -- encoding in the bt.709

    I don't see any sense in upscaling if you don't do some image manipulation (sharpening, denoising etc). But of course you can, but you need to take care of the correct size conversion to get a 1: 1 pixel.

    Edit: adding the "-t 10" parameter will only convert the first 10 seconds - useful for testing.
    Last edited by rgr; 12th Jun 2022 at 17:31.
    Quote Quote  
  17. Hi, Cropping an image causes stretching, if I want to keep the correct aspect ratio, what are my options?
    I read about crop and add border there is more options?
    Quote Quote  
  18. Member
    Join Date
    Aug 2018
    Location
    Wrocław
    Search PM
    Originally Posted by prodarek View Post
    Hi, Cropping an image causes stretching, if I want to keep the correct aspect ratio, what are my options?
    I read about crop and add border there is more options?
    It shouldn't have happened.
    What does the output of ffmpeg look like (especially what's in bold and underlined)?


    Input #0, mpeg, from '1-audio.mpg':
    Duration: 02:04:04.35, start: 0.237711, bitrate: 4691 kb/s
    Stream #0:0[0x1bf]: Data: dvd_nav_packet
    Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, bt470bg, top first), 720x576 [SAR 16:15 DAR 4:3], 25 fps, 25 tbr, 90k tbn

    Output #0, mp4, to 'd:\1-audio (full range+recode+yadif).mp4':
    Stream #0:0: Video: h264 (avc1 / 0x31637661), yuv420p(pc, bt470bg, progressive), 702x564 [SAR 16:15 DAR 312:235], q=2-31, 50 fps, 12800 tbn
    Quote Quote  
  19. Hi there, 1st of all sorry to revive this old 3ad...
    Originally Posted by rgr View Post
    2. This is my ffmpeg command line:
    ffmpeg.exe -i in.mpg -vf "scale=in_range=fullut_range=full,lut='y=(val-16)*1.067',yadif=1,crop=702:564:6:2" -c:v libx264 -crf 17 -colorspace:v "bt709" -color_primaries:v "bt709" -color_trc:v "bt709" -color_range 2 -c:a aac -b:a 256k "out (full range+recode+yadif).mp4"


    Filtry po kolei:
    • scale=in_range=fullut_range=full -- information that it is a full range to full range conversion
    • lut='y=(val-16)*1.067' -- brightness conversion from 16-254 to 0-254 (this nicely increases the contrast and the VHS gray becomes blacker)
    • yadif=1 -- deinterlace from 25fps interlaced to 50fps progressive (yadif also decently removes mpg blocks)
    • crop=702:564:6:2 - removing edge distortions - the values must be manually selected (out_wut_h:y)
    • -colorspace:v "bt709" -color_primaries:v "bt709" -color_trc:v "bt709" -color_range 2 -- encoding in the bt.709
    Very interesting, thanks.

    We have found this interesting git that warns about some common "issues" about digitized SD content:
    Chromaticities
    The chromaticities of NTSC and PAL are different, although both follow the ITU BT.601 standard. It is crucial to get them right, otherwise you will get skewed colors. This applies to both encoding and decoding. When decoding, you may need to override these properties if they are missing or incorrect. When encoding, you must explicitly save each of these properties in the video container, otherwise decoders will try to guess them, and that fails badly if the video is resized and/or deinterlaced with frame bobbing (doubling).

    |Standard|Matrix|Primaries|Transfer|
    |BT.601 PAL|BT.470BG|BT.470BG|BT.709
    |BT.601 NTSC|SMPTE 170M|SMPTE 170M|BT.709
    |BT.601 NTSC (old)|BT.470M|BT.470M|BT.709
    Since we're trying to squeeze out the best possible quality from FFMPEG's capture function, we wonder if - as many conversion discussions reports - sws_flags parameters can help in any way:
    Originally Posted by gdgsdg12
    Always add +accurate_rnd+full_chroma_int to sws_flags (by -sws_flags +accurate_rnd+full_chroma_int or sws_flags=+accurate_rnd+full_chroma_int in filtergraphs, or both), unless speed is prefered over quality.
    source: https://trac.ffmpeg.org/ticket/1582#comment:15
    Another interesting - and funny - (re)source about this: https://kohana.fi/article/color-conversion-issues-with-ffmpeg

    Thanks in advance to anyone that will help.
    Quote Quote  
  20. Member
    Join Date
    Aug 2018
    Location
    Wrocław
    Search PM
    Originally Posted by forart.it View Post
    Hi there, 1st of all sorry to revive this old 3ad...
    Originally Posted by rgr View Post
    2. This is my ffmpeg command line:
    ffmpeg.exe -i in.mpg -vf "scale=in_range=full:out_range=full,lut='y=(va l-16)*1.067',yadif=1,crop=702:564:6:2" -c:v libx264 -crf 17 -colorspace:v "bt709" -color_primaries:v "bt709" -color_trc:v "bt709" -color_range 2 -c:a aac -b:a 256k "out (full range+recode+yadif).mp4"


    Filtry po kolei:
    • scale=in_range=full:out_range=full -- information that it is a full range to full range conversion
    • lut='y=(val-16)*1.067' -- brightness conversion from 16-254 to 0-254 (this nicely increases the contrast and the VHS gray becomes blacker)
    • yadif=1 -- deinterlace from 25fps interlaced to 50fps progressive (yadif also decently removes mpg blocks)
    • crop=702:564:6:2 - removing edge distortions - the values must be manually selected (out_w:out_h:x:y)
    • -colorspace:v "bt709" -color_primaries:v "bt709" -color_trc:v "bt709" -color_range 2 -- encoding in the bt.709
    Very interesting, thanks.
    In the filter, I forgot to add at the end (after crop=702:564:6:2)
    ,scale=in_color_matrix=bt601:out_color_matrix=bt70 9

    But it would be better to leave BT.601 rather (deleting: -colorspace:v "bt709" -color_primaries:v "bt709" -color_trc:v "bt709")
    Quote Quote  
  21. Originally Posted by rgr View Post
    In the filter, I forgot to add at the end (after crop=702:564:6:2)
    ,scale=in_color_matrix=bt601ut_color_matrix=bt709

    But it would be better to leave BT.601 rather (deleting: -colorspace:v "bt709" -color_primaries:v "bt709" -color_trc:v "bt709")
    Interesting, so don't you think that color shifting applied in the capture stage (in our case BT.601 PAL -> [BT.470BG / BT.470BG] -> BT.709) is useful at all ?

    More: do you think is possible to apply those chroma fixes using FFMPEG ?

    Our actual FFMPEG (ffplay-test) capture commandline:
    Code:
    ffplay -rtbufsize 1G -pixel_format uyvy422 -framerate 25 -f dshow -i video="Decklink Video Capture":audio="Decklink Audio Capture" -aspect 4:3 -vf "scale=in_range=full:out_range=full,lut='y=(va l-16)*1.067',bwdif=mode=send_field:parity=auto:deint=all"
    note: according to many "experienced users" bwdif outperforms yadif in many scenarios...
    Last edited by forart.it; 2nd Mar 2023 at 04:25.
    Quote Quote  



Similar Threads

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