ffmpeg-kit icon indicating copy to clipboard operation
ffmpeg-kit copied to clipboard

When I used the latest version of the 6.0-2 library to mix audio and video on the Android platform, I found that the -shortest parameter did not work. But there was no such problem before version 6.0. Can you fix this bug?

Open JeremyTanZone opened this issue 1 year ago • 6 comments
trafficstars

Description When I used the latest version of the 6.0-2 library to mix audio and video on the Android platform, I found that the -shortest parameter did not work. But there was no such problem before version 6.0. Can you fix this bug? Because sometimes the duration of the audio is longer than the duration of the video, the -shortest parameter must be used. This is the command used to mix audio and video: ffmpeg
-i video1.mp4 -i audio1.mp3
-c:v copy
-map 0:v -map 1:a
-shortest
-y output.mp4

Expected behavior Hope the -shortest parameter will take effect, like in versions before 6.0. Because sometimes the duration of the audio is longer than the duration of the video, the -shortest parameter must be used.

Current behavior Mix audio and video on the Android platform, the -shortest parameter did not work,when the audio duration is longer than the video duration.

To Reproduce

Screenshots If applicable, add screenshots to help explain your problem.

Logs

Environment

  • Platform: Android
  • Architecture: arm-v7a, arm-v7a-neon, arm64-v8a,
  • Version: v6.0-2/v6.0-2.LTS
  • Source branch: main, development
  • Android Studio version: 4.0
  • Android NDK version: r21b

Other Add any other context about the problem here.

JeremyTanZone avatar Apr 16 '24 05:04 JeremyTanZone

It sounds like this is coming from FFmpeg. Either it is a bug or a change in FFmpeg behaviour.

Can you test your command in desktop FFmpeg 6.0 and share the results?

tanersener avatar Apr 16 '24 10:04 tanersener

@tanersener I tested this command of mine in desktop FFmpeg 6.0 and got the same results.(The -shortest parameter did not work. )

It should be a bug in FFmpeg 6.0 itself, or a change in the behavior of FFmpeg 6.0.

Test Environment Platform: Mac Desktop System: macOS Sonoma 14.2.1 FFmpeg Version: 6.0-tessus

Thanks for your reply

JeremyTanZone avatar Apr 17 '24 04:04 JeremyTanZone

@tanersener

Later, I tried it in desktop FFmpeg 6.0.1 and desktop FFmpeg 6.1.1 respectively. The -shortest parameter did not work in desktop FFmpeg 6.0.1, but it worked in desktop FFmpeg 6.1.1.

Maybe it's a bug in FFmpeg 6.0 and FFmpeg 6.0.1, but this bug is fixed in FFmpeg 6.1.1

-shortest Parameter is invalid: FFmpeg 6.0 and FFmpeg 6.0.1 -shortest Parameter is valid: FFmpeg 6.1.1 and before FFmpeg 6.0

Test Environment Platform: Mac Desktop System: macOS Sonoma 14.2.1 FFmpeg Version: 6.0.1-tessus,6.1.1-tessus

This is the command used to mix audio and video: ffmpeg -i video1.mp4 -i audio1.mp3 -c:v copy -map 0:v -map 1:a -shortest -y output.mp4

Can you upgrade the version of FFmpeg in your library to 6.1.1 on the Android platform?

Thanks.

JeremyTanZone avatar Apr 17 '24 05:04 JeremyTanZone

Thanks for the tests. This confirms that it is an ffmpeg bug.

I don't have a date for the FFmpeg update. The plan is to complete it in the next few months. Until then, you can change the version yourself, in this line. That line defines which FFmpeg version will be compiled.

tanersener avatar Apr 17 '24 10:04 tanersener

Thanks for the tests. This confirms that it is an ffmpeg bug.

I don't have a date for the FFmpeg update. The plan is to complete it in the next few months. Until then, you can change the version yourself, in this line. That line defines which FFmpeg version will be compiled.

@tanersener would it be possible for you to share some links or steps to perform this for react-native-ffmpeg if someone is not well aware of the flow?

AnshulRaghav avatar Jun 29 '24 15:06 AnshulRaghav

  您发给我的信件已经收到。I have already received the letter you sent me.  

JeremyTanZone avatar Jun 29 '24 15:06 JeremyTanZone