Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature request] make frame-type property available #2444

Closed
j77h opened this issue Nov 4, 2015 · 3 comments
Closed

[feature request] make frame-type property available #2444

j77h opened this issue Nov 4, 2015 · 3 comments

Comments

@j77h
Copy link

j77h commented Nov 4, 2015

Can't see anywhere that mpv/libmpv provides the frame type: I-frame/key-frame, P-frame, B-frame.

Tell me if it's there, but if not, could you make a frame-type property accessible, perhaps in the same way as time-pos is provided now.

Use case example: When making a list of cut-points for removing ads from PVR files, it would help to know which frames are I-frames.

I'm starting to make a little mpv-based app, to write the time of each chosen cut-point to a file (marking each as a start or end point). Can make the app anyway, but if it can show frame-type it will be better.

If mpv won't provide frame-type I'll try ffplay instead, but it looks a bit scary -- I'm not a C programmer, I use Python3, and I'm trying ctypes for the first time.

@j77h j77h changed the title OSD: frame-type and millisecond when paused [feature request] [feature request] make frame-type property available Nov 4, 2015
@mia-0
Copy link
Member

mia-0 commented Nov 4, 2015

Hint: Try ffms2. It has a straightforward API and indexes files in advance,
which means you can easily get a list of all frames of a particular type.

@ghost
Copy link

ghost commented Nov 4, 2015

Codecs are more complicated than this. Just because there's an I-frame it doesn't mean you can actually cut it there, at least with h264/hevc.

@j77h
Copy link
Author

j77h commented Nov 4, 2015

@lachs0r: I was hoping not to have to make an index first. It would be good to make a cut list almost as quickly as skipping through a video in mpv.
@wm4: Australian DVB-T is mpeg2 (or now mheg, whatever that is). If I cut h.264, it's stuff i encoded myself (from the mpeg2). So far I've always been able to cut on i-frames without recoding.

There are 2 ways I tend to cut:
1 - before/when transcoding. filter_complex has to re-encode anyway, so finding key-frames is not essential. Even so, there's a key frame every 12 or 13 frames, so there'd be a good chance of finding an acceptable one if they were identifiable.
2 - after transcoding. If i don't have time to cut before i run short of space I transcode first. I set scene-change detection fairly high (60 or more) to improve the chance of getting a key frame in every black sequence. Cutting this h264 is when i most need to find a key frame, as there are fewer of them, and i don't want to re-encode the whole thing. It's said that FFmpeg can do 'smart encoding' -- just the frames between a cut and a key frame -- but i haven't tested to prove it yet. If it works well, identifying key frames would not be essential, but it would still be good to be able to choose a key frame when there is one in the black.

Years ago i used MpegStreamclip (closed source, Apple-based, win/mac only, no mkv) with which i could very quickly find a place to cut: first skip in 1-min jumps; when i see an ad, skip on key frames to the black frames at start and end of ad break, then use single-frame-step to make sure this black key-frame is really at the start or end of the ads, then mark it as an 'in' or 'out' point.

Haven't found anything (free) that works so well, and i've searched on and off for the last few years. Some free video editors might do it, but they'll recode only with standard parameters, and i want to use more efficient x264 options (vbr), and sometimes non-standard frame-sizes such as 768x432 or 960x540. DVB-Cut sometimes works, but it doesn't keyboard-skip on every key frame, the gui control needs a lot of slow clumsy mousing, and it cuts only mpeg, not mkv or mp4.

So we really need a 'simple' video cutter that opens mkv as well, and is efficient to use. Would like to use mpv to find the cut points, as it's so neat and quick. It's not essential to see frame types, but if it's not too much trouble, it would be great.

Just realized that skipping on key frames without missing any is also part of doing this job quickly, and mpv doesn't do that either... Can this be feature-request part 2 ?

@ghost ghost added the meta:feature-request label Nov 17, 2015
@ghost ghost closed this as completed in 01a2af6 Nov 22, 2015
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants