mmaitre314 / MediaReader

Reads audio/video data from files, cameras/microphones, and generic media sources
http://mmaitre314.github.io/MediaReader
Apache License 2.0
19 stars 12 forks source link

Image Quality #6

Open MJTSoftware opened 9 years ago

MJTSoftware commented 9 years ago

Thanks for this! In my app I am pulling the frames and saving them using your MediaReader and then I am rearranging them and then creating a new video with the frames. One thing I've noticed is that the image quality for the extracted frames isn't as good as the original video. Any chance you can add in a few options for jpg quality and/or an option to use png instead?

What I would really like to do is stitch together video, along with frames extracted (after they've been rearranged), and some more video, and not even be able to see any change in quality.

Thanks!

mmaitre314 commented 9 years ago

That should be easy to add. Would you be able to share an input video and an extracted frame with artifacts so I can verify that the issue is actually addressed?

MJTSoftware commented 9 years ago

I guess it isn't so much that there are artifacts, it's that the coloring is different. Here is a video showing what I'm talking about. I suppose it could be possible that it isn't actually on your end and it is in "MediaClip.CreateFromImageFileAsync" that I'm using,

Example clip: http://1drv.ms/1RlsrlQ

When I just use all frames extracted using your solution it looks pretty great, and that is what I'm currently doing, but it uses more processing time that way.

mmaitre314 commented 9 years ago

At least part of the issue lies in MediaReader as it ignores the extended color info carried by MF_MT_VIDEO_NOMINAL_RANGE / MF_MT_VIDEO_PRIMARIES / MF_MT_TRANSFER_FUNCTION / MF_MT_YUV_MATRIX / MF_MT_VIDEO_CHROMA_SITING. I can look into that (a bit more tricky to fix than just adding support for PNG). I'll also ask around if there are known issues around that in MediaComposition.

Just to paraphrase what you are trying to do:

MJTSoftware commented 9 years ago

Thanks. Yes that is basically it.

Right now when I'm generating the video at the end I'm using all extracted frames so you can't really tell the colors were adjusted. For the project I'm working right now that is OK, but I have an idea for another project and I'd really like to be able to combine parts of the original video with extracted frames without having to create the entire video from individual frames and not be able to tell the difference in color.

Thanks again!

MJTSoftware commented 9 years ago

The other option that could work for what I'm trying to do would to create/find some MediaClip effect that reverses the video to make it play backwards and that also allows me to add the slow motion effect at the same time. I don't know anything about how to create MediaClip effects so I don't know if that is possible or not.

mmaitre314 commented 9 years ago

Sorry, missed your last post. A couple of pointers about video effects:

It's not a great match for you play backward scenario though. The best I can think of on the top of my head would be to buffer the whole video in memory in the effect and then play it backward, which most likely will require more RAM than the device can provide. Unless maybe the effect saves all frames to disk and when done reads everything from disk.