1

I had a corrupt screen recording, and I used mp4fixer to extract the raw h264 stream and the aac streams separately. The audio sounds just fine, but the h264 stream doesn't seem to have a well defined framerate (At least, I couldn't find it from mediainfo).

So I merged the audio and video with FFmpeg, and since I didn't specify a framerate, the final video was 25.000 FPS, and it ended up being longer than the audio.

I want to merge the two streams properly without dropping any frames, by scaling the video duration to match the audio.

I'm not very sure about how variable framerates are encoded, but general screen recordings show the video framerates as variable, while being close to 44.7 FPS at average (min ~5, max ~57). The recovered stream may have lost some frames in addition, but the video is quite playable now.

1 Answer 1

0

I ended up setting the FPS manually. After an FFMPEG operation, I saw the final frame count, and I divided it by the duration of the audio stream and used that as the FPS.

So

ffmpeg -r <fps> -i video.mp4 -i audio.wav -c:v copy -c:a aac output.mp4

(I used WAV because AAC ended up not syncing well because the raw AAC was stored in ADTS container without duration information)

1
  • Actually this was no good for me, as the video was Variable FPS, so the audio wasn't just stretched uniformly. Commented Jul 14 at 22:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .