-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
FFmpegFrameFilter with "eq" filter produces strange video #887
Comments
It might help to set the pixel format of the frameFilter.setPixelFormat(frameGrabber.getPixelFormat()); |
Also the output of the |
Just tried adding that in. It didn't make a difference.
I wasn't 100% sure how to do this, but I tried setting a break point at the end of the |
Yes, 3 is AV_PIX_FMT_BGR24 and 5 is AV_PIX_FMT_YUV444P, so the pixel format does change. We'll need to add a way to query that. |
I've added a |
Yup, just tried it (using |
I have just noticed that similar issue exists with the Sample code to reproduce with the same video mentioned in the issue: import java.nio.file.Path;
import java.nio.file.Paths;
import org.bytedeco.javacv.CanvasFrame;
import org.bytedeco.javacv.FFmpegFrameFilter;
import org.bytedeco.javacv.FFmpegFrameGrabber;
import org.bytedeco.javacv.Frame;
public class TestPlayback {
public static void main(String args[]) throws Exception {
Path inputFile = Paths.get("C:\\Users\\gohkah\\Videos\\SampleVideo_1280x720_5mb.mp4");
CanvasFrame display = new CanvasFrame("Test video");
display.setSize(1280, 720);
display.setVisible(true);
try (FFmpegFrameGrabber frameGrabber = new FFmpegFrameGrabber(inputFile.toFile())) {
frameGrabber.setFormat("mp4");
frameGrabber.start();
try (FFmpegFrameFilter frameFilter =
new FFmpegFrameFilter(
"eq=brightness=0.25", frameGrabber.getImageWidth(), frameGrabber.getImageHeight())) {
frameFilter.start();
Frame frame = frameGrabber.grabImage();
while (frame != null) {
frameFilter.push(frame, frameGrabber.getPixelFormat());
Frame filteredFrame = frameFilter.pull();
if (filteredFrame != null) {
display.showImage(filteredFrame);
} else {
System.out.println("Filter returned null frame!");
}
frame = frameGrabber.grabImage();
}
frameGrabber.flush();
frameFilter.stop();
frameFilter.release();
}
frameGrabber.stop();
frameGrabber.release();
}
}
} |
@kahgoh CanvasFrame doesn't support YUV images. Convert them to RGB images. |
Fix included in JavaCV 1.4.1! Thanks for reporting this issue. |
@saudet I have the same problem. How can I Convert YUV444p Frame into a RGB Frame? I use OpenCV to convert and it doesn't work.
|
Use FFmpeg instead...
|
Something like |
@saudet ,Thank you for your reply.
|
If you're using |
I am trying to read to adjust the brightness of a video file (I am using a small clip, on a Windows desktop computer).
My understanding from the reading the FFmpeg documentation is that I would apply the eq filter with the appropriate brightness value. So I am trying to make use of FFmpegFilter to apply the filter:
However, this produces a video that looks something like this:
I have tried running it through FFplay and the video shows correctly with just the brightness changed.
Another thing I noticed is that if simply change the filter in the above code to
rotate=-PI/6
, it is also able to produce the video correctly. I am not sure if I am missing something?The text was updated successfully, but these errors were encountered: