Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8496793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:56:57+00:00 2026-06-10T23:56:57+00:00

I have compiled FFmpeg library using NDK and use it to trim videos and

  • 0

I have compiled FFmpeg library using NDK and use it to trim videos and get thumbnails from a video in my app, so basically I have ffmpeg.so and video-trimmer.so libraries up and running.

The problem however is strange, the trim or getThumbnail operations are successful but just one time i.e. the first time and the operations fail the second time. However it is successful the third time, I googled it and got two similar posts on SO related to my problem

POST 1:

POST 2:

Interestingly they suggest the same solution and I am unable to solve the issue being a naive in C programming language.

Here is what I have done

void Java_com_example_demo_natives_LibraryLoader_loadTrimmerLibrary(JNIEnv* env, jclass class, jstring libffmpeg_path, jstring inputFile, jstring outFile,
        jstring startTime, jstring length)
{
        const char* path;
        void* handle;
        int *(*Java_com_example_demo_natives_VideoTrimmer_trim)(JNIEnv *, jclass, jstring, jstring, jstring, jstring);

        path = (*env)->GetStringUTFChars(env, libffmpeg_path, 0);

        handle = dlopen(path, RTLD_LAZY);

        Java_com_example_demo_natives_VideoTrimmer_trim = dlsym(handle, "Java_com_example_demo_natives_VideoTrimmer_trim");
        (*Java_com_example_demo_natives_VideoTrimmer_trim)(env, class, inputFile, outFile, startTime, length);

        (*env)->ReleaseStringUTFChars(env, libffmpeg_path, path);

        dlclose(handle);
}

Despite of calling dlclose the library instance still exists in memory, what I am doing wrong here?

I come to know that library instance still exists because when I load the libraries again in some other activity the error message says library already exists in CL.

I want to get rid of the instance of that library from memory, please help…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T23:56:59+00:00Added an answer on June 10, 2026 at 11:56 pm

    try moving the position of the ‘ReleaseString…’

    it should be after the ‘dlopen’

    it should be before the call into the other shared lib…

    (*env)->GetStringUTFChars
    dlopen
    (*env)->ReleaseStringUTFChars
    make the main call
    dlclose
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have successfully compiled the FFMPEG library to android using NDK. I want to
I am making an app in which i want to use ffmpeg library.I have
I have an iOS app which use the ffmpeg library, and iOS should compile
I have compiled the NTL inifite precision integer arithmetic library for c++, using Microsoft
I have compiled SQLIte3 database engine from sqlite3.c with BCC 55 using the following
I'm having a few problems converting video files from the command line using FFMPEG.
I have compiled a project using Eclipse with C/C++ plugin (using http://libcinder.org library, and
I have compiled a .NET application using Any CPU option. This .NET application uses
I have compiled a simple win32 app successfully with bc++ (2 lines excerpt only):
I have compiled my application on Linux (Intel) machine using this command gcc –g

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.