Media (Intel® Video Processing Library, Intel Media SDK)
Access community support with transcoding, decoding, and encoding in applications using media tools like Intel® oneAPI Video Processing Library and Intel® Media SDK
Announcements
The Intel Media SDK project is no longer active. For continued support and access to new features, Intel Media SDK users are encouraged to read the transition guide on upgrading from Intel® Media SDK to Intel® Video Processing Library (VPL), and to move to VPL as soon as possible.
For more information, see the VPL website.
3075 Discussions

INTEL NDE Media For Android : Lost frames and broken parameters

jonathan_v_
Beginner
590 Views

Hello,

I am making an application on android that needs to be able to cut 1 second out of a video and store it on the device as a separate video file.
So if I have a video of 10 seconds it would turn into 10 videos of 1 second.

I am using the "Intel INDE Media for Mobile Library" on eclipse to achieve this.

I ran into the following problem while using the library : 

1 :  When I cut 1 second off a video on a NTSC device it returns a video of around 0,8 seconds.
2 :  When I transcode a video of any size or length on a NTSC device, it will lose a couple of milliseconds on the end.
3 :  The Framerate parameter for the VideoTranscoder doesn't work!
4 :  When transcoding the application will crash when you have android version 17 or lower.

1 and 2 :

So basically anything I transcode will lose milliseconds when running on a NTSC device.
Even when I don't add a segment it will still lose milliseconds.

The following code is what i am using to transcode the video : 
 

public class ComposerCutCoreActivity extends ComposerTranscodeCoreActivity {

    private long segmentFrom = 0;
    private long segmentTo = 0;

    @Override
    protected void getActivityInputs() {

        Bundle b = getIntent().getExtras();
        srcMediaName1 = b.getString("srcMediaName1");
        dstMediaPath = b.getString("dstMediaPath");
        mediaUri1 = new Uri(b.getString("srcUri1"));

        segmentFrom = b.getLong("segmentFrom");
        segmentTo = b.getLong("segmentTo");
    }

    @Override
    protected void setTranscodeParameters(MediaComposer mediaComposer) throws IOException {
        mediaComposer.addSourceFile(mediaUri1);
        mediaComposer.setTargetFile(dstMediaPath);

        configureVideoEncoder(mediaComposer, videoWidthOut, videoHeightOut);
        configureAudioEncoder(mediaComposer);

        ///////////////////////////

        MediaFile mediaFile = mediaComposer.getSourceFiles().get(0);

       // What I am trying to achieve.
       Long begin = 0;
       Long end = 1000000;
       mediaFile.addSegment(new Pair<Long, Long>(begin , end));

        // The original code.
        //mediaFile.addSegment(new Pair<Long, Long>(segmentFrom, segmentTo));
    }

    @Override
    protected void printDuration() {

    	TextView v = (TextView)findViewById(R.id.durationInfo);
        v.setText(String.format("duration = %.1f sec\n", (float)(segmentTo - segmentFrom)/1e6));
        v.append(String.format("from = %.1f sec\nto = %.1f sec\n", (float)segmentFrom/1e6, (float)segmentTo/1e6));
    }
}

This code is a direct copy from the example application with a little change ( I am using this as an example ).
The example application can be found here : https://github.com/INDExOS/media-for-mobile/tree/master/Android/samples

Android Device Used : Xperia™ Z2 Tablet (SGP511)

3 : 

Changing the Video Framerate doesn't work.
I could change the Framerate to 1, 10 or 60 Fps and it would not even show the slightest difference.

I am using the following code to change the Framerate : 

 

protected void configureVideoEncoder(MediaComposer mediaComposer, int width, int height) {

        VideoFormatAndroid videoFormat = new VideoFormatAndroid(videoMimeType, width, height);

        videoFormat.setVideoBitRateInKBytes(videoBitRateInKBytes);
        videoFormat.setVideoFrameRate(videoFrameRate); // The function that isn't working.
        videoFormat.setVideoIFrameInterval(videoIFrameInterval);

        mediaComposer.setTargetVideoFormat(videoFormat);
    }

source : https://github.com/INDExOS/media-for-mobile/blob/master/Android/samples/apps/src/com/intel/inde/mp/samples/ComposerTranscodeCoreActivity.java

 I think that setting the VideoIFrameInterval doesn't work either, but I am not entirely sure about that.

4 : 

Every time I try to transcode a video on an Android Device with SDK Version 17 or lower it will give the following error : 

From : Eclipse Logcat
E/AndroidRuntime(3039): Caused by: java.lang.NoClassDefFoundError: android.media.MediaMuxer
E/AndroidRuntime(3039):     at com.intel.inde.mp.android.MediaMuxerPlugin.<init>(MediaMuxerPlugin.java:27)
E/AndroidRuntime(3039):     at com.intel.inde.mp.android.AndroidMediaObjectFactory.createSink(AndroidMediaObjectFactory.java:95)
E/AndroidRuntime(3039):     at com.intel.inde.mp.MediaComposer.setTargetFile(MediaComposer.java:129)

Android Device Used : Asus Transformer Pad Infinity (TF700T)

I want to make a working Demo version of this application and i would appreciate if anyone can help me with these problems.

Sincerely,
 
Jonathan

 

0 Kudos
2 Replies
Harshdeep_B_Intel
590 Views

Hi

Thank you for the detailed reproducer on the issue. I will consult the team and update you with a fix or work around.

Thanks

0 Kudos
Nikolay_A_Intel
Employee
590 Views

Hi Jonathan,

Let me answer your questions in reverse order:)

4. Android 4.3 is the lowest version supported by M4M due to android API limitations and different devices behavior in lower versions.

3. Video framerate change is not supported yet so transcoded file always has framerate of original file.

1-2. This issue is addressed on our side but the fix is not yet included in released version. If you are still interested to try binaries with these fixes taking into account answers on 3 and 4 please share your email address with me via "Send Message" and I will share binaries with you

 

0 Kudos
Reply