How to upload a video file (located in the resource folder) to the NDK?

I am running ffmpeg from android ndk, I can run the sample, here [https://github.com/ccggaass/android-ffmpeg-sample].

I want to put the video in the Android resources folder, so how to transfer this file to the ffmpeg api:

av_open_input_file (& pFormatCtx, "file: /sdcard/vid.3gp" , NULL, 0, NULL);

Does anyone know how to transfer a file to av lib?

+4
source share
3 answers

Use this:

String path = "/sdcard/vid.3gp"; av_open_input_file(&pFormatCtx, "file:/sdcard/vid.3gp", NULL, 0, NULL); 
+1
source

Make sure the resource will not be compressed when creating the APK. (so we can access its file descriptor) Make sure Ffmpeg is built with protocol protocol support. Take the asset file descriptor from AAsset_manager. create a file name like this ...

char fn [32]; sprintf (fn, "pipe: //% d", your_assets_fd);

open it like this ... av_open_input_file (x, fn, ...);

Good luck.

PS do not hardcode / sdcard / path.

+1
source

maybe it will work

file:///android_asset/vid.3gp

-1
source

Source: https://habr.com/ru/post/1391218/


All Articles