arthenica / ffmpeg-kit

FFmpeg Kit for applications. Supports Android, Flutter, iOS, Linux, macOS, React Native and tvOS. Supersedes MobileFFmpeg, flutter_ffmpeg and react-native-ffmpeg.
https://arthenica.github.io/ffmpeg-kit
GNU Lesser General Public License v3.0
4.33k stars 580 forks source link

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? #962

Open JeremyTanZone opened 5 months ago

JeremyTanZone commented 5 months ago

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

Other Add any other context about the problem here.

tanersener commented 5 months ago

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?

JeremyTanZone commented 5 months ago

@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 commented 5 months ago

@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.

tanersener commented 5 months ago

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.

AnshulRaghav commented 2 months ago

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?

JeremyTanZone commented 2 months ago

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