Author Topic: How to change framerate in .mp4 to sync with audio  (Read 11002 times)

Offline Redsandro

  • Member
  • Posts: 82
  • Woop woop!
    • View Profile
    • REDnet
How to change framerate in .mp4 to sync with audio
« on: January 14, 2010, 01:55:59 PM »
I've got a videostream and an audiostream that match perfectly, but I accidentally set the video to be 25 fps in the initial encode in stead of 30. Can FFmpeg remux this with the proper framerate?
I've tried
Code: [Select]
ffmpeg -i in.mp4 -vcodec copy -acodec copy -r 30 out.mp4 and it gives a proper mp4 but still with a 25 fps mismatch.
« Last Edit: January 15, 2010, 05:55:05 AM by Redsandro »
Images are DISALLOWED

Offline Dark Shikari

  • x264 developer
  • Administrator
  • Member
  • *****
  • Posts: 650
    • View Profile
Re: Can FFmpeg change frame rate only?
« Reply #1 on: January 14, 2010, 04:25:08 PM »
Try mp4box.

Offline Redsandro

  • Member
  • Posts: 82
  • Woop woop!
    • View Profile
    • REDnet
Re: Can FFmpeg change frame rate only?
« Reply #2 on: January 15, 2010, 05:53:54 AM »
I tried but I cannot get the 25 fps to become 30 fps, here's what I tried:

Code: [Select]
mp4box.exe -add Isle25.mp4#video:fps=30 -add Isle25.mp4#audio -new Isle30.mp4
mp4box.exe -add Isle25.mp4#video -fps 30 -add Isle25.mp4#audio -new Isle30.mp4

It remuxes fine without error in both cases but fps stays 25.
Images are DISALLOWED

Offline Dark Shikari

  • x264 developer
  • Administrator
  • Member
  • *****
  • Posts: 650
    • View Profile
Re: How to change framerate in .mp4 to sync with audio
« Reply #3 on: January 15, 2010, 08:09:44 AM »
Try extracting the video and audio streams and then re-merging them at different framerates.

Offline Redsandro

  • Member
  • Posts: 82
  • Woop woop!
    • View Profile
    • REDnet
Re: How to change framerate in .mp4 to sync with audio
« Reply #4 on: January 16, 2010, 04:34:23 AM »
I got it, albeit a bit weird.

Fisrt, in my opinion, the way I typed it in my previous post should work. ;)

Second,
Code: [Select]
mp4box -add final.mp4#video -raw 1 -new test creates two files, test and test_track1.h264, with the first being 25 fps and the second automatically being 30 fps.
Then I type
Code: [Select]
mp4box -add test_track1.h264:fps=30 -add final.mp4#audio -new Isle30.mp4 and it works!

Happy.
Images are DISALLOWED