VideoHelp Forum
+ Reply to Thread
Results 1 to 7 of 7
Thread
  1. Hello friends

    I wanted to know if there is any other way to see the frame type (I, B, P) in Avisynth apart from these that I mention below.


    -FFinfo()
    -DGSource("",Show=true)
    -Info() ---(this does not show the frame type . but it does show other things)

    is there any other way to visualize in avisynth the frame type of the video ?

    Thank you
    Last edited by zerowalk; 5th Aug 2019 at 19:24.
    Quote Quote  
  2. AviSynth doesn't know the frame type -- it only receives uncompressed video from the decoder. You need to use a decoder that can write the stats onto the video, like ffdshow.
    Quote Quote  
  3. Originally Posted by jagabo View Post
    AviSynth doesn't know the frame type -- it only receives uncompressed video from the decoder. You need to use a decoder that can write the stats onto the video, like ffdshow.
    Yes, you're right, but how to use it in Avisynth?
    Quote Quote  
  4. Use DirectShowSource() or AviSource(). Make sure ffdshow is enabled for the codec and has the highest priority.
    Quote Quote  
  5. Dinosaur Supervisor KarMa's Avatar
    Join Date
    Jul 2015
    Location
    US
    Search Comp PM
    This is what it looks like with FFDShow, by enabling OSD settings.
    Click image for larger version

Name:	ffdshow123.jpg
Views:	222
Size:	363.1 KB
ID:	49744
    Quote Quote  
  6. Dinosaur Supervisor KarMa's Avatar
    Join Date
    Jul 2015
    Location
    US
    Search Comp PM
    You can also use Win7DSFilterTweaker to make sure that FFDSHOW is picked to decode the codec you are using, with Directshowsource() in Avisynth.
    Quote Quote  
  7. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    If you like Avisynth and just want to see the frame number, timer, and type you can use be code below and just play the AVS file in a media player that supports AVS. (Most do)
    I used -atrack -2 because that video has no audio.

    Code:
    FFmpegSource2("C:\Users\Bud\Desktop\trimnmerge\250.mp4", atrack=-2).Crop(0,0,-0,-0)
    ScriptClip(Last, """Subtitle("[ "+Chr(FFPICT_TYPE)+" ]", size=(Height*56.0/720), align=2)""", after_frame=true)
    #Subtitle("C:\Users\Bud\Desktop\Test Pattern 2.mp4", x=720, y=560, font="Arial", size=24, text_color=$ff0000, align=3)
    ShowFrameNumber(scroll=true, x=22, y=200, font="Arial", size=24, text_color=$ff0000)
    ShowTime(x=84, y=220, font="Arial", size=24, text_color=$ffff80)
    ShowSMPTE(fps=29.97, x=80, y=240, font="Arial", size=24, text_color=$ffff80)
    I produces an image each frame such as the below which is a 250 GOP file, 30 FPS file of a timer 0-60.

    Image
    [Attachment 49749 - Click to enlarge]


    If you want a list of frame types and a list of key frames you can use the below CMD file. It is for drag and drop but
    by altering line 3 and 4 it can be used as a batch.

    Code:
    setlocal enabledelayedexpansion
    @echo off
    ::for %%a in (*.mp4,*.mpg,*.flv) Do (
    for %%a in ("%~nx1") Do (
    set /a count=0
    cd %%~dpa
    echo frame,media_type,stream_index,key_frame,pkt_pts,pkt_pts_time,pkt_dts,pkt_dts_time,best_effort_timestamp,^
    best_effort_timestamp_time,pkt_duration,pkt_duration_time,pkt_pos,pkt_size,^
    Width,Height,pix_fmt,sample_aspect_ratio,pict_type,coded_picture_number,display_picture_number,^
    interlaced_frame,top_field_first,repeat_pict,color_range,color_space,color_primaries,color_transfer,^
    chroma_location > "%%~na_ffprobe.csv"
    echo No.  pts_time  type > "%%~na_AllFrames.txt"
    @echo. > "%%~na_keys.txt"
    ver > nul"
    set /a Number=0
    ffprobe.exe -v quiet -select_streams v:0 -print_format csv -show_entries frame "%%~nxa"  >> "%%~na_ffprobe.csv"
    for /F "tokens=4,6,18,19 delims=," %%b in ('findstr "video" "%%~na_ffprobe.csv"') do (
    set "x=%%b"
    set "y=%%c"
    set "z=%%d"
    set "w=%%e"
    set "v=%%f"
    set "u=%%g"
    set sort=!y:~0,-7!
    ::if !sort! GEQ 0 if !sort! LEQ 10 echo !count!  !y:~0,13!  !x! !w:~0,1! >> "%%~na_AllFrames.txt"
    echo !count!  !y:~0,13!  !x! !w:~0,1! >> "%%~na_AllFrames.txt"
    set "key=!w:~0,1!"
    if !key! == I echo !count!  !y:~0,13!  !x! !w:~0,1! >> "%%~na_keys.txt"
    set /a count+=1
     set /a ekko=count%%100
     if !ekko! EQU 0 echo Frame !count! processed
    )
    )
    pause
    250_All Frames.txt
    No. pts_time type
    0 0.000000 1 I
    1 0.033333 0 B
    2 0.066667 0 B
    3 0.100000 0 B
    4 0.133333 0 P
    5 0.166667 0 B
    6 0.200000 0 B
    7 0.233333 0 B
    8 0.266667 0 P
    9 0.300000 0 B

    250_key frames.txt
    0 0.000000 1 I
    250 8.333333 1 I
    500 16.666667 1 I
    750 25.000000 1 I
    1000 33.333333 1 I
    1250 41.666667 1 I
    1500 50.000000 1 I
    1750 58.333333 1 I
    Quote Quote  



Similar Threads

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