[FFmpeg-trac] #7702(undetermined:new): Incorrect video frame reporting

FFmpeg trac at avcodec.org
Sun Jan 27 20:06:02 EET 2019


#7702: Incorrect video  frame reporting
-------------------------------------+-------------------------------------
             Reporter:  budman1      |                    Owner:
                 Type:  defect       |                   Status:  new
             Priority:  normal       |                Component:
              Version:  unspecified  |  undetermined
             Keywords:               |               Resolution:
             Blocking:               |               Blocked By:
Analyzed by developer:  0            |  Reproduced by developer:  0
-------------------------------------+-------------------------------------

Comment (by budman1):

 Updating to ffmpeg version N-93022-g260f1960e7 solved player problem but
 still extracts wrong frame
 -----------------------------------------
 create Blank clip, no sound:
 BlankClip(length=3600, width=640, height=480, fps=30, color=$000000)

 create blank clip (GOP=50, FPS=30)with Frame type, Frame number and time
 embedded using Avisynth and FFMpeg:

 Avisynth script (test.avs):
 FFmpegSource2("C:\Users\Bud\Desktop\G50_30_Test
 Pattern.mp4").Crop(0,0,-0,-0).LanczosResize(640,480)
 ScriptClip(Last, """Subtitle("[ "+Chr(FFPICT_TYPE)+" ]",
 size=(Height*56.0/720), align=2)""", after_frame=true)
 Subtitle("Test_Pattern.mp4", x=295, y=240, font="Arial", size=24,
 text_color=$ff0000, align=3)
 ShowFrameNumber(scroll=true, x=10, y=27, font="Arial", size=24,
 text_color=$ffff80)
 ShowTime(x=72, y=44, font="Arial", size=24, text_color=$ffff80)
 ShowSMPTE(fps=25, x=68, y=61, font="Arial", size=24, text_color=$ffff80)

 FFMpeg script:
 ffmpeg -i test.avs -an -c:v libx264 -crf 22 -g 50 -r 30
 "G50_30_Test_Pattern.mp4"

 Cut at frame 1848 (I-Frame with new file frame 0 dts 0.06616, 1st cut):
 ffmpeg -i "G50_30_Test_Pattern.mp4" -ss 61.600000 -vframes 1750 -c:v copy
 -c:a copy -y "C:\Users\Bud\Desktop\1852\G50_30_Test_Pattern_First.mp4"

 check dts/pts (gives dts time 0.066016):
 ffprobe -i "C:\Users\Bud\Desktop\G50_30_Test_Pattern_First.mp4" -v quiet
 -select_streams v -show_frames -show_entries frame=pkt_pts_time
 -read_intervals %+6 -of csv

 In order to get 0.000000 dts (dts * 0.667 = 0.044033)
 ffmpeg -nostats -loglevel 0 -ss 0.044033 -i
 "C:\Users\Bud\Desktop\G50_30_Test_Pattern_First.mp4" -vframes 1750 -c:v
 copy -c:a copy -y "C:\Users\Bud\Desktop\G50_30_Test_Pattern_Final.mp4"

 Check dts/pts (gives dts time 0.000000):
 ffprobe -i "C:\Users\Bud\Desktop\G50_30_Test_Pattern_Final.mp4" -v quiet
 -select_streams v -show_frames -show_entries frame=pkt_pts_time
 -read_intervals %+6 -of csv

 ffplay script to view (see final_ffplay.jpg):
 DirectShowSource("C:\Users\Bud\Desktop\1852\G50_30_Test_Pattern_Final.mp4").Crop(0,
 0, -0, -0)x = float(Width) / float(Height)
 last.LanczosResize(round(x * 480.0 / 4.0) * 4, 480).trim(0, -1750)
 ShowFrameNumber(offset=0,scroll=true, x=10, y=127, font="Arial", size=24,
 text_color=$ffff80)
 ShowTime(offset_f=0,x=72, y=144, font="Arial", size=24,
 text_color=$ffff80)

 extract first frame as xxx.jpg (final_1st_frame.jpg):
 ffmpeg -i "C:\Users\Bud\Desktop\1852\G50_30_Test_Pattern_Final.mp4" -ss
 0.000000 -f image2 -q:v 1 -vf
 scale=640:-2,"drawtext=fontfile=c:/Windows/Fonts/Arial.ttf:text='0.000000':fontsize=30:box=1:x=(w-tw)/2:y=h-(2*lh),drawtext=fontfile=c:/Windows/Fonts/Arial.ttf:text='0:1':fontsize=30:box=1:x=(w-tw)/2:y=h-(2*lh)-30"
 -vframes 1 -y
 "C:\Users\Bud\Desktop\TrimNMerge\TrimNMerge\bin\Debug\work\Thumb_1.jpg

--
Ticket URL: <https://trac.ffmpeg.org/ticket/7702#comment:2>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list