简体   繁体   中英

How to encode image to h264 in android?

For some reason, I want to encode image frame to h264 in android. In order to get a better performance, I used ffmpeg with android ndk to encode image. I'm so strange that it's easy to decode h264 frame to image while it's so hard to encode image to h264 frame. When I try to use avcodec_encode_video2 function the eclipse always shows a message An internal error occurred during: "Launching MyApp". java.lang.NullPointerException which make me crazy. I'm also so angry that the android ndk do not show any message useful to tell me what happen. Can anyone help me?

h264 encoder is not an integral part of ffmpeg. Usually we use the opensource x264 encoder, but this has significant legal consequences. x264 is GPL, while usually builds of ffmpeg are LGPL. You can build ffmpeg with x264, or use x264 standalone.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM