VideoHelp Forum




+ Reply to Thread
Results 1 to 27 of 27
  1. Member
    Join Date
    Nov 2006
    Location
    Washington, USA
    Search Comp PM
    I digitized a VHS tape to a lossless AVI file and want to convert it to H264 using Handbrake. I tried to use virtualdub to figure out whether to determine if my lossless AVI file was BFF or TFF using virtualdub and a avs script using AssumeTFF().Bob() and AssumeBFF().Bob() but honestly I don't see much difference between the two. I guess my old eyes aren't so good. What would be the correct Handbrake detelecine and x264 advanced options for this clip and how would I figure this out myself?
    Image Attached Files
    Quote Quote  
  2. Member
    Join Date
    Mar 2008
    Location
    United States
    Search Comp PM
    The clip is tff, the script method you mentioned works fine, moving one frame forward at a time in vdub
    will be smooth if the field order is correct, but have a back and forth movement if it's wrong.

    In HB, filters tab, set "interlace detection" to off, and "deinterlace" to yadif/bob.

    On the Video tab set frame rate to 59.94/constant
    Quote Quote  
  3. Member
    Join Date
    May 2005
    Location
    Australia-PAL Land
    Search Comp PM
    AVISynth is not needed for determining the field order.

    Just open your file in VDub, set the Deinterlace filter to Yadif and Double Frame Rate, TFF.

    Step through some movement and in the right pane, observe smooth, always forward motion or jumpy forward-back motion. If jumpy, swap to BFF to confirm.

    The vast majority (all, in my case) of tape "captures" are TFF eg VHS. DV "transfers" are normally BFF.
    Quote Quote  
  4. Captures & Restoration lollo's Avatar
    Join Date
    Jul 2018
    Location
    Italy
    Search Comp PM
    There is not need of a useless deinterlace operation (Bob, Yadif, whatever) to understand field order.

    In fact TFF/BFF means top/bottom field first, not frame.

    Just use a simple AviSynth script with AssumeTFF().separateFields() or AssumeBFF().separateFields() and step field by field to check proper motion.

    And while there, you can also check the field architecture (interlaced, telecine, progressive, etc.).
    Quote Quote  
  5. Or once we are in Avisynth, FWIW:
    Code:
    LWLibavVideoSource("your_source")
    converttoYV16(interlaced=true)
    clip=last
    
    frame=clip.subtitle("     frame",size=24).showframenumber(scroll=true,x=55,y=100,size=24).showtime(x=100,y=128,size=18)
    top = clip.AssumeTFF().separatefields().subtitle("     Assuming TFF",size=24).showframenumber(scroll=true,x=55,y=100,size=24).showtime(x=100,y=128,size=18)
    bottom = clip.AssumeBFF().separatefields().subtitle("     Assuming BFF",size=24).showframenumber(scroll=true,x=55,y=100,size=24).showtime(x=100,y=128,size=18)
    SBS=stackhorizontal(top,bottom)
    
    # select the view from above:
    return SBS  # frame or top or bottom or SBS
    Quote Quote  
  6. Member
    Join Date
    May 2005
    Location
    Australia-PAL Land
    Search Comp PM
    Originally Posted by Lollo
    In fact TFF/BFF means top/bottom field first, not frame.
    I'll put you up for the rocket-science award. Maybe the Darwin award, as I never said anything about "F" being "frame".

    Why can't you just accept other's points of view, Lollo?
    Quote Quote  
  7. If someone asks "How should I hammer in a nail with a screwdriver?", should we answer his question or should we show better alternatives?
    Quote Quote  
  8. Captures & Restoration lollo's Avatar
    Join Date
    Jul 2018
    Location
    Italy
    Search Comp PM
    Originally Posted by Alwyn View Post
    I'll put you up for the rocket-science award. Maybe the Darwin award, as I never said anything about "F" being "frame".
    Why can't you just accept other's points of view, Lollo?
    I accept everything, and did not mean you in particular referred to frame. Just telling to OP the proper procedure.

    Originally Posted by Sharc View Post
    Or once we are in Avisynth, FWIW
    Nice! Mine had not the frame number nor the time:
    Code:
    video_org=AviSource("<fileName")
    
    # separate fields tff
    video_org_sep_tff=video_org.AssumeTFF().separateFields()
    
    # separate fields bff
    video_org_sep_bff=video_org.AssumeBFF().separateFields()
    
    # separate fields tff even
    video_org_sep_tff_even=video_org_sep_tff.SelectEven()
    
    # separate fields tff odd
    video_org_sep_tff_odd=video_org_sep_tff.SelectOdd()
    
    	# to check if progressive or interlaced
    return(video_org_sep_tff)
    #return(video_org_sep_bff)
    
    	# to check if TFF or BFF for interlaced segments
    #stackhorizontal(\
    #subtitle(video_org_sep_tff,"video_org_sep_tff",size=28,align=2),\
    #subtitle(video_org_sep_bff,"video_org_sep_bff",size=28,align=2)\
    #)
    
    	# display fields separately
    #stackvertical(\
    #subtitle(video_org_sep_tff_even,"video_org_sep_tff_even",size=28,align=2),\
    #subtitle(video_org_sep_tff_odd,"video_org_sep_tff_odd",size=28,align=2)\
    #)
    
    	# display frames and display fields separately (equivalent to VirtualDub plugin ViewFields)
    #stackhorizontal(\
    #subtitle(video_org,"video_org",size=28,align=2),\
    #stackvertical(\
    #subtitle(video_org_sep_tff_even,"video_org_sep_tff_even",size=28,align=2),\
    #subtitle(video_org_sep_tff_odd,"video_org_sep_tff_odd",size=28,align=2)\
    #)\
    #)
    Quote Quote  
  9. Captures & Restoration lollo's Avatar
    Join Date
    Jul 2018
    Location
    Italy
    Search Comp PM
    Originally Posted by Sharc View Post
    If someone asks "How should I hammer in a nail with a screwdriver?", should we answer his question or should we show better alternatives?
    Quote Quote  
  10. Member
    Join Date
    May 2005
    Location
    Australia-PAL Land
    Search Comp PM
    Originally Posted by Sharc
    If someone asks "How should I hammer in a nail with a screwdriver?"
    They didn't, did they. Completely different scenario. Could you please start up a new topic if you think somebody needs help with hammering in a nail with a screwdriver. Not good netiquette to hijack other's topics.

    Originally Posted by Sharc
    Or once we are in Avisynth, FWIW:
    Are you joking. All the OP wanted was to work out TFF or BFF. I cannot believe something so simple could be made so complicated.

    Originally Posted by Lollo
    And while there, you can also check the field architecture (interlaced, telecine, progressive, etc.).
    All of which can be observed with the Deinterlace filter in VDub.
    Quote Quote  
  11. Captures & Restoration lollo's Avatar
    Join Date
    Jul 2018
    Location
    Italy
    Search Comp PM
    Originally Posted by Alwyn View Post
    Originally Posted by Sharc
    Or once we are in Avisynth, FWIW:
    Originally Posted by Lollo
    And while there, you can also check the field architecture (interlaced, telecine, progressive, etc.).
    All of which can be observed with the Deinterlace filter in VDub.
    This is false and misleading for any reader. Deinterlacing for checking the field architecture may lead to false conclusions, as i showed you many times (just read the old threads, I don’t want to comment any further).
    You insist to use a screwdriver for a nail, fine, but leave us the rigth to give to others the proper procedures without adding your useless comments.
    Quote Quote  
  12. Originally Posted by Alwyn View Post
    Originally Posted by Sharc
    If someone asks "How should I hammer in a nail with a screwdriver?"
    They didn't, did they. Completely different scenario. Could you please start up a new topic if you think somebody needs help with hammering in a nail with a screwdriver. Not good netiquette to hijack other's topics.

    Originally Posted by Sharc
    Or once we are in Avisynth, FWIW:
    Are you joking. All the OP wanted was to work out TFF or BFF. I cannot believe something so simple could be made so complicated.

    Originally Posted by Lollo
    And while there, you can also check the field architecture (interlaced, telecine, progressive, etc.).
    All of which can be observed with the Deinterlace filter in VDub.

    Nowhere was mentioned Avisynth, until you brought it up in your first sentence in post#3. Why? Hammer in place of screwdriver, possibly?
    Nobody critizised your reply in post #3. Why reacting offended when others just proposed a simple Avisynth alternative, a tool which you brought into the discussion? Why did you chime in after davexnet has properly explained the OP's Handbrake question in post#2?
    I don't understand, but we can stop here, skipping your past misinterpretations of field sequences . End of rant.
    Last edited by Sharc; 1st Mar 2025 at 08:13.
    Quote Quote  
  13. Member
    Join Date
    May 2005
    Location
    Australia-PAL Land
    Search Comp PM
    Originally Posted by Sharc
    Nowhere was mentioned Avisynth, until you brought it up in your first sentence in post#3.
    No, read the OP. And post #2.

    Why did you chime in after davexnet has properly explained the OP's Handbrake question in post#2?
    It might become obvious to you when you read and understand the posts, Sharc. Let me help you. The OP said "using VDub". He didn't describe how. So I described how I do it.

    Rant indeed.
    Quote Quote  
  14. Member
    Join Date
    Nov 2006
    Location
    Washington, USA
    Search Comp PM
    Thanks.

    I was originally planning to keep the output as interlaced and I have seen elsewhere this could be done with handbrake by not deinterlacing and specifying advanced options for x264 (i.e. interlace=tff) however I changed my mind and have started to encode using handbrake with the following options:

    Decomb with preset EEDI2 Bob
    All other options off.
    Constant framerate 59.94
    CQ 18
    Encoder preset: Slow
    Encoder tune: Film

    My end goal is to give a DVD to my folks who at this point in their lives aren't up for anything more technology challenging than putting a disk into their Blu-Ray player.

    I have pretty new rig with an I7-13700F and the 1.5 hour clip is still going about 6.5 hours.

    Let me know if something else would make more sense.
    Quote Quote  
  15. Member
    Join Date
    Mar 2008
    Location
    United States
    Search Comp PM
    Originally Posted by johnnyquid View Post
    I was originally planning to keep the output as interlaced
    Should probably have mentioned this in your original post

    Originally Posted by johnnyquid View Post
    My end goal is to give a DVD to my folks
    and this

    For best results encode to DVD straight form your source and keep it interlaced
    Quote Quote  
  16. Originally Posted by johnnyquid View Post
    Let me know if something else would make more sense.
    If you just want to burn an encoded file onto a disc which the (blu-ray) player can hopefully play, make sure that the player supports
    - the medium (type of disc)
    - the file format (video codec, audio codec, and container), for example H.264 (x264) for video (interlaced or double rate deinterlaced progressive, aac for audio, .mp4 or .mkv container.
    Check the player specs or try it.

    If you want to build a compliant Blu-ray disc you need a Blu-ray authoring tool.

    If you really want a true DVD you would need a DVD authoring app like AVStoDVD or DVDStyler which will also create the DVD files structure.
    Or easier use a DVD recorder and live with the quality compromise due to the on-the-fly mpeg2 encode.

    Example for DVDStyler attached.
    Image Attached Files
    Last edited by Sharc; 2nd Mar 2025 at 02:37.
    Quote Quote  
  17. Member
    Join Date
    Nov 2006
    Location
    Washington, USA
    Search Comp PM
    Thanks. I forgot about AVStoDVD. I have used it in the past. I was thinking that MPEG2 output wouldn't provide good enough quality for a DVD size. I do have some shorter videos to convert and high bitrate MPEG2 encoding should work fine. For longer videos, I'll probably make some H264 output disk as well using Handbrake. I did noticed that AVStoDVD assumed that my source was progressive rather than interlaced and the aspect ratio was wrong as well. I think that the AVI container causes that. I also wanted to also crop the video head switching noise at the bottom of the frame. Therefore I had to edit the encoder command parameters at runtime as described below in the AviSynth script I used:

    DirectShowSource("C:\video.avi")
    #
    # VHS tape captures are assumed to be top field first
    AssumeTFF()
    #
    # Letterbox is used to remove the VHS head switching
    # noise at the bottom of the video frame.
    Letterbox(0,6)
    #
    # If using AVStoDVD then on the main screen
    # hit F8 to show advanced project settings.
    # Select "Edit Encoder Command Parameters at runtime".
    # Assuming that the HCENC video encoder is used,
    # at runtime change the HCENC options to have the below:
    # *INTERLACED
    # *TTF
    # *ASPECT 4:3
    #
    # If present, remove *PROGRESSIVE, *BFF, and other *ASPECT from the HCENC options.
    #
    Quote Quote  
  18. Member
    Join Date
    Mar 2008
    Location
    United States
    Search Comp PM
    Originally Posted by johnnyquid View Post
    Therefore I had to edit the encoder command parameters at runtime as described below in the AviSynth script I used:

    <snip>
    #
    An alternative to editing the script and HCenc parameters, you can override some of the properties of the source
    from the main window
    Image Attached Thumbnails Click image for larger version

Name:	a2d.png
Views:	15
Size:	109.4 KB
ID:	85865  

    Quote Quote  
  19. Member
    Join Date
    Nov 2006
    Location
    Washington, USA
    Search Comp PM
    Okay. Now back to trying to get Handbrake to have the correct display aspect ratio.
    Handbrake reports my AVI file which is interlaced 720x480 as having an aspect ratio of 3:2. It should be 4:3 for final display (NTSC SD).
    I set the output container as MP4.
    I set all Handbrake options to off.
    I set the frame rate to same as source.
    I added the following to the encoder options advanced option box:
    interlace=ttfar=10/11

    Mediainfo is reports the output file as progressive with a 3:2 aspect ratio. It seems like I am not entering the advanced options correctly.
    Handbrake is showing what I entered in its log output.
    Quote Quote  
  20. Member
    Join Date
    Mar 2008
    Location
    United States
    Search Comp PM
    Aspect ratio can be set in the GUI/dimensions tab
    Quote Quote  
  21. Can't help you with Handbrake.
    Use this ffmpeg commandline instead:
    Code:
    ffmpeg -y -i "Clip3.avi" -c:a aac -c:v libx264 -preset slow -crf 17 -flags +ilme+ildct -pix_fmt yuv420p -vf "scale=interl=1,crop=704:472:6:0,pad=704:480:-1:-1:color=black,setsar=10/11,setfield=tff,format=pix_fmts=yuv420p" "out.mp4"
    Image Attached Files
    Last edited by Sharc; 2nd Mar 2025 at 13:43. Reason: file attached
    Quote Quote  
  22. Member
    Join Date
    Nov 2006
    Location
    Washington, USA
    Search Comp PM
    Thanks.

    I had started to go with a ffmpeg command line as well. The below is what I came up with before I read your post.
    ffmpeg -y -i Clip3.avi -aspect 4:3 -vf "drawbox=x=0:y=ih-6:w=iw:h=6:color=black:t=fill" -c:a ac3 -b:a 192k -ac 2 -ar 48k -c:v libx264 -preset slow -crf 22 -x264opts interlaced=1 output.mkv

    I will take a look at the filter commands you used to figure how they worked.
    Last edited by johnnyquid; 2nd Mar 2025 at 18:11. Reason: forgot the -aspect 4:3
    Quote Quote  
  23. Member
    Join Date
    May 2005
    Location
    Australia-PAL Land
    Search Comp PM
    Sharc taught us this last year. Handbrake cropping and resizing to square pixels:

    Image
    [Attachment 85880 - Click to enlarge]


    Originally Posted by Johnny
    I have pretty new rig with an I7-13700F and the 1.5 hour clip is still going about 6.5 hours.
    I have a 13770K and by the looks of it, Handbrake's EEDI2 is killing your/our encode speed. Even using the iGPU 770 or the RTX3060, to encode speed doesn't change, at an appallingly-low ~8fps. Yadif Bob is almost instantaneous.

    My Deinterlace settings for Yadif (I typed in "TFF"):

    Image
    [Attachment 85882 - Click to enlarge]


    AVISynth/QTGMC/VDub2 ripped through it at 180fps (Prefetch 24 set).

    Lollo, put your dummy back in.
    Last edited by Alwyn; 2nd Mar 2025 at 21:41. Reason: Added Deinterlace settings image
    Quote Quote  
  24. Here the Handbrake settings for non-square (anamorph) encoding with PAR 10:11, DAR 4:3.
    I gave up on it because it treats the chroma badly for interlaced 4:2:0 encoding. The chroma advances at framerate only instead of fieldrate. Same for the DVDStyler encode of post#16 btw. Maybe something goes wrong when doing the 4:2:2 to 4:2:0 conversion in ffmpeg mpeg2, and/or because HB seems to always flag interlaced video as progressive. I didn't analyze it further.

    The ffmpeg commandline of post#21 handles the chroma correctly. (Similar can be done in Avisynth of course).
    Image Attached Thumbnails Click image for larger version

Name:	HB anamorph.png
Views:	20
Size:	59.4 KB
ID:	85892  

    Last edited by Sharc; 4th Mar 2025 at 06:51.
    Quote Quote  
  25. Here a simple Avisynth script to visualize the chroma motion.
    Step through fields 9....20 and see the motion advancement of the left arm of the pianist.
    Code:
    LWLibavVideoSource("your_source")
    assumeTFF() #set the field order correctly
    separatefields()
    tweak(sat=2.0) #increase the contrast
    stackvertical(UtoY().subtitle("U"),VtoY().Subtitle("V"))
    P.S. Even some NLEs have/had problems with treating the chroma of interlaced YV12 4:2:0 correctly.
    Last edited by Sharc; 3rd Mar 2025 at 02:58. Reason: P.S. added
    Quote Quote  
  26. Captures & Restoration lollo's Avatar
    Join Date
    Jul 2018
    Location
    Italy
    Search Comp PM
    Originally Posted by Alwyn View Post
    Lollo, put your dummy back in.
    The only (incompetent) newborn here is you, as proven by your writing.
    Quote Quote  
  27. Originally Posted by johnnyquid View Post
    My end goal is to give a DVD to my folks who at this point in their lives aren't up for anything more technology challenging than putting a disk into their Blu-Ray player.
    Take note that the x264 examples are neither DVD nor Blu-ray disc compliant. If you just burn the files onto a disc there is a good chance that the player will spit the disc out. See post #16.
    Quote Quote  



Similar Threads

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