FFmpeg - how to adjust video (clip) duration to sound duration if sound is longer, possible without re-encoding it with mp3 file? I have a problem. I have recorded my videos separately, and then added sound to it. Sometimes, sound is longer or less in duration compared to video duration. Usually sound is longer, sometimes around 20 seconds. To me, when running on my PC through flv or some Windows Media player, that is not problem, since after video is over, last capture of video stays displayed (like an image), and sounds is still executing, and video ends after sound is over. So everything is ok at my PC when running it like .flv or .mp4 file. But, when I upload that on Google drive or some other place on web (that is, when I run it in my browser for viewing after upload), I see my video is cutted to the lenght of the video duration (so my sound is cutted). I understand that this is because of different duration sizes of sound and video.

Now I need a command with ffmpeg that can make my video to be extened to my sound duration. I would like not to reencode my videos with sound again (in sense that I would need to put my mp3 file in ffmpeg command) if I don't need (since I have many videos and sound is already inserted in them), but just to re-encode video with some ffmpeg command to extend video lenght to sound lenght.

I have watched this (not sure at the momen if this would even help me): https://superuser.com/questions/801547/ffmpeg-add-audio-but-keep-video-length-the-same-not-shortest

But with this approach, you have to reencode video with sound (mp3 or similar) file first.

Can it be done, and what would be command, or commands for it? (And if only way is to re-encode it with mp3 file, what would be command for it?)

Edit: I don't want to cut my sound, I need to hold last frame till my sound is over. Currently last frame is holded only when viewing on my PC, when I upload that, clip is cutted immediately when video stops.
You can hack this using mp4fpsmod (direct link to Win binary; C++ source at https://github.com/nu774/mp4fpsmod).

First step is to extract the timestamps of the existing video

mp4fpsmod -p vid_tc.txt vid.mp4


This will produce a text file like this

# timecode format v2
0
40
80
120
... 
4880
4920
4960


Each line contains the timestamp of frame #N in milliseconds.

In this example, each frame is 40 milliseconds long and the last frame is shown at 4960 ms and hence the video stream is 5 seconds long.

Now suppose your audio is 11.34 seconds == 11340 ms long. Edit the last timecode to something just under 11340, like 11320.

# timecode format v2
0
40
80
120
... 
4880
4920
11320


and then run

mp4fpsmod -x -T keep -t vid_tc.txt -o vid_new.mp4 vid.mp4


This will create a new file vid_new.mp4, which you can upload. The duration shown in desktop players or tools can be wrong, but playback should be as desired, except that the last frame is shown along with the end of the audio. This skips re-encoding and is quick. You can add -i and skip -o vid_new.mp4 if you want to edit the timecode in-place in existing file i.e. 

mp4fpsmod -x -T keep -t vid_tc.txt -i vid.mp4


but I don't recommend it.