Hello,
I was looking to cut on an MPEG-2 encoded file (DVD). I was trying to find the IDR frames to make a clean cut. For h264 input I use Selur's FrameCounter application. His website lists support for MPEG-2 files (raw = .m2v). When I attempt to use that (syntax: FrameCounter input.m2v list 2> output.txt), the only output I get is "Frame count analyse at [x] of [total]" repeated for each frame. But it does not provide any information about the frame, as it does using the same syntax with h264 input. Is there separate syntax I should use, or a different program that would work better to identify frame types for this input?
+ Reply to Thread
Results 1 to 10 of 10
-
-
I can't address your question (not clear to me as MPEG-2 has no IDR) - you can try to use something like:
Code:@set name=%~1 @ffprobe -hide_banner -v 32 -stats -y -skip_frame nokey -i "%name%" -select_streams v:0 -print_format compact -show_entries "frame=key_frame,pkt_pos,pkt_pts_time" > "%~n1_.txt"
-
The 'list' parameter in FrameCounter is only implemented for H.264.
pandys call should help, since it should output all key frames.users currently on my ignore list: deadrats, Stears555, marcorocchini -
Ah, thanks! I wasn't sure if MPEG-2 had IDR frames, but I figured there were certain key frames that needed to be cut on. I am using windows command shell. I can figure out how to do the ffprobe command you quoted, but how would I begin by setting the name variable. I imagine that if I put that as the first command in the shell, it won't stick for the subsequent ffprobe command. If I turned this into a batch script, would that work?
-
what pandy posted was code for a batch script, so yes it should work in a batch script
users currently on my ignore list: deadrats, Stears555, marcorocchini -
OK, one more question, sorry. I ran the script. All my pkt_pts_time came back as "N/A." What unit are the pkt_pos units in? I get really large numbers, so I know that's not frame number.
This is a sample of my output. How do I decipher frame number for the corresponding keyframe?
frame|key_frame=1|pkt_pts_time=N/A|pkt_pos=0side_data|
frame|key_frame=1|pkt_pts_time=N/A|pkt_pos=11208side_data|
frame|key_frame=1|pkt_pts_time=N/A|pkt_pos=23184side_data| -
As you are using elementary stream this may be some issue for ffmpeg (and i think all open source based on same code programs) seem some container is required to display packet PTS time, packet position should be expressed as byte offset to start of file.
And usage is quite simple - type your script name and file to be exercised as parameter to script so 'scriptname.cmd filename.m2v'
I use Total Commander and this is from my perspective ctrl + enter on batch file SPACE ctrl + enter on filename - old habits from Norton Commander times.
To understand ffmpeg you may wish to use very detailed information script - it can create txt and csv files - time consuming as each frame is reported
Code:@set name=%~1 @ffprobe -hide_banner -v 32 -stats -y -i "%name%" -select_streams v:0 -print_format compact -show_entries frame > "%~n1.txt" @echo entry_type,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 > "%~n1.csv" @ffprobe -hide_banner -v 32 -stats -y -i "%name%" -select_streams v:0 -print_format csv -show_entries frame >> "%~n1.csv"
-
Similar Threads
-
Find out frame numbers for qp files
By Valit in forum Newbie / General discussionsReplies: 7Last Post: 13th Feb 2020, 12:57 -
VBR: Find out absolute data position of individual frame/sample/time.
By TechLord in forum Newbie / General discussionsReplies: 19Last Post: 27th Feb 2018, 00:13 -
Help losslessly editing single-frame 720x576 16:9 .m2v files for remux
By MK Inst in forum Newbie / General discussionsReplies: 30Last Post: 13th May 2017, 14:37 -
ffmpeg: setting IDR frames option.
By Prathamesh in forum Video ConversionReplies: 10Last Post: 12th Nov 2015, 14:22 -
How to find out frame exposure time in a variable frame rate .mov file...
By bananas100 in forum EditingReplies: 5Last Post: 24th Oct 2014, 19:18