Log in or register to post comments

Unity/AR/ffmpeg crash

April 16, 2013 - 12:21pm #1

Greetings. I am working on a Unity project that uses vuforia for AR tracking. At some point, I need to use ffmpeg to generate an image sequence from an existing video file. For some reason, after calling ffmpeg and generating the images - when I start vuforia back up, the app crashes without any information on what caused the crash. Please note ffmpeg successfully generates the images. By commenting out the call to ffmpeg, I can avoid the crash entirely. 

Any ideas? Below is the process that runs ffmpeg.



I start with an android java class in Unity:

AndroidJavaClass _link = new AndroidJavaClass("com.example.package.Encoder");


Above I call "startEncode" - defined in class, "Encoder":

public class Encoder
  private static Thread encoder_thread;

  public static void startEncode()
    VideoProcessor r = new VideoProcessor();
    encoder_thread = new Thread(r);


The VideoProcessor thread makes the call to ffmpeg:

public class VideoProcessor implements Runnable{

  private Invokerffmpeg _inv = new Invokerffmpeg();

  public void run()
    try {
      String[] ffmpeg_command = {
        outPath };
       _inv.run(ffmpegLocation, ffmpeg_command);     // commenting this line out will prevent the crash
    catch(Exception e) {
      Log.e(TAG, "FFMPEG Error", e);}

    // >> code to dispatch complete message back to Unity <<



The "_inv" member is defined here:

public class Invokerffmpeg
    static{ System.loadLibrary("ffmpeginvoke");}
    public native void run(String path_ffmpeg_lib,String[] args);


Thanks in advance for any help!




Unity/AR/ffmpeg crash

April 23, 2013 - 9:34am #3

Hi, as vincekilian said, there is a chance that the access to the camera might interfere with the QCAR process also accessing the camera.

At the moment we don't know of a viable solution or workaround of this issue.


Unity/AR/ffmpeg crash

April 23, 2013 - 8:01am #2

I'm assuming ffmpeg is trying to access the camera in some way, and QCAR's hooks prevent other components from accessing the camera.  Have you tried stopping/disabling QCAR before your make your FFMPEG calls and re-enabling QCAR after FFMPEG completes?  Or does your application require FFMPEG to capture a part of the ARCamera experience, therefore disabling QCAR wouldn't be possible?

Log in or register to post comments