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
Change frame rate detection #448
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm good with this, if it produces more accurate results. @eisneinechse ?
One code-style change requested, along with a suggestion for changes to the logging.
1e578fb
to
e7bd918
Compare
Codecov Report
@@ Coverage Diff @@
## develop #448 +/- ##
===========================================
+ Coverage 42.37% 48.24% +5.86%
===========================================
Files 129 128 -1
Lines 13276 9962 -3314
===========================================
- Hits 5626 4806 -820
+ Misses 7650 5156 -2494
Continue to review full report at Codecov.
|
I hope, now it looks a bit better. Updated on top of the current develop branch. |
Make FPS detection of the input file similar to the FFmpeg's own re-encoding algorithm.
AVRational framerate = av_guess_frame_rate(pFormatCtx, pStream, NULL); | ||
info.fps.num = framerate.num; | ||
info.fps.den = framerate.den; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This reminds me that I tried to add operators and conversion methods into openshot::Fraction
so it would automatically convert from/to AVRational
as needed, once. But I think the fact that AVRational
is implemented in C instead of C++ probably doomed that idea right from the start.
Are there unit tests that do any checks on frame-rate detection at all? I don't think so... in fact the only frame rate check I see is this one, which doesn't involve FFmpegReader at all. libopenshot/tests/Timeline_Tests.cpp Lines 82 to 90 in c38c55f
Oh, no, there is one in FFmpegWriter that checks the rate of a newly-written file, after reading it back in. |
I added an additional frame rate check in the FFmpegReader_Tests suite, using the standard sintel video source. (Which is uninteresting at 24fps, but like I said it's a sanity check.) With that in place, I'll merge this once Travis is done with it. I was hoping to get @eisneinechse 's take, but it's been a month and I don't want to hold this up forever. |
All these unit tests is based on libopenshot own implementations, so they exist here just for fun. This is my own thoughts about these kind of stuff in libopenshot. With the broken instrument you'll be unable to make right measurements (it is more like freezing bugs at some level for the current build ^_^). |
Well, no — it's exactly what unit tests are. They check that the implementation matches expectations, in isolation. And, just as importantly (and the reason they're run on every build), they catch when changes to the code alter the implementation in unexpected ways. The Android developer intro sums it up pretty well:
Unit tests don't test whether your structure is put together correctly, only that the logical pieces it's assembled from are really the shape we think they are. Testing how it all fits together is where integration testing comes into play. But integration testing is pointless when you're assembling untested pieces. |
FFmpeg re-encoding algorithm don't uses
avg_frame_rate
.