2

I'm using MediaCodec to decode and encode video with this exam DecodeEditEncodeTest.java

It's working well with the video sample, but when using extenal video file, output video display wrong

Does anyone try this and know how to fix this problem? Thanks your answer so much!

Update:attach image link before and after in 2 cases

Hoang Nguyen
  • 173
  • 7
  • the video is generated inside the test. how do you use external one? – Marlon Sep 23 '14 at 13:35
  • I use MediaCodec to decode a Video in sdcard instead of generate new video as this example – Hoang Nguyen Sep 23 '14 at 15:11
  • Can you be more specific about what "display wrong" means? Maybe include screenshots with expected vs. actual? (Upload the screenshots to an image-sharing service and link them.) – fadden Sep 23 '14 at 15:59
  • I update screenshot before and after in 2 cases, please help me check it – Hoang Nguyen Sep 24 '14 at 03:25
  • Looks like a YUV format issue. What are the dimensions of the external video? On some devices things can go badly if the video dimensions aren't one of the "standard" resolutions. – fadden Sep 24 '14 at 04:59
  • It's right a YUV format issue, i also try with another resolutions but it's till go wrong. Are you have any idea to convert YUV or RGB in this case. I don't know what YUV in input for Encoder or RGB format in output of Decoder – Hoang Nguyen Sep 24 '14 at 07:59
  • Dear Fadden, sorry for my mistake. You're right, it's actually because of video dimensions. Do you know how can i get "standard" resolutions for each device. Anyway, i need to say thank you so much! – Hoang Nguyen Sep 24 '14 at 08:40
  • http://stackoverflow.com/a/24506997/2260921 - re dimensions pls check this answer – Marlon Sep 24 '14 at 08:56
  • btw on what device and what resolution do you the issue? – Marlon Sep 24 '14 at 08:58
  • Thanks Marlon, i test on [Asus Zenfone 5](http://www.gsmarena.com/asus_zenfone_5-5952.php) and [Moto G](http://www.gsmarena.com/motorola_moto_g-5831.php). Both of them same resolution 720x1280 – Hoang Nguyen Sep 24 '14 at 09:16
  • i have another question: When i decode and encode again as this example, the output video quanlity really bad (as you can compare 2 pictures ex1_after and ex1_before above). How can i improve quanlity of output video? Might caused by: "This involves decoding and re-encoding, not to mention conversions between YUV and RGB, and so may be lossy" – Hoang Nguyen Sep 24 '14 at 10:18
  • 1
    what is a target resolution for encoder in your case? what bitrate do you set? – Marlon Sep 24 '14 at 11:42
  • in all cases, i has checked: if input video constains bitrate, i get and set the same, otherwise i set to 10000. Resolution i check for the same width/height and both 1280x720 – Hoang Nguyen Sep 24 '14 at 14:56
  • Thank you so much Marlon, your suggestion is very beautiful. My bitrate very low, so the output video not good. I has solved my problem. Dear Marlon and Fadden, happy to know both of you, thanks ^^ – Hoang Nguyen Sep 25 '14 at 02:58

0 Answers0