-
Notifications
You must be signed in to change notification settings - Fork 171
Expand file tree
/
Copy pathFFmpegCommandService2.kt
More file actions
28 lines (24 loc) · 856 Bytes
/
Copy pathFFmpegCommandService2.kt
File metadata and controls
28 lines (24 loc) · 856 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package com.coder.ffmpegcommand.service
import android.app.IntentService
import android.content.Intent
import android.os.IBinder
import com.coder.ffmpeg.jni.FFmpegCommand
import java.io.File
import java.util.*
/**
* @author: AnJoiner
* @datetime: 20-6-28
*/
class FFmpegCommandService2 : IntentService("") {
override fun onBind(intent: Intent): IBinder? {
return null
}
override fun onHandleIntent(intent: Intent?) {
val videoPath = File(externalCacheDir, "test.mp4").absolutePath
val output = File(externalCacheDir, "output3.yuv").absolutePath
val cmd = "ffmpeg -y -i %s -an -c:v rawvideo -pixel_format yuv420p %s"
val result = String.format(Locale.CHINA, cmd, videoPath, output)
val strings: Array<String?> = result.split(" ").toTypedArray()
FFmpegCommand.runCmd(strings)
}
}