linkedin / LiTr

Lightweight hardware accelerated video/audio transcoder for Android.
BSD 2-Clause "Simplified" License
611 stars 85 forks source link

Unable to transcode a specific video #79

Open niekdev opened 3 years ago

niekdev commented 3 years ago

I am unable to trim a large (4GB, 1:20h) video. The video that I am using is the open source Sita Sings the Blues, which can be downloaded from here (direct download). My trimmer is set from 300 seconds till 900 seconds.

Approximately 6 minutes after the "transcode" button has been pressed, the Encoder produced EoS, we are done message is shown in the logs. No new logs follow after that and the transcoder progress bar stops progressing.

I've attached two screenshots, one of the demo's state before I press "transcode" and one after the encoder thinks its job is done, which is the final state until the user interacts with it (cancel / kill app) Screenshot 2021-01-12 at 17 02 29Screenshot 2021-01-12 at 17 02 38

Video file info according to FFmpeg:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Sita_Sings_the_Blues_1080p.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 1
    compatible_brands: mp42mp41
    creation_time   : 2009-03-03T03:16:55.000000Z
  Duration: 01:21:31.22, start: 0.000000, bitrate: 7243 kb/s
    Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 7000 kb/s, 23.98 fps, 23.98 tbr, 90k tbn, 47.95 tbc (default)
    Metadata:
      creation_time   : 2009-03-03T03:16:55.000000Z
      handler_name    : Apple Video Media Handler
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 238 kb/s (default)
    Metadata:
      creation_time   : 2009-03-03T03:16:55.000000Z
      handler_name    : Apple Sound Media Handler
    Stream #0:2(eng): Data: none (mp4s / 0x7334706D) (default)
    Metadata:
      creation_time   : 2009-03-03T03:16:55.000000Z
      handler_name    : Apple MPEG-4 Scene Media Handler
    Stream #0:3(eng): Data: none (mp4s / 0x7334706D) (default)
    Metadata:
      creation_time   : 2009-03-03T03:16:55.000000Z
      handler_name    : Apple MPEG-4 ODSM Media Handler

Logs: logs.txt

Environment: Device: Pixel 3 OS: Android 11 LiTr version: 1.4.4

izzytwosheds commented 3 years ago

You are really putting LiTr through some stress testing, I love that. 😄 I will download the video and experiment with it.

niekdev commented 3 years ago

It's great that there's an active android transcoder repo available :D

I've got some new findings. When either the video or audio track is excluded, the transcoder finishes using the aforementioned video. So unticking track 0: (video/avc) or track 1: (audio/mp4a-latm) results in successful video (without sound or video, of course)

niekdev commented 3 years ago

Hey @izzytwosheds, just wondering if you were able to reproduce it. I sadly only have a single device at my disposal for testing.

izzytwosheds commented 3 years ago

I was able to reproduce it on Samsung Note 10. Looks like this is device independent issue. I will look into this.

niekdev commented 3 years ago

Always a good sign haha, thanks for looking into it!

izzytwosheds commented 3 years ago

I looked into this. The problem is with generic (non-video or non-audio) tracks, included in that video. LiTr can't trim them. I will look into the root cause separately. For now, I added an ability in demo app to exclude non-generic tracks. With those tracks excluded, everything works.

niekdev commented 3 years ago

Awesome, thanks a lot. I've tested the new demo app and it indeed works when the non-video/audio tracks are excluded. I'll leave this ticket open since it hasn't been fixed on library level yet.

xiaozhao0331 commented 3 years ago

For the same problem, I can't even get the failed callback to handle the response. Finally, I found that from class TransformationJob

@VisibleForTesting
protected void error(@Nullable Throwable cause) {
    release(false);
    marshallingTransformationListener.onError(jobId, cause, statsCollector.getStats());
}

when the release(); executed. the anther method whill not execute; Maybe you should change execution order. btw can i have the ability demo.