Code Monkey home page Code Monkey logo

android-transcoder's Introduction

android-transcoder

Hardware accelerated transcoder for Android, written in pure Java.

Why?

Android does not offer straight forward way to transcode video.

FFmpeg is the most famous solution for transcoding. But using FFmpeg binary on Android can cause GPL and/or patent issues. Also using native code for Android development can be troublesome because of cross-compiling, architecture compatibility, build time and binary size.

To transcode without any hassle written above, I created this library to provide hardware accelerated transcoding of H.264 (mp4) video without ffmpeg by using MediaCodec.

Requirements

API Level 18 (Android 4.3, JELLY_BEAN_MR2) or later. If your app targets older Android, you should add below line to AndroidManifest.xml:

<!-- Only supports API >= 18 -->
<uses-sdk tools:overrideLibrary="net.ypresto.androidtranscoder" />

Please ensure checking Build.VERSION by your self.

Usage

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    ParcelFileDescriptor parcelFileDescriptor = resolver.openFileDescriptor(data.getData(), "r");
    FileDescriptor fileDescriptor = parcelFileDescriptor.getFileDescriptor();
    MediaTranscoder.Listener listener = new MediaTranscoder.Listener() {
        @Override
        public void onTranscodeProgress(double progress) {
            ...
        }

        @Override
        public void onTranscodeCompleted() {
            startActivity(new Intent(Intent.ACTION_VIEW).setDataAndType(Uri.fromFile(file), "video/mp4"));
            ...
        }

        @Override
        public void onTranscodeFailed(Exception exception) {
            ...
        }
    };
    MediaTranscoder.getInstance().transcodeVideo(fileDescriptor, file.getAbsolutePath(),
            MediaFormatStrategyPresets.createAndroid720pStrategy(), listener); // or createAndroid720pStrategy([your bitrate here])
}

See TranscoderActivity.java in example directory for ready-made transcoder app.

Quick Setup

Gradle

Available from JCenter, which is default repo of gradle script generated by recent android studio.

repositories {
   jcenter()
}
compile 'net.ypresto.androidtranscoder:android-transcoder:0.2.0'

Note (PLEASE READ FIRST)

  • This library raises RuntimeExceptions (like IlleagalStateException) in various situations. Please catch it and provide alternate logics. I know this is bad design according to Effective Java; just is TODO.
  • Currently this library does not generate streaming-aware mp4 file. Use qtfaststart-java to place moov atom at beginning of file.
  • Android does not gurantees that all devices have bug-free codecs/accelerators for your codec parameters (especially, resolution). Refer supported media formats for parameters guaranteed by CTS.
  • This library does not support video files recorded by other device like digital cameras, iOS (mov files, including non-baseline profile h.264), etc.

More information about internals

Seungwon Lee created awesome slide which describes this (and derived) library. https://speakerdeck.com/line_devday2019/looking-for-a-silver-bullet-to-edit-videos-on-android

Also there is a blog post about this library written in Japanese. While it is Japanese, diagrams would be useful for understanding internals of this library. http://qiita.com/yuya_presto/items/d48e29c89109b746d000

References for Android Low-Level Media APIs

License

Copyright (C) 2014-2016 Yuya Tanaka

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

android-transcoder's People

Contributors

aaron112 avatar edwardotis avatar hkurokawa avatar maikambayashi avatar ryanwilliams83 avatar shts avatar spiritedrunning avatar veneetreddyk avatar ypresto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

android-transcoder's Issues

extractor does not contain video and/or audio tracks

Hi,
there is a way to "continue" the compressing process also if the audio is not present.
I mean, no audio input no audio output ...but at least the video could be processed.

Also when the audio track is not AAC, why don't just give a possibility to "no touch it" so the video can be processed?

Thanks a lot
Gigi

why

04-26 02:33:44.819 18120-18164/net.ypresto.androidtranscoder.example D/dalvikvm: GC_FOR_ALLOC freed 248K, 2% free 17010K/17292K, paused 9ms, total 9ms
04-26 02:33:44.819 18120-18164/net.ypresto.androidtranscoder.example E/MediaTranscoder: Fatal error while transcoding, this might be invalid format or bug in engine or Android.
java.nio.BufferOverflowException
at java.nio.ShortBuffer.put(ShortBuffer.java:433)
at net.ypresto.androidtranscoder.engine.AudioRemixer$3.remix(AudioRemixer.java:63)
at net.ypresto.androidtranscoder.engine.AudioChannel.remixAndMaybeFillOverflow(AudioChannel.java:219)
at net.ypresto.androidtranscoder.engine.AudioChannel.feedEncoder(AudioChannel.java:153)
at net.ypresto.androidtranscoder.engine.AudioTrackTranscoder.stepPipeline(AudioTrackTranscoder.java:97)
at net.ypresto.androidtranscoder.engine.MediaTranscoderEngine.runPipelines(MediaTranscoderEngine.java:192)
at net.ypresto.androidtranscoder.engine.MediaTranscoderEngine.transcodeVideo(MediaTranscoderEngine.java:97)
at net.ypresto.androidtranscoder.MediaTranscoder$4.call(MediaTranscoder.java:184)
at net.ypresto.androidtranscoder.MediaTranscoder$4.call(MediaTranscoder.java:166)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
04-26 02:33:44.939 16828-16828/com.android.documentsui D/dalvikvm: GC_EXPLICIT freed 1116K, 7% free 28318K/30416K, paused 1ms+3ms, total 23ms

Test Suites

Given the interest in expanding the capabilities of this library I feel that a test suite would be helpful. It would make pull requests a lot easier test and serve as good reference when a question comes up about a particular device.

I am working towards a suite here - https://github.com/selsamman/android-transcoder.git and did a proof of concept by transcoding a small file using Instrumentation and simple JUnit (not Expresso). Basically the instrument test piggy backs off the sample app though it really just does JUnit test on the underlying transcoder classes rather than driving the example app.

It runs fine on a USB device but still have issues with getting cloud testing going. AWS seems to be looking for Setup test and skips the suite. Starting to think straight-up JUnit (without activities) are not really compatible as all examples use Expresso or other frameworks. In the Google cloud sometimes tests run twice and I get quite a lot failure on Nexus 6 phones though Nexus 5 phones seem to be fine. I will keep working on this but still have a few questions and some need for direction:

  • First is this something that is desirable and worthwhile to work on?
  • How much testing should be done in terms of various input files, output strategies, different videos
  • I am adding the sample clips to androidTest/res/raw. For now there is only one file but this could potentially get big. Only affects the test apk and the repo size.
  • How much compatibility is really expected. I understand ypresto has done some testing on the farm so curious as to how that was done. I am wondering if you need to transcode videos actually shot on the various devices which would make things harder.

Any direction would be appreciated.

Is this library can work on "older API"?

API Level 18 (Android 4.3, JELLY_BEAN_MR2) or later. If your app targets older Android, you should add below line to AndroidManifest.xml:

<!-- Only supports API >= 18 -->
<uses-sdk tools:overrideLibrary="net.ypresto.androidtranscoder" />

, for which this line?

Avoid non-multiple-of-16 resolution

As mentioned in CTS, some device has restriction of resolution. Multiple of 16 resolution seems to be available on almost all devices.
This library's preset uses 960x540, which does not satisfies this constraint.

transcode stop when openning other files

Hi,
A user send me a bug report where he can't open an another video files while he is already transcoding one. I'm using a classical videoview to play videos and start a transcode on click and then users can open an another videos and repeat. It doesn't make problem usually so far I know.
This user has a samsung GT-I9505 and under SDK Level 21.

When he opens the next video the transcode stop and the video openning failed.
Any idea of the source of this issu?

Regards,

problem installing

xxx-xxx :camoout Admin$ sudo cordova plugin add https://github.com/ypresto/android-transcoder.git

Fetching plugin "https://github.com/ypresto/android-transcoder.git" via git clone
Repository "https://github.com/ypresto/android-transcoder.git" checked out to git ref "master".
Failed to fetch plugin https://github.com/ypresto/android-transcoder.git via git.
Either there is a connection problems, or plugin spec is incorrect:
CordovaError: Cannot find plugin.xml for plugin '1463437390750'. Please try adding it again.

??

640x360 Resolution

Hi,

First of all thanks for creating this great library it works super quick compared to a lot of other methods.

With our project we are recording video at 1080p 16:9 so we can make use of some camera features such as stabilisation, however we need to output the video at 640x360 resolution we have managed to get this working with your source code however we are finding that the output video is quite bad and has lots of artefacts unless we set the bitrate very high.

Do you have any suggestions on how we can improve the output quality?

Thanks Aaron

Crash application when transcoding m4v file.

Hi @ypresto ,

Thanks you because created a library very useful .

I've tested your library on some devices : Galaxy S3 (4.3), Nexus 5 (4.4.2) ... but when i try transcode a video has format .m4v or 3gp on Galaxy S3 (4.3) , an error appearing and crash this test application.

It's logcat :

03-17 09:43:22.380: D/dalvikvm(13507): GC_FOR_ALLOC freed 1144K, 35% free 14266K/21724K, paused 63ms, total 63ms
03-17 09:43:24.470: V/MediaExtractor(13507): Autodetected media content as 'video/mp4' with confidence 0.40
03-17 09:43:24.485: D/MediaTranscoderEngine(13507): Duration (us): 60127000
03-17 09:43:24.495: I/OMXClient(13507): Using client-side OMX mux.
03-17 09:43:24.520: I/ACodec(13507): setupVideoEncoder succeeded
03-17 09:43:24.555: I/OMXClient(13507): Using client-side OMX mux.
03-17 09:43:24.925: E/ACodec(13507): ## 3d, eNativeColorFormat 0x15
03-17 09:43:24.925: E/ACodec(13507): ## 3d, eNativeColorFormat 0x105
03-17 09:43:25.070: V/VideoTrackTranscoder(13507): Added track #0 with video/avc to muxer
03-17 09:43:25.100: D/dalvikvm(13507): GC_FOR_ALLOC freed 289K, 35% free 14255K/21724K, paused 29ms, total 29ms
03-17 09:43:25.100: I/MPEG4Writer(13507): setStartTimestampUs: 200200
03-17 09:43:25.100: I/MPEG4Writer(13507): Earliest track starting time: 200200
03-17 09:43:25.105: I/MPEG4Writer(13507): setStartTimestampUs: 0
03-17 09:43:25.105: I/MPEG4Writer(13507): Earliest track starting time: 0
03-17 09:43:25.160: A/MPEG4Writer(13507): frameworks/av/media/libstagefright/MPEG4Writer.cpp:2517 CHECK_GE( timestampUs,0ll) failed: -200200 vs. 0
03-17 09:43:25.160: A/libc(13507): Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1), thread 13995 (VideoTrackEncod)

But when I try transcode this video on Nexus 5, it transcode completed.

Thanks you :)

video size

Hi dear;

How can i set the video resolution size and stereo for audio? I'd like to set to 854 X 480.

.MOV file not transcoded

E/MediaTranscoder: Fatal error while transcoding, this might be invalid format or bug in engine or Android.
java.nio.BufferOverflowException
at java.nio.ByteBuffer.put(ByteBuffer.java:787)
at net.ypresto.androidtranscoder.engine.QueuedMuxer.writeSampleData(QueuedMuxer.java:102)
at net.ypresto.androidtranscoder.engine.PassThroughTrackTranscoder.stepPipeline(PassThroughTrackTranscoder.java:80)
at net.ypresto.androidtranscoder.engine.MediaTranscoderEngine.runPipelines(MediaTranscoderEngine.java:192)
at net.ypresto.androidtranscoder.engine.MediaTranscoderEngine.transcodeVideo(MediaTranscoderEngine.java:97)
at net.ypresto.androidtranscoder.MediaTranscoder$4.call(MediaTranscoder.java:184)
at net.ypresto.androidtranscoder.MediaTranscoder$4.call(MediaTranscoder.java:166)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)``

Transcoding of 720p videos

Hi. Is it possible to transcode videos with resolutions smaller than 1080p? I've setup a lower bitrate to compress the video a bit more, but 720p videos were not transcoded.
Thanks

"Got non SPS NAL data" exception

I debugged and got sourceBuffer's backingArray content is:
0 0 0 1 39 66 -32 30 -115 104 10 3 -38 108 -128 0 0 3 0 -128 0 0 15 7 -118 17 80

so sourceBuffer[4] is not equal 103, and it throw "Got non SPS NAL data" exception.

I tried this same video file in nexus 5, it's backingArray is:
0 0 0 1 103 66 -128 30 -38 2 -128 -10 -128 109 10 19 80

I'm confused that why different devices parse a different csd-0 data? It seems like a bug.

Log is below:

56:36.120 2821-2832/net.ypresto.androidtranscoder.example W/MemoryDealer: madvise(0x7a34e000, 614400, MADV_REMOVE) returned Operation not supported on transport endpoint 07-29 14:56:36.120 2821-3488/net.ypresto.androidtranscoder.example I/MediaCodec-JNI: throwExceptionAsNecessary err = 0 07-29 14:56:36.130 2821-3488/net.ypresto.androidtranscoder.example E/MediaTranscoder: Fatal error while transcoding, this might be invalid format or bug in engine or Android. java.lang.IllegalStateException: Got non SPS NAL data. at net.ypresto.androidtranscoder.utils.AvcCsdUtils.getSpsBuffer(AvcCsdUtils.java:57) at net.ypresto.androidtranscoder.engine.MediaFormatValidator.validateVideoOutputFormat(MediaFormatValidator.java:37) at net.ypresto.androidtranscoder.engine.MediaTranscoderEngine$1.onDetermineOutputFormat(MediaTranscoderEngine.java:162) at net.ypresto.androidtranscoder.engine.QueuedMuxer.onSetOutputFormat(QueuedMuxer.java:66) at net.ypresto.androidtranscoder.engine.QueuedMuxer.setOutputFormat(QueuedMuxer.java:61) at net.ypresto.androidtranscoder.engine.VideoTrackTranscoder.drainEncoder(VideoTrackTranscoder.java:207) at net.ypresto.androidtranscoder.engine.VideoTrackTranscoder.stepPipeline(VideoTrackTranscoder.java:105) at net.ypresto.androidtranscoder.engine.MediaTranscoderEngine.runPipelines(MediaTranscoderEngine.java:191) at net.ypresto.androidtranscoder.engine.MediaTranscoderEngine.transcodeVideo(MediaTranscoderEngine.java:97) at net.ypresto.androidtranscoder.MediaTranscoder$4.call(MediaTranscoder.java:185) at net.ypresto.androidtranscoder.MediaTranscoder$4.call(MediaTranscoder.java:167) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:841)

(Reproduced with Huawei p7 mobile phone)

landscape and portrait

Hi Dear;

How can i detect the video is in landscape or portrait mode?
Your output is always 1280x720 even though the video is in landscape mode and portrait. it supposed to be 1280x720 for landscape and 720x1280 for portrait mode.

transcode fail every time.

hi , i tried all the resolution yet nothing transcoded and every time that error comes in the log

"06-06 16:59:43.588 10263-10344/net.ypresto.androidtranscoder.example E/MediaTranscoder: Fatal error while transcoding, this might be invalid format or bug in engine or Android.
net.ypresto.androidtranscoder.engine.InvalidOutputFormatException: MediaFormatStrategy returned pass-through for both video and audio. No transcoding is necessary.
at net.ypresto.androidtranscoder.engine.MediaTranscoderEngine.setupTrackTranscoders(MediaTranscoderEngine.java:157)
at net.ypresto.androidtranscoder.engine.MediaTranscoderEngine.transcodeVideo(MediaTranscoderEngine.java:96)
at net.ypresto.androidtranscoder.MediaTranscoder$4.call(MediaTranscoder.java:184)
at net.ypresto.androidtranscoder.MediaTranscoder$4.call(MediaTranscoder.java:166)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)"

Remove jcodec dependency

Currently this library uses jcodec to parse AVC profile parameter of mp4 video.
jcodec is too much for doing that, as it bundles its own encoder/decoder (of course this library does not use it) and increasing method count.

Transcoding did not work

Trying to transcode an mp4. The input video is in 1080x1920.
Device is : Nexus 5X
OS: Android 8.0.0
The listener is called back on onTranscodeCompleted but there is no output file generated

Here are the logs: Please see at the bottom for some potential errors. Thanks!!

04-20 01:02:02.474 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.011317521404479806
04-20 01:02:02.491 18703-19241/com.messaging.stars V/QueuedMuxer: Added track #0 with video/avc to muxer
04-20 01:02:02.492 18703-19241/com.messaging.stars V/QueuedMuxer: Added track #1 with audio/mp4a-latm to muxer
04-20 01:02:02.492 18703-19241/com.messaging.stars I/MPEG4Writer: limits: 4294967295/0 bytes/us, bit rate: -1 bps and the estimated moov size 3313 bytes
04-20 01:02:02.493 18703-19241/com.messaging.stars V/QueuedMuxer: Output format determined, writing 16 samples / 4439 bytes to muxer.
04-20 01:02:02.493 18703-19261/com.messaging.stars I/MPEG4Writer: setStartTimestampUs: 0
04-20 01:02:02.493 18703-19261/com.messaging.stars I/MPEG4Writer: Earliest track starting time: 0
04-20 01:02:02.498 18703-19260/com.messaging.stars I/MPEG4Writer: setStartTimestampUs: 0
04-20 01:02:02.503 18703-19253/com.messaging.stars W/GrallocMapperPassthrough: buffer descriptor with invalid usage bits 0x2002000
04-20 01:02:02.503 18703-19241/com.messaging.stars I/Adreno: Invalid colorspace 1
04-20 01:02:02.517 18703-19241/com.messaging.stars I/Adreno: Invalid colorspace 1
04-20 01:02:02.566 18703-19241/com.messaging.stars I/Adreno: Invalid colorspace 1
04-20 01:02:02.577 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.0256395399117876
04-20 01:02:02.590 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.03314044798062786
04-20 01:02:02.666 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.04024068148404393
04-20 01:02:02.681 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.04577557727233417
04-20 01:02:02.731 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.055764334515264205
04-20 01:02:02.765 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.06182102395572084
04-20 01:02:02.806 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.07128798754648447
04-20 01:02:02.853 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.07694395918014356
04-20 01:02:02.870 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.08588917236011416
04-20 01:02:02.924 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.09206693764593964
04-20 01:02:02.937 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.10050428089596125
04-20 01:02:02.974 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.10470396955807316
04-20 01:02:02.989 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.11364913949667041
04-20 01:02:03.036 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.12127116665225288
04-20 01:02:03.061 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.1264053446337456
04-20 01:02:03.087 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.13442808959612557
04-20 01:02:03.131 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.14152832309954164
04-20 01:02:03.149 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.1490292311683819
04-20 01:02:03.188 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.15520699645420738
04-20 01:02:03.200 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.16218615411225462
04-20 01:02:03.243 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.1669196575283231
04-20 01:02:03.263 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.17442056559716337
04-20 01:02:03.306 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.1829650609703364
04-20 01:02:03.321 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.19046601228055005
04-20 01:02:03.362 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.1975662457839661
04-20 01:02:03.410 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.2032222174176252
04-20 01:02:03.424 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.2121674305975958
04-20 01:02:03.472 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.21782340223125485
04-20 01:02:03.495 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.22440664187494594
04-20 01:02:03.531 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.23242934359595263
04-20 01:02:03.584 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.23808531522961168
04-20 01:02:03.617 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.24610806019199172
04-20 01:02:03.652 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.25505323013058895
04-20 01:02:03.693 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.26070920176424806
04-20 01:02:03.726 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.26584342298711405
04-20 01:02:03.747 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.2738661247081208
04-20 01:02:03.798 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.27807783447202283
04-20 01:02:03.822 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.28846730952175037
04-20 01:02:03.889 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.29845606676468045
04-20 01:02:03.931 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.3045127129637637
04-20 01:02:03.956 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.31253545792614373
04-20 01:02:03.999 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.31819142955980284
04-20 01:02:04.045 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.3238474011934619
04-20 01:02:04.064 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.3322708207212661
04-20 01:02:04.122 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.33937105422468217
04-20 01:02:04.155 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.3457880740292312
04-20 01:02:04.191 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.354320548300614
04-20 01:02:04.229 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.3608932370492087
04-20 01:02:04.283 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.36890729049554616
04-20 01:02:04.321 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.375998875724293
04-20 01:02:04.364 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.38257156447288765
04-20 01:02:04.390 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.391508129378189
04-20 01:02:04.434 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.39715402577185854
04-20 01:02:04.477 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.40280372740638243
04-20 01:02:04.511 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.4102979763037274
04-20 01:02:04.536 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.4173880913257805
04-20 01:02:04.570 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.42395982876416155
04-20 01:02:04.606 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.4319724552451786
04-20 01:02:04.644 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.43998508172619566
04-20 01:02:04.678 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.44511588688056736
04-20 01:02:04.704 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.45312851336158433
04-20 01:02:04.751 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.4592962034074202
04-20 01:02:04.767 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.46771287728098243
04-20 01:02:04.822 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.4748073596817435
04-20 01:02:04.837 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.4837434489319381
04-20 01:02:04.871 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.4893926749113552
04-20 01:02:04.906 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.49453117703018246
04-20 01:02:04.930 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.5025433278560927
04-20 01:02:04.980 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.5110685808181268
04-20 01:02:05.021 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.5176528582547781
04-20 01:02:05.063 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.5242135259015827
04-20 01:02:05.096 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.5317086828677678
04-20 01:02:05.151 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.5402392545187236
04-20 01:02:05.202 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.5468109487157312
04-20 01:02:05.234 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.5557460866557122
04-20 01:02:05.307 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.5637587131367292
04-20 01:02:05.329 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.5707344979676554
04-20 01:02:05.370 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.5783430770561273
04-20 01:02:05.396 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.583473882210499
04-20 01:02:05.430 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.5929302949061662
04-20 01:02:05.474 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.5995020323445472
04-20 01:02:05.517 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.6060852719882384
04-20 01:02:05.580 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.6146071953645248
04-20 01:02:05.615 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.6221023955720834
04-20 01:02:05.670 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.6282714693418663
04-20 01:02:05.704 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.6328838969125659
04-20 01:02:05.759 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.6414168468390555
04-20 01:02:05.802 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.6489120470466142
04-20 01:02:05.845 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.6569174522182825
04-20 01:02:05.887 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.6649348352503676
04-20 01:02:05.929 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.671506615930122
04-20 01:02:05.974 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.677155841909539
04-20 01:02:06.023 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.6846500475655106
04-20 01:02:06.060 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.6926626740465278
04-20 01:02:06.137 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.7008429905733806
04-20 01:02:06.186 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.7074204791144167
04-20 01:02:06.220 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.7149223817348439
04-20 01:02:06.264 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.7229450834558505
04-20 01:02:06.317 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.7291310213612384
04-20 01:02:06.339 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.7366252270172101
04-20 01:02:06.385 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.7437239903139323
04-20 01:02:06.431 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.7493838104298192
04-20 01:02:06.474 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.7554424457320765
04-20 01:02:06.513 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.7643804376026982
04-20 01:02:06.571 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.7714922165527978
04-20 01:02:06.635 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.7771414425322148
04-20 01:02:06.669 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.7860880394361325
04-20 01:02:06.701 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.7931873216293349
04-20 01:02:06.751 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.7988432932629941
04-20 01:02:06.765 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.8058224509210412
04-20 01:02:06.814 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.8134459050419441
04-20 01:02:06.840 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.8195011675170804
04-20 01:02:06.883 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.8266028279858169
04-20 01:02:06.930 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.8337083801781544
04-20 01:02:06.977 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.8402925711320592
04-20 01:02:07.009 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.8477887226498313
04-20 01:02:07.059 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.8548836807056992
04-20 01:02:07.100 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.8614621205569488
04-20 01:02:07.151 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.8694848222779555
04-20 01:02:07.211 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.8751407939116146
04-20 01:02:07.228 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.8840860070915852
04-20 01:02:07.270 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.8906644469428349
04-20 01:02:07.322 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.8968422122286603
04-20 01:02:07.336 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.9038213698867076
04-20 01:02:07.389 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.9109216033901237
04-20 01:02:07.448 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.9189443051111303
04-20 01:02:07.469 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.9278895182911009
04-20 01:02:07.517 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.9335454899247599
04-20 01:02:07.570 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.940645723428176
04-20 01:02:07.622 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.9463016950618351
04-20 01:02:07.660 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.9523583845022918
04-20 01:02:07.696 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.9603810862232984
04-20 01:02:07.749 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.9674813197267145
04-20 01:02:07.798 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.9740597595779642
04-20 01:02:07.843 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.9797157312116234
04-20 01:02:07.864 18703-18703/com.messaging.stars D/Video Transcode: Progress 0.989588212401626
04-20 01:02:07.908 18703-19241/com.messaging.stars D/MPEG4Writer: Video track stopping. Stop source
04-20 01:02:07.908 18703-19241/com.messaging.stars D/MPEG4Writer: Video track source stopping
04-20 01:02:07.908 18703-19241/com.messaging.stars D/MPEG4Writer: Video track source stopped
04-20 01:02:07.908 18703-19260/com.messaging.stars I/MPEG4Writer: Received total/0-length (339/1) buffers and encoded 339 frames. - Video
04-20 01:02:07.909 18703-19241/com.messaging.stars D/MPEG4Writer: Video track stopped. Stop source
04-20 01:02:07.909 18703-19241/com.messaging.stars D/MPEG4Writer: Audio track stopping. Stop source
04-20 01:02:07.909 18703-19241/com.messaging.stars D/MPEG4Writer: Audio track source stopping
04-20 01:02:07.909 18703-19241/com.messaging.stars D/MPEG4Writer: Audio track source stopped
04-20 01:02:07.911 18703-19261/com.messaging.stars I/MPEG4Writer: Received total/0-length (542/1) buffers and encoded 542 frames. - Audio
04-20 01:02:07.912 18703-19261/com.messaging.stars I/MPEG4Writer: Audio track drift time: 0 us
04-20 01:02:07.912 18703-19241/com.messaging.stars D/MPEG4Writer: Audio track stopped. Stop source
04-20 01:02:07.913 18703-19241/com.messaging.stars D/MPEG4Writer: Duration from tracks range is [11447600, 11568395] us
04-20 01:02:07.913 18703-19241/com.messaging.stars D/MPEG4Writer: Stopping writer thread
04-20 01:02:07.913 18703-19259/com.messaging.stars D/MPEG4Writer: 0 chunks are written in the last batch
04-20 01:02:07.914 18703-19241/com.messaging.stars D/MPEG4Writer: Writer thread stopped
04-20 01:02:07.915 18703-19241/com.messaging.stars I/MPEG4Writer: The mp4 file will not be streamable.
04-20 01:02:07.938 18703-19252/com.messaging.stars D/SurfaceUtils: disconnecting from surface 0xc2af2008, reason disconnectFromSurface
04-20 01:02:07.982 18703-19241/com.messaging.stars D/MPEG4Writer: Video track stopping. Stop source
04-20 01:02:07.982 18703-19241/com.messaging.stars D/MPEG4Writer: Audio track stopping. Stop source

Add a synchronous method to MediaTranscoder

Currently, all transcodeVideo methods in MediaTranscoder are async methods. However, there are many situations where a synchronous method might be preferable. IntentServices and Handlers with their own HanderThread are two that quickly come to mind. Would you be open to a PR to add a synchronous method? I was thinking of pretty much copying/pasting the current work that transcodeVideo does, like so:

public void transcodeVideo(final FileDescriptor inFileDescriptor, final String outPath, final MediaFormatStrategy outFormatStrategy, final Listener listener) throws IOException, RuntimeException {
    MediaTranscoderEngine engine = new MediaTranscoderEngine();
    engine.setProgressCallback(new MediaTranscoderEngine.ProgressCallback( {
        @Override
         public void onProgress(final double progress) {
             listener.onTranscodeProgress(progress);
         }
    });
    engine.setDataSource(inFileDescriptor);
    engine.transcodeVideo(outPath, outFormatStrategy);
}

I figure that if you are running this synchronously you know what you are doing and you can handle your own Exceptions/failures. You'll know it was successful when it returned. The only listener call that you might be interested in is for progress?

Why not transcoding videos other than 16:9

I was looking at your code, I found that in Android720pFormatStrategy.java

if (longer * 9 != shorter * 16) { throw new OutputFormatUnavailableException("This video is not 16:9, and is not able to transcode. (" + width + "x" + height + ")"); }

So, why are you not transcoding videos other than 16:9?

Run on GPU

Hi,
First of all thanks for the lib it's amazing.

Just a question is there a way to make it works on android gpu ?

Regards

Redesign interface

This library was designed as simple transcoder and num of feature is growing.
It'd be better to redesign interface.

  • Picaso-like fluent API
  • modular video/audio filter
  • Better exception handling

Related:
#10: Exception design
#14: Trimming
#17: Audio options
#26: Moving moov atom for streaming

Rotate video

Is it possible to rotate video while transcoding?

can only convert mp4 to mp4

I tried to convert a whole bunch of different stuff on android, and they all failed except mp4. which does not help, because it is mp4 already. Maybe I should put this elsewhere because it is the converter that is actually failing.
You can try the videos I did here:
https://cinelerra-cv.org/footage.php
and
http://techslides.com/sample-webm-ogg-and-mp4-video-files-for-html5

here is the errors i got from them:
java.io.IOException: Failed to instantiate extractor.
java.lang.IllegalArgumentException: extractor does not contain video and/or audio tracks.
net.ypresto.androidtranscoder.engine.InvalidOutputFormatException: Audio codecs other than AAC is not supported, actual mime type: audio/3gpp

Specified frame rate ignored

When you specify a frame rate in e.g: Android720pFormatStrategy line 73, it seems to be ignored. If the input video is 60 fps, and we leave the above line specifying an output at 30 fps, the output file with still have 60 fps.

I assume this is because (as you have stated in many other questions) this library does not support video manipulation, just transcoding. Is that right?

This question on StackOverflow seems to be a user coming across the same problem.

Do you have any tips for someone trying modify your library to increase or decrease a video frame rate?

cordova build still failing

gets the error
Manifest merger failed : uses-sdk:minSdkVersion 14 cannot be smaller than version 18 declared in library [com.github.ergovia-mobile:android-transcoder:v0.1.10R_ergovia] /Users/fausto/Projects/coding/4linked-mobile/club-sencha/phonegap/platforms/android/build/intermediates/exploded-aar/com.github.ergovia-mobile/android-transcoder/v0.1.10R_ergovia/AndroidManifest.xml

tried to add sdk-use
to work with minsdk 9 but not working !

java.lang.IllegalStateException at android.media.MediaCodec.dequeueOutputBuffer

java.lang.IllegalStateException
at android.media.MediaCodec.dequeueOutputBuffer(Native Method)
at net.ypresto.androidtranscoder.engine.VideoTrackTranscoder.drainDecoder(VideoTrackTranscoder.java:171)
at net.ypresto.androidtranscoder.engine.VideoTrackTranscoder.stepPipeline(VideoTrackTranscoder.java:107)
at net.ypresto.androidtranscoder.engine.MediaTranscoderEngine.runPipelines(MediaTranscoderEngine.java:191)
at net.ypresto.androidtranscoder.engine.MediaTranscoderEngine.transcodeVideo(MediaTranscoderEngine.java:97)

/**
* Dequeue an output buffer, block at most "timeoutUs" microseconds.
* Returns the index of an output buffer that has been successfully
* decoded or one of the INFO_* constants.
* @param info Will be filled with buffer meta data.
* @param timeoutUs The timeout in microseconds, a negative timeout indicates "infinite".
* @throws IllegalStateException if not in the Executing state,
* or codec is configured in asynchronous mode.
* @throws MediaCodec.CodecException upon codec error.
*/
@OutputBufferInfo
public final int dequeueOutputBuffer(...){}

Use checked exception for bad input file

java.lang.IllegalArgumentException: extractor does not contain video and/or audio tracks.

This error is very annoying because it is runtime exception and is caused by malformed input i.e. not bug.

IllegalStateException MediaCodec configure()

07-27 12:40:17.928 22970-23128/com.zuga.smallvideo E/ACodec: [OMX.qcom.video.decoder.avc] configureCodec returning error -1010
07-27 12:40:17.928 22970-23127/com.zuga.smallvideo E/MediaCodec: Codec reported an error. (omx error 0x80001001, internalError -1010)
07-27 12:40:18.008 22970-23114/com.zuga.smallvideo E/MediaTranscoder: Fatal error while transcoding, this might be invalid format or bug in engine or Android.
                                                                      java.lang.IllegalStateException
                                                                          at android.media.MediaCodec.native_configure(Native Method)
                                                                          at android.media.MediaCodec.configure(MediaCodec.java:262)
                                                                          at net.ypresto.androidtranscoder.engine.VideoTrackTranscoder.setup(VideoTrackTranscoder.java:89)
                                                                          at net.ypresto.androidtranscoder.engine.MediaTranscoderEngine.setupTrackTranscoders(MediaTranscoderEngine.java:172)
                                                                          at net.ypresto.androidtranscoder.engine.MediaTranscoderEngine.transcodeVideo(MediaTranscoderEngine.java:96)
                                                                          at net.ypresto.androidtranscoder.MediaTranscoder$4.call(MediaTranscoder.java:184)
                                                                          at net.ypresto.androidtranscoder.MediaTranscoder$4.call(MediaTranscoder.java:166)
                                                                          at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                                                                          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
                                                                          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
                                                                          at java.lang.Thread.run(Thread.java:841)

Transcoding Webm to MP4

Hi,

I'm trying to transcode from webm to mp4 and I get the following exception:

java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference at android.media.MediaFormat.getInteger(MediaFormat.java:524)

is that supported? many thanks

why only 16:9 is supported?

I use this lib in my project, found some videos can not be processed, logs like this:
" transcodeThis video is not 16:9, and is not able to transcode." .

PassThroughTrackTranscoder hangs with non-baseline profile video

Hangs on mMuxer.writeSampleData() on PassThroughTrackTranscoder when transcoing mp4 file encoded on iOS (AVAssetExportSession).
It might because of main profile video file, as Android only supports and assumes baseline profile (it always overwrites profile to baseline in cpp source code...).
(NOTE: iPhone <=4S exports baseline, iPhone >=5 exports main profile)

MediaMuxer.cpp line 179 says writeSampleData will block if buffer is starved.

Perhaps hangs on wait() at MediaAdapter line 120.

Further investigation on libstagefright is required to identify actual problem.

Error transcoding UHD 3840x2160 video from a Samsung Galaxy S6 EDGE (SM-G925F)

I/OMXMaster: makeComponentInstance(OMX.Exynos.AVC.Encoder) in mediacodec process
I/OMXMaster: makeComponentInstance(OMX.Exynos.avc.dec) in mediacodec process
I/MediaCodec: [OMX.Exynos.avc.dec] setting surface generation to 32390146
E/MediaCodec: Codec reported err 0xffffec77, actionCode 0, while in state 3
E/MediaCodec: configure failed with err 0xffffec77, resetting...
I/MediaCodec: Codec shutdown complete
I/OMXMaster: makeComponentInstance(OMX.Exynos.avc.dec) in mediacodec process
I/MediaCodec: Codec shutdown complete
I/MediaCodec: Codec shutdown complete
I/MediaCodec: Codec shutdown complete
E/MediaTranscoder: Fatal error while transcoding, this might be invalid format or bug in engine or Android.
                        android.media.MediaCodec$CodecException: Error 0xffffec77
                            at android.media.MediaCodec.native_configure(Native Method)
                            at android.media.MediaCodec.configure(MediaCodec.java:1882)
                            at net.ypresto.androidtranscoder.engine.VideoTrackTranscoder.setup(VideoTrackTranscoder.java:89)
                            at net.ypresto.androidtranscoder.engine.MediaTranscoderEngine.setupTrackTranscoders(MediaTranscoderEngine.java:172)
                            at net.ypresto.androidtranscoder.engine.MediaTranscoderEngine.transcodeVideo(MediaTranscoderEngine.java:96)
                            at net.ypresto.androidtranscoder.MediaTranscoder$4.call(MediaTranscoder.java:184)
                            at net.ypresto.androidtranscoder.MediaTranscoder$4.call(MediaTranscoder.java:166)
                            at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
                            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
                            at java.lang.Thread.run(Thread.java:762)
E/ProcessMessageAssetJob: android.media.MediaCodec$CodecException: Error 0xffffec77
                       com.myproject.package.repository.messaging.FileProcessingException: android.media.MediaCodec$CodecException: Error 0xffffec77
                           at com.myproject.package.media.VideoProcessor.processFile(VideoProcessor.java:57)
                           at com.myproject.package.repository.messaging.ProcessMessageAssetJob.onRun(ProcessMessageAssetJob.java:59)
                           at com.path.android.jobqueue.Job.safeRun(Job.java:189)
                           at com.path.android.jobqueue.JobHolder.safeRun(JobHolder.java:91)
                           at com.path.android.jobqueue.executor.JobConsumerExecutor$JobConsumer.run(JobConsumerExecutor.java:306)
                           at java.lang.Thread.run(Thread.java:762)
                        Caused by: android.media.MediaCodec$CodecException: Error 0xffffec77
                           at android.media.MediaCodec.native_configure(Native Method)
                           at android.media.MediaCodec.configure(MediaCodec.java:1882)
                           at net.ypresto.androidtranscoder.engine.VideoTrackTranscoder.setup(VideoTrackTranscoder.java:89)
                           at net.ypresto.androidtranscoder.engine.MediaTranscoderEngine.setupTrackTranscoders(MediaTranscoderEngine.java:172)
                           at net.ypresto.androidtranscoder.engine.MediaTranscoderEngine.transcodeVideo(MediaTranscoderEngine.java:96)
                           at net.ypresto.androidtranscoder.MediaTranscoder$4.call(MediaTranscoder.java:184)
                           at net.ypresto.androidtranscoder.MediaTranscoder$4.call(MediaTranscoder.java:166)
                           at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                           at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
                           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
                           at java.lang.Thread.run(Thread.java:762) 

Sometimes, "mFuture.cancel(true);" doesn't work

Sometimes, "mFuture.cancel(true);" doesn't work when I want to stop the transcoding. It will happen, if I transcode a particular video, and other videos are fine. What is the reason of this?

net.ypresto.androidtranscoder.engine.InvalidOutputFormatException: Video codecs other than AVC is not supported, actual mime type: video/mp4v-es

Hi i am got below issue ......Please help me how to solved the problem.........I am used Android marshmallow moto g phone.

Fatal error while transcoding, this might be invalid format or bug in engine or Android.
net.ypresto.androidtranscoder.engine.InvalidOutputFormatException: Video codecs other than AVC is not supported, actual mime type: video/mp4v-es
at net.ypresto.androidtranscoder.engine.MediaFormatValidator.validateVideoOutputFormat(MediaFormatValidator.java:35)
at net.ypresto.androidtranscoder.engine.MediaTranscoderEngine$1.onDetermineOutputFormat(MediaTranscoderEngine.java:162)
at net.ypresto.androidtranscoder.engine.QueuedMuxer.onSetOutputFormat(QueuedMuxer.java:66)
at net.ypresto.androidtranscoder.engine.QueuedMuxer.setOutputFormat(QueuedMuxer.java:61)
at net.ypresto.androidtranscoder.engine.AudioTrackTranscoder.drainEncoder(AudioTrackTranscoder.java:160)
at net.ypresto.androidtranscoder.engine.AudioTrackTranscoder.stepPipeline(AudioTrackTranscoder.java:90)
at net.ypresto.androidtranscoder.engine.MediaTranscoderEngine.runPipelines(MediaTranscoderEngine.java:192)
at net.ypresto.androidtranscoder.engine.MediaTranscoderEngine.transcodeVideo(MediaTranscoderEngine.java:97)
at net.ypresto.androidtranscoder.MediaTranscoder$4.call(MediaTranscoder.java:184)
at net.ypresto.androidtranscoder.MediaTranscoder$4.call(MediaTranscoder.java:166)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.