madhavanmalolan / ffmpegandroidlibrary

One line integration for FFMPEG Library in Android
MIT License
90 stars 15 forks source link

Command to cut video #20

Closed GunaseelanArumaikkannu closed 6 years ago

GunaseelanArumaikkannu commented 6 years ago

I used following command to copy video and its working.

val array2 = arrayOf("-y",
                            "-i",
                            selectedImagePath,
                            "-vcodec",
                            "copy",
                            "-an",
                            file.absolutePath)

I am using following command to cut video, but its not working.

val array = arrayOf(
                            "-i",
                            selectedImagePath,
                            "-ss",
                            "00:00:00:000",
                            "-t",
                            "00:00:30:000",
                            "-c copy",
                            file.absolutePath)

Any help or correction on query will be useful for me.

madhavanmalolan commented 6 years ago

What do you mean it is not working? Is it crashing? If yes, please share the crash logs Or is it not giving the expected output? If yes, please state the expected and obtained outputs

madhavanmalolan commented 6 years ago

There are multiple errors in the command you are trying to run.

  1. time durations are of the format hh:mm:ss. So it should be 00:00:00 instead of 00:00:00:000
  2. The correct command to clip is : ffmpeg -i input.mp4 -ss 00:00:01 -to 00:00:02 -async 1 output.mp4 Please correct your array accordingly

Closing issue because this is FFMPEG command help not a library issue.

GunaseelanArumaikkannu commented 6 years ago

I changed my array as

val array = arrayOf("-i",
                            "/storage/emulated/0/DCIM/Camera/VID_20180429_201732.mp4",
                            "-ss 00:00:01",
                            "-to 00:00:30",
                            "-async 1",
                            "/storage/emulated/0/DCIM/Camera/first_30.mp4")

Now also I am getting same log. The log message is

I/Videokit: start run in main.
    register_exit
I/Videokit: term_init & parse options.
D/Videokit: ERROR OCCURED

I didn't say its library issue. I just need help. Can you help me regards this?

madhavanmalolan commented 6 years ago

Please change it to

val array = arrayOf("-i",

"/storage/emulated/0/DCIM/Camera/VID_20180429_201732.mp4", "-ss","00:00:01", "-to","00:00:30", "-async","1", "/storage/emulated/0/DCIM/Camera/first_30.mp4")

On Wed 9 May, 2018, 5:35 PM Gunaseelan A, notifications@github.com wrote:

I changed my array as

val array = arrayOf("-i", "/storage/emulated/0/DCIM/Camera/VID_20180429_201732.mp4", "-ss 00:00:01", "-to 00:00:30", "-async 1", "/storage/emulated/0/DCIM/Camera/first_30.mp4")

Now also I am getting same log. The log message is

I/Videokit: start run in main. register_exit I/Videokit: term_init & parse options. D/Videokit: ERROR OCCURED

I didn't say its library issue. I just need help. Can you help me regards this?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/madhavanmalolan/ffmpegandroidlibrary/issues/20#issuecomment-387716845, or mute the thread https://github.com/notifications/unsubscribe-auth/ACA3Ff_PKQUujqpxVa3Bjo_yBImsOCMXks5twttzgaJpZM4T3-kn .

GunaseelanArumaikkannu commented 6 years ago

Hi Friend, I have tried following command with ffmpeg-android its working, but very slow.

val command = arrayOf("-i", selectedImagePath, "-ss", "00:00:01", "-to", "00:00:30", "-async", "1", file.absolutePath)
execFFmpegBinary(command)

But when I try to run the same command using our library, its not working, and it just reloads the activity.

val command = arrayOf("-i", selectedImagePath, "-ss", "00:00:01", "-to", "00:00:30", "-async", "1", file.absolutePath)
instance?.run(command)

Update

When I change the command as following and run with ffmpeg-android its finished in fraction of seconds.

val command = arrayOf("-i", selectedImagePath, "-ss", "00:00:01", "-to", "00:00:30", "-async", "1", "-c", "copy", file.absolutePath)

Can you take a look on it.