|
|
|
|
@ -11,9 +11,7 @@ import android.os.Environment |
|
|
|
|
import android.os.IBinder |
|
|
|
|
import android.provider.MediaStore |
|
|
|
|
import androidx.core.content.FileProvider |
|
|
|
|
import com.arthenica.mobileffmpeg.Config.RETURN_CODE_CANCEL |
|
|
|
|
import com.arthenica.mobileffmpeg.Config.RETURN_CODE_SUCCESS |
|
|
|
|
import com.arthenica.mobileffmpeg.FFmpeg |
|
|
|
|
import com.arthenica.ffmpegkit.FFmpegKit |
|
|
|
|
import io.realm.Realm |
|
|
|
|
import kotlinx.coroutines.* |
|
|
|
|
import net.pokeranalytics.android.R |
|
|
|
|
@ -180,17 +178,18 @@ class ReplayExportService : Service() { |
|
|
|
|
|
|
|
|
|
Timber.d("Assembling images for video...") |
|
|
|
|
|
|
|
|
|
FFmpeg.executeAsync("-f concat -safe 0 -i $dpath -vb 20M -vsync vfr -s ${width}x${height} -vf fps=20 -pix_fmt yuv420p $output") { id, rc -> |
|
|
|
|
val command = "-f concat -safe 0 -i $dpath -vb 20M -vsync vfr -s ${width}x${height} -vf fps=20 -pix_fmt yuv420p $output" |
|
|
|
|
FFmpegKit.executeAsync(command) { |
|
|
|
|
|
|
|
|
|
when (rc) { |
|
|
|
|
RETURN_CODE_SUCCESS -> { |
|
|
|
|
when { |
|
|
|
|
it.returnCode.isSuccess -> { |
|
|
|
|
Timber.d("FFMPEG command execution completed successfully") |
|
|
|
|
} |
|
|
|
|
RETURN_CODE_CANCEL -> { |
|
|
|
|
it.returnCode.isCancel -> { |
|
|
|
|
Timber.d("Command execution cancelled by user.") |
|
|
|
|
} |
|
|
|
|
else -> { |
|
|
|
|
Timber.d(String.format("Command execution failed with rc=%d and the output below.", rc)) |
|
|
|
|
Timber.d(String.format("Command execution failed with rc=%d and the output below.", it.returnCode.value)) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -378,15 +377,32 @@ class ReplayExportService : Service() { |
|
|
|
|
Environment.getExternalStorageState(tmpDir) |
|
|
|
|
|
|
|
|
|
Timber.d("Assembling images for video...") |
|
|
|
|
FFmpeg.executeAsync("-f concat -safe 0 -i $dpath -vb 20M -vsync vfr -s ${width}x${height} -vf fps=20 -pix_fmt yuv420p $output") { id, rc -> |
|
|
|
|
|
|
|
|
|
if (rc == RETURN_CODE_SUCCESS) { |
|
|
|
|
Timber.d("FFMPEG command execution completed successfully") |
|
|
|
|
} else if (rc == RETURN_CODE_CANCEL) { |
|
|
|
|
Timber.d("Command execution cancelled by user.") |
|
|
|
|
} else { |
|
|
|
|
Timber.d(String.format("Command execution failed with rc=%d and the output below.", rc)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val command = "-f concat -safe 0 -i $dpath -vb 20M -vsync vfr -s ${width}x${height} -vf fps=20 -pix_fmt yuv420p $output" |
|
|
|
|
FFmpegKit.executeAsync(command) { |
|
|
|
|
|
|
|
|
|
when { |
|
|
|
|
it.returnCode.isSuccess -> { |
|
|
|
|
Timber.d("FFMPEG command execution completed successfully") |
|
|
|
|
} |
|
|
|
|
it.returnCode.isCancel -> { |
|
|
|
|
Timber.d("Command execution cancelled by user.") |
|
|
|
|
} |
|
|
|
|
else -> { |
|
|
|
|
Timber.d(String.format("Command execution failed with rc=%d and the output below.", it.returnCode.value)) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// FFmpeg.executeAsync("-f concat -safe 0 -i $dpath -vb 20M -vsync vfr -s ${width}x${height} -vf fps=20 -pix_fmt yuv420p $output") { id, rc -> |
|
|
|
|
// |
|
|
|
|
// if (rc == RETURN_CODE_SUCCESS) { |
|
|
|
|
// Timber.d("FFMPEG command execution completed successfully") |
|
|
|
|
// } else if (rc == RETURN_CODE_CANCEL) { |
|
|
|
|
// Timber.d("Command execution cancelled by user.") |
|
|
|
|
// } else { |
|
|
|
|
// Timber.d(String.format("Command execution failed with rc=%d and the output below.", rc)) |
|
|
|
|
// } |
|
|
|
|
// Delete descriptor and image files |
|
|
|
|
// tmpDir.delete() |
|
|
|
|
// File(dpath).delete() |
|
|
|
|
|