Comments (7)
How many are you concatenating?
How long is the delay, ms or seconds?
If the length of the audio track of the videos doesn't match exactly the length of the video track then this will happen.
from transcoder.
I'm concatenating around 10 videos.
The delay reach almost a second.
Yhea, that's exactly what's happening. Recording videos from phone camera can give a different video/audio length file and it would be really nice to have some option for the transcoder to take care of this problem since could be a common use of appending videos from phone camera.
from transcoder.
You can maybe work around it by trimming your audio data source to match the video counter part:
var videoDataSource:DataSource = UriDataSource(context, videoUri);
var audioDataSource:DataSource = UriDataSource(context, audioUri);
if (videoDataSource.durationUs > audioDataSource.durationUs) {
videoDataSource = TrimDataSource(videoDataSource, 0, videoDataSource.durationUs - audioDataSource.durationUs)
} else if (videoDataSource.durationUs < audioDataSource.durationUs) {
audioDataSource = TrimDataSource(videoDataSource, 0, audioDataSource.durationUs - videoDataSource.durationUs)
}
builder.addDataSource(TrackType.AUDIO, audioDataSource)
builder.addDataSource(TrackType.VIDEO, videoDataSource)
(I didn't test this code)
from transcoder.
@cbernier2 in this case I will have to split the video and audio in two different files before apply this code. I think appending videos should somehow apply a fix to avoid out of sync problem automatically since it's a common practice.
from transcoder.
@buntupana You don't have to split the video and audio, use the same file and by specifying TrackType.AUDIO, the transcoder will know to apply the Trim to only the audio.
from transcoder.
var videoDataSource:DataSource = UriDataSource(context, videoUri); <-same uri for both
var audioDataSource:DataSource = UriDataSource(context, audioUri); <-same uri for both
if (videoDataSource.durationUs > audioDataSource.durationUs) { <-same lenght
@cbernier2 Hi,
If I have one .mp4 file, putting it into a videoDataSource and audioDataSource will produce the SAME .durationUs results, since we created the video and audio datasource from the same file. We cannot compare them, as they are the same.
I have the exact same problem as @buntupana, as my audio gets out of sync more and more, the more files I append
@buntupana, have you found any solution?
from transcoder.
@gaborSomogyvari finally I decided to switch to a ffmpeg library
from transcoder.
Related Issues (20)
- MPEG4 movie File Encoding fails(H.264) HOT 1
- Does not transcode when setSpeed(0.5F) or less 1 HOT 1
- java.lang.NullPointerException: Attempt to invoke interface method 'boolean com.otaliastudios.transcoder.source.DataSource.isInitialized()' on a null object reference HOT 5
- aspect ration in merge HOT 1
- BlankAudioDataSource makes transcoding stuck forever. HOT 8
- java.lang.IllegalStateException: Can't stop due to wrong state(INITIALIZED) HOT 1
- java.lang.NullPointerException: buffers.getOutputBuffer(result) must not be null
- How to get demo app?
- Output to a Surface instead of a file HOT 1
- BufferOverflowException (ref #163) #164 is not fixed in implementation 'com.github.jumperson:transcoder:0.10.4.2' HOT 2
- Failed to initialize video/dolby-vision
- Trim and Merge issue
- Update the nuget to the latest version
- HDR Tone Mapping
- [Q] MP4 concatenation with Video PassThroughTrackStrategy does nothing
- Video returns as a 0 bytes file for high quality videos, specifically with videos with HEVC codec
- Will the library be maintained and updated?
- targetSdk = 34 A permission request failure message is always displayed
- 不支持压缩视频功能吗
- java.lang.IllegalArgumentException: bufferInfo must specify a valid buffer offset, size and presentation time
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from transcoder.