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

Trim and Merge issue #189

Open
AsynctaskCoffee opened this issue Dec 14, 2023 · 0 comments
Open

Trim and Merge issue #189

AsynctaskCoffee opened this issue Dec 14, 2023 · 0 comments

Comments

@AsynctaskCoffee
Copy link

When I trim and merge multiple videos I can see there are some glitches from output video (on video switches).

I am using

` private lateinit var builder: TranscoderOptions.Builder
private var mTranscodeVideoStrategy: TrackStrategy? = null

private var mTranscodeOutputFile: File? = null

init {
    mTranscodeVideoStrategy = DefaultVideoStrategy.Builder()
        .addResizer(MyExactResizer(1080, 1920))
        .frameRate(30)
        .build()
}

fun setVideos(
    mTranscodeOutputFile: File?,
    videoList: ArrayList<AnalyzeResult>,
    context: Context,
    musicPath: String?
) {
    this.mTranscodeOutputFile = mTranscodeOutputFile
    builder = Transcoder.into(mTranscodeOutputFile!!.absolutePath)
    videoList.forEach {
        val start: Long = (max(0, it.startMs!!) * 1000).toLong()
        val end: Long = (max(0, it.duration!! + it.startMs!!) * 1000).toLong()
        builder.addDataSource(
            TrackType.VIDEO,
            ClipDataSource(
                UriDataSource(context, Uri.parse(it.mediaPath)),
                start,
                end
            )
        )
    }
    musicPath?.let {
        builder.addDataSource(TrackType.AUDIO, context, Uri.parse(it))
    }
}

fun processVideo(transcoderListener: TranscoderListener) {
    builder
        .setListener(transcoderListener)
        .setVideoTrackStrategy(mTranscodeVideoStrategy)
        .transcode()
}`

Any recommendations ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant