Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BlankAudioDataSource makes transcoding stuck forever. #180

Closed
timcreatedit opened this issue Jan 4, 2023 · 9 comments
Closed

BlankAudioDataSource makes transcoding stuck forever. #180

timcreatedit opened this issue Jan 4, 2023 · 9 comments
Labels
bug Something isn't working needs-investigation

Comments

@timcreatedit
Copy link

When adding a BlankAudioDataSource with any duration to a Transcoder, the transcoding process gets stuck forever with the following log:

V/TranscodeEngine( 9241): transcode(): executed step=53 advanced=false completed=false
V/Segment(AUDIO,0)( 9241): canAdvance(): state=State.Wait
V/Pipeline(Audio)( 9241): execute(): starting. head=0 steps=6 remaining=6
I/Decoder(AUDIO,0)( 9241): buffer() failed. dequeuedInputs=0 dequeuedOutputs=4
V/Reader  ( 9241): Returning State.Wait because buffer is null.
V/Pipeline(Audio)( 9241): execute(): step Reader (#0/6) is waiting. headState=State.Ok(kotlin.Unit) headIndex=0
V/Segment(VIDEO,0)( 9241): canAdvance(): state=State.Eos(kotlin.Unit)
V/Segments( 9241): hasNext(VIDEO): segment=com.otaliastudios.transcoder.internal.Segment@c6c217a lastIndex=0 canAdvance=false
V/Segment(VIDEO,0)( 9241): canAdvance(): state=State.Eos(kotlin.Unit)
V/Segment(AUDIO,0)( 9241): canAdvance(): state=State.Wait
V/Segments( 9241): hasNext(AUDIO): segment=com.otaliastudios.transcoder.internal.Segment@5463bad lastIndex=0 canAdvance=true
V/Segment(AUDIO,0)( 9241): canAdvance(): state=State.Wait
V/TranscodeEngine( 9241): transcode(): executed step=53 advanced=false completed=false
V/Segment(AUDIO,0)( 9241): canAdvance(): state=State.Wait
V/Pipeline(Audio)( 9241): execute(): starting. head=0 steps=6 remaining=6
I/Decoder(AUDIO,0)( 9241): buffer() failed. dequeuedInputs=0 dequeuedOutputs=4
V/Reader  ( 9241): Returning State.Wait because buffer is null.
V/Pipeline(Audio)( 9241): execute(): step Reader (#0/6) is waiting. headState=State.Ok(kotlin.Unit) headIndex=0
V/Segment(VIDEO,0)( 9241): canAdvance(): state=State.Eos(kotlin.Unit)
V/Segments( 9241): hasNext(VIDEO): segment=com.otaliastudios.transcoder.internal.Segment@c6c217a lastIndex=0 canAdvance=false

and so on...

I tried to modify the readTrack function in BlankAudioDataSource but to no avail.
Not sure if @natario1 is still maintaining this repo, but maybe @mudar can help out as the original author of #64

Thank you so much!

@mudar
Copy link
Collaborator

mudar commented Jan 4, 2023

Did you add a valid video track along with the blank audio?

@timcreatedit
Copy link
Author

timcreatedit commented Jan 4, 2023

Hey, thanks for your super quick response!

We are basically doing this:

                val datasource = UriDataSource(context, sourcePathUri)

                datasource.initialize()
                val transcoder = Transcoder.into(destPath)
                    .addDataSource(TrackType.VIDEO, datasource)
                    .addDataSource(TrackType.AUDIO, BlankAudioDataSource(datasource.durationUs))

Without adding the BlankAudioDatasource, this code works fine. Once we add it, it is stuck infinitely as mentioned above.

@timcreatedit
Copy link
Author

Our main goal is the problem you had originally as well, where we can't concat videos with audio tracks together with videos without audio tracks, although we might be missing something of course

@mudar
Copy link
Collaborator

mudar commented Jan 4, 2023

It's been a while since I worked on this, so I'm not sure I can help with the code!
Looking at the PR, I have the impression that adding the blankAudio is handled internally by the transcoder. You could try concatenating the two videos (with/without audio tracks) and see if that works 🤞

@timcreatedit
Copy link
Author

timcreatedit commented Jan 4, 2023

If we try to concatenate video with audio with video without audio, we run into the same problem as you did in #51
It seems like the audioTracks getter doesn’t do it’s job (anymore), or we're potentially missing something

thanks again for your help, it is really appreciated

@timcreatedit
Copy link
Author

https://github.com/natario1/Transcoder/blob/ba8f098c9461a12da1c11d26c9f32feb1e69b4d5/lib/src/main/java/com/otaliastudios/transcoder/internal/DataSources.kt#L53

This looks like it should fill missing audio tracks with BlankAudioDataSources automatically

@VOstopolets
Copy link

@timcreatedit Hi. Any updates about this issue?

@jordond
Copy link

jordond commented Apr 30, 2023

Experiencing the same thing over here. Hoping for some updates.

@natario1 natario1 added bug Something isn't working needs-investigation labels Aug 11, 2024
@natario1
Copy link
Member

natario1 commented Sep 7, 2024

I can't reproduce this anymore, it should be fixed in latest version.

@natario1 natario1 closed this as completed Sep 7, 2024
natario1 added a commit that referenced this issue Sep 10, 2024
* Add test for issue 180

* Bump version to 0.11.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-investigation
Projects
None yet
Development

No branches or pull requests

5 participants