i'm on ubuntu but i still use avisynth@wine for some tasks. at the moment i have some files that needs to be cut at specific positions. i used avisynth to find out the frame numbers and encoded the videos with a qp file. the encoder creates i-frames at the cut points. is there a programs that can give my the frame numbers when i navigate to a specific frame (the cut point)? There must be something like a preview function and the opportunity to jump from one frame to the next - as i can do with avisynth and avspmod.
+ Reply to Thread
Results 1 to 8 of 8
Are you trying to navigate a QP (Compressed?) file or the resulting video file? What are you using to create the QP file?
i create the file only with a text editor.
the problem is to find out the correct frame numbers.
You can use ffprobe to detect where your key frame is located.
For Windows bellow but i assume Un*x will have only cosmetic changes.
@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"
Last edited by pandy; 30th Nov 2018 at 08:47.
I don't understand
Are you using qp file for the only purpose of re-encoding and cutting ? Was this already done?
Wouldn't it be better/ faster to encode proper sections normally without qp file since you are re-encoding anyways ? You're using avisynth anyways, and it's trivial to use trim()
For the preview question, you're using avisynth and avspmod anyways, so why not use that to check framenumber? FFInfo with FFVideoSource can provide frametype as well. Or vapoursynth with vapoursynth editor if you wanted to run natively under linux
Or other options like avidemux that can preview with frame type (IPB), do the splitting as well, and can run on win/mac/linux
A potential problem with all those tools is they do not distinguish between non IDR "i" frames. They call them all "I" frames which isn't correct. Cuts on those non keyframe "i" frames will cause errors. Another reason to do it properly in the first place
If you just want to find frame numbers as you play and seek then use Avisynth to display them as you play. You can also show the Frame Type if you wish.
FFmpegSource2("C:\Users\Bud\Desktop\The Man Cold Vs The Mom Cold.mp4", atrack=-1).Crop(0,0,-0,-0).LanczosResize(720,404) ScriptClip(Last, """Subtitle("[ "+Chr(FFPICT_TYPE)+" ]", size=(Height*56.0/720), align=2)""", after_frame=true) Subtitle("C:\Users\Bud\Desktop\The Man Cold Vs The Mom Cold.mp4", x=720, y=424, font="Arial", size=24, text_color=$ff0000, align=3) ShowFrameNumber(scroll=true, x=10, y=27, font="Arial", size=24, text_color=$ff0000) ShowTime(x=72, y=44, font="Arial", size=24, text_color=$ff0000) ShowSMPTE(fps=29.97, x=68, y=61, font="Arial", size=24, text_color=$ff0000)
[Attachment 47335 - Click to enlarge]
The resize is because my player (Potplayer) has seek buttons forward and backward and plays AVISynth files but it likes to blow up if I ask it to show File Type, Frame number, and mouseover thumbnail on the seek button if the resolution is to large. The font size and position are derived from a program that automatically adjust for alignment but these should work for you.
[Attachment 47336 - Click to enlarge]
I wouldn't mind knowing the answer. I regularly use MPC-HC to jump between keyframes and Ctrl+G to view the frame number. I'd be interested to know if there's a Linux player that'll do the same thing. I couldn't find a way to do it with SMPlayer or VLC. I don't think frame numbers are really a thing, and they have to be calculated based on the frame rate and the location of the frame. Many programs display the location in time, but not as a frame number.
I assume that's the idea.... to navigate to keyframe/cut points in the encoded video and determine the frame number? I assume you created the qp file yourself and therefore know it's just a text file with a qp extension containing a list of frame numbers.
I tend to do what you're doing, although often I rely on x264 to put keyframes at the beginning of each scene change as it's generally good at it and it's usually where I'd want to split. One reason for splitting after encoding is if you split the encoded video with MKVToolNix while including the audio stream, the audio is automatically split along with it and you don't need to worry about it separately.
Otherwise creating multiple copies of an Avisynth script with Trim() at the end of each one to specify a range of frame numbers for encoding can achieve the same thing. Be sure to add --stitchable to the x264 command line (assuming x264 encoding) in case you change you mind about where to split and want to append some of the segments.
You can still do the same thing with MKVToolnix, by opening the first segment, appending the rest, add the whole audio if there's audio, then specify the frame numbers for splitting using the "split parts based on frame numbers" option. The output MKVs would contain the encoded video split into the original segments again when muxing, and the audio would be split to match.
Just some thoughts in case tackling it differently might be easier.
Last edited by hello_hello; 1st Dec 2018 at 22:30.
Hey man. I think that I can help you with that. As far as I know, you can find those numbers by using ffprobe. That's a really nice app, and I think that it should help you. I've been using this app for many years. I hope that it's going to be useful for you. By the way, I had a strange file on my computer, that had the 855 number. I thought that it doesn't matter, but I have googled and found out on https://www.sunsigns.org/angel-number-855-meaning/that it's more than just a number. Do you believe in such things? ;\
Last edited by stones11; 15th Feb 2020 at 04:42.