Compile ffmpeg.c and call its main() via JNI

2019-02-19 16:49发布

问题:

I have built FFmpeg on Android. I am trying to call the main() in ffmpeg.c via JNI and pass it the arguments it expects exactly how you would from the command line. When I added the ffmpeg.c file to my android.mk I got a couple errors which were easily fixed by commenting out the "#if HAVE_SYS_RESOURCE_H" line at the top which allowed a couple includes to be brought in. After this I now have undefined reference errors which all point to the "cmdutils.h" include. Here are just a few of my compilation errors...

/home/kieran/workspace/VideoEditor//obj/local/armeabi/objs/ffmpeg/ffmpeg.o: In function `opt_audio_channels':
/home/kieran/workspace/VideoEditor//jni/ffmpeg/ffmpeg.c:2770: undefined reference to `parse_number_or_die'
/home/kieran/workspace/VideoEditor//obj/local/armeabi/objs/ffmpeg/ffmpeg.o: In function `opt_audio_rate':
/home/kieran/workspace/VideoEditor//jni/ffmpeg/ffmpeg.c:2764: undefined reference to `parse_number_or_die'
/home/kieran/workspace/VideoEditor//obj/local/armeabi/objs/ffmpeg/ffmpeg.o: In function `opt_me_threshold':
/home/kieran/workspace/VideoEditor//jni/ffmpeg/ffmpeg.c:2523: undefined reference to `parse_number_or_die'
/home/kieran/workspace/VideoEditor//obj/local/armeabi/objs/ffmpeg/ffmpeg.o: In function `opt_thread_count':
/home/kieran/workspace/VideoEditor//jni/ffmpeg/ffmpeg.c:2744: undefined reference to `parse_number_or_die'
/home/kieran/workspace/VideoEditor//obj/local/armeabi/objs/ffmpeg/ffmpeg.o: In function `opt_verbose':
/home/kieran/workspace/VideoEditor//jni/ffmpeg/ffmpeg.c:2529: undefined reference to `parse_number_or_die'
/home/kieran/workspace/VideoEditor//obj/local/armeabi/objs/ffmpeg/ffmpeg.o: In function `opt_bitrate':
/home/kieran/workspace/VideoEditor//jni/ffmpeg/ffmpeg.c:2546: undefined reference to `opt_default'
/home/kieran/workspace/VideoEditor//jni/ffmpeg/ffmpeg.c:2548: undefined reference to `avcodec_opts'
/home/kieran/workspace/VideoEditor//obj/local/armeabi/objs/ffmpeg/ffmpeg.o: In function `opt_rec_timestamp':
/home/kieran/workspace/VideoEditor//jni/ffmpeg/ffmpeg.c:2906: undefined reference to `parse_time_or_die'
/home/kieran/workspace/VideoEditor//obj/local/armeabi/objs/ffmpeg/ffmpeg.o: In function `opt_input_ts_offset':
/home/kieran/workspace/VideoEditor//jni/ffmpeg/ffmpeg.c:2912: undefined reference to `parse_time_or_die'
/home/kieran/workspace/VideoEditor//obj/local/armeabi/objs/ffmpeg/ffmpeg.o: In function `opt_start_time':
/home/kieran/workspace/VideoEditor//jni/ffmpeg/ffmpeg.c:2900: undefined reference to `parse_time_or_die'
/home/kieran/workspace/VideoEditor//obj/local/armeabi/objs/ffmpeg/ffmpeg.o: In function `opt_recording_time':
/home/kieran/workspace/VideoEditor//jni/ffmpeg/ffmpeg.c:2894: undefined reference to `parse_time_or_die'
/home/kieran/workspace/VideoEditor//obj/local/armeabi/objs/ffmpeg/ffmpeg.o: In function `show_help':
/home/kieran/workspace/VideoEditor//jni/ffmpeg/ffmpeg.c:3719: undefined reference to `show_help_options'
/home/kieran/workspace/VideoEditor//jni/ffmpeg/ffmpeg.c:3721: undefined reference to `show_help_options'
/home/kieran/workspace/VideoEditor//jni/ffmpeg/ffmpeg.c:3724: undefined reference to `show_help_options'
/home/kieran/workspace/VideoEditor//jni/ffmpeg/ffmpeg.c:3727: undefined reference to `show_help_options'
/home/kieran/workspace/VideoEditor//jni/ffmpeg/ffmpeg.c:3730: undefined reference to `show_help_options'