Cannot transforming hls to mp4 using InAppMuxer.Factory.
Version
Media3 1.1.1
More version details
No response
Devices that reproduce the issue
Android emulator API34 - Google APIs Intel x86_64 system image
Devices that do not reproduce the issue
No response
Reproducible in the demo app?
Yes
Reproduction steps
- Update build.gradle of demo-transformer module, add dependency:
implementation project(modulePrefix + 'lib-exoplayer-hls')
- Update ConfigurationActivity of demo-transformer module, add hls url:
private static final String[] PRESET_FILE_URIS = {
"https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_4x3/bipbop_4x3_variant.m3u8",
...
};
private static final String[] PRESET_FILE_URI_DESCRIPTIONS = { // same order as PRESET_FILE_URIS
"Apple 4x3 basic stream (TS)",
...
}
- Update TransformerActivity of demo-transformer module, set InAppMuxer.Factory:
private Transformer createTransformer(@Nullable Bundle bundle, Uri inputUri, String filePath) {
...
if (!bundle.getBoolean(ConfigurationActivity.ABORT_SLOW_EXPORT)) {
transformerBuilder.setMuxerFactory(new InAppMuxer.Factory(C.TIME_UNSET, null));
}
...
}
- Run demo-transformer, click choose preset file, select Apple 4x3 basic stream (TS), then click the export button.
Expected result
Convert hls stream to MP4.
Actual result
TransformerActivity androidx.media3.demo.transformer E Export error
androidx.media3.transformer.ExportException: Unexpected runtime error
at androidx.media3.transformer.TransformerInternal.handleMessage(TransformerInternal.java:295)
at androidx.media3.transformer.TransformerInternal.$r8$lambda$0Eq5y0bhoOvqh9wEU99UtqZE5oc(Unknown Source:0)
at androidx.media3.transformer.TransformerInternal$$ExternalSyntheticLambda3.handleMessage(Unknown Source:2)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loopOnce(Looper.java:205)
at android.os.Looper.loop(Looper.java:294)
at android.os.HandlerThread.run(HandlerThread.java:67)
Caused by: java.lang.IllegalArgumentException: SPS data not found in csd0.
at androidx.media3.common.util.Assertions.checkArgument(Assertions.java:55)
at androidx.media3.muxer.Boxes.avcCBox(Boxes.java:861)
at androidx.media3.muxer.Boxes.codecSpecificBox(Boxes.java:510)
at androidx.media3.muxer.Boxes.videoSampleEntry(Boxes.java:526)
at androidx.media3.muxer.Mp4MoovStructure.moovMetadataHeader(Mp4MoovStructure.java:109)
at androidx.media3.muxer.Mp4Writer.assembleCurrentMoovData(Mp4Writer.java:143)
at androidx.media3.muxer.Mp4Writer.rewriteMoovWithMdatEmptySpace(Mp4Writer.java:256)
at androidx.media3.muxer.Mp4Writer.flushPending(Mp4Writer.java:281)
at androidx.media3.muxer.Mp4Writer.doInterleave(Mp4Writer.java:330)
at androidx.media3.muxer.Mp4Writer.access$600(Mp4Writer.java:44)
at androidx.media3.muxer.Mp4Writer$Track.writeSampleData(Mp4Writer.java:390)
at androidx.media3.muxer.Mp4Writer.writeSampleData(Mp4Writer.java:92)
at androidx.media3.muxer.Mp4Muxer.writeSampleData(Mp4Muxer.java:252)
at androidx.media3.transformer.InAppMuxer.writeSampleData(InAppMuxer.java:180)
at androidx.media3.transformer.MuxerWrapper.writeSample(MuxerWrapper.java:331)
at androidx.media3.transformer.SampleExporter.feedMuxer(SampleExporter.java:129)
at androidx.media3.transformer.SampleExporter.processData(SampleExporter.java:77)
at androidx.media3.transformer.TransformerInternal.drainExportersInternal(TransformerInternal.java:316)
at androidx.media3.transformer.TransformerInternal.handleMessage(TransformerInternal.java:281)
at androidx.media3.transformer.TransformerInternal.$r8$lambda$0Eq5y0bhoOvqh9wEU99UtqZE5oc(Unknown Source:0)
at androidx.media3.transformer.TransformerInternal$$ExternalSyntheticLambda3.handleMessage(Unknown Source:2)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loopOnce(Looper.java:205)
at android.os.Looper.loop(Looper.java:294)
at android.os.HandlerThread.run(HandlerThread.java:67)
Media
Not applicable
Bug Report
- [ ] You will email the zip file produced by
adb bugreportto [email protected] after filing this issue.
Thank you for reporting. The team will take a look at the issue
@lyh8577 Thank you for your patience. We have found some suspected root cause for this issue. We are still investigating it. Meanwhile can you please describe you scenario? Are you just trying to convert HLS to and MP4? Or eventually you want to apply some effects as well? If you want to apply some effects as well then the export should just work fine.
@SheenaChhabra I only convert HLS to MP4. Because the Transformer output is MP4, I want to use it as a converter.
Any update on this issue??
Hey @krishnasen2401, We are aiming to fix this issue in 1-2 weeks. We should be able to release this fix in the media3 1.3.1 version which is expected to get released in the first week of April.
Thanks for your patience.
Hey @krishnasen2401, The issue has been fixed now but unfortunately it will be available in next minor release i.e 1.4.0 which is planned to get released in July. I appreciate your patience.