Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert form 30 to 60fps by increasing speed, not duplicating frames, using FFmpeg

I have a video that is incorrectly labelled at 30fps, it is actually 60fps and so looks like it's being played at half speed. The audio is fine, that is, the soundtrack finishes half way through the video clip. I'd like to know how, if possible to fix this, that is double the video speed, making it 60fps and meaning that the audio and video are synced.

The file is H.264 and the audio MPEG-4 AAC.

File details as given by ffmpeg, as requested:

ffmpeg version 0.8.9-6:0.8.9-0ubuntu0.13.10.1, Copyright (c) 2000-2013 the Libav developers
built on Nov  9 2013 19:09:46 with gcc 4.8.1
*** THIS PROGRAM IS DEPRECATED ***
This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './Tignes60fps.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2014-01-13 02:23:09
    Duration: 00:08:33.21, start: 0.000000, bitrate: 5690 kb/s
    Stream #0.0(eng): Video: h264 (High), yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], 5609 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc
Metadata:
    creation_time   : 2014-01-13 02:23:09
    Stream #0.1(eng): Audio: aac, 48000 Hz, stereo, s16, 156 kb/s
Metadata:
      creation_time   : 2014-01-13 02:23:09
At least one output file must be specified
like image 515
Matt Pellegrini Avatar asked Oct 21 '22 16:10

Matt Pellegrini


2 Answers

Use -vsync drop:

ffmpeg -i input.avi -vcodec copy -vsync drop -r 60 output.avi

Source timestamps will be destroyed and the output muxer will create a new ones based on given frame rate (-r switch).

like image 126
Vadim Kalinsky Avatar answered Oct 27 '22 08:10

Vadim Kalinsky


Okay so here's how I achieved what I wanted.

avconv -i input.mp4 -r 60 -filter:v "setpts=0.5*PTS" output.mp4

This left the audio unchanged, so it now synced up nicely with the video.

This was originally a video that was incorrectly exported as 30fps when really it was 60, so the video was playing at half the speed for twice a long, with the audio track finishing half way through. The above fixed this, sped up the video, without loosing frames, it now plays at 60fps, normal speed and is in sync with the audio.

Credit to rogerdpack for suggesting setpts, but you were very minimal! A fuller answer would have been appreciated!

like image 26
Matt Pellegrini Avatar answered Oct 27 '22 08:10

Matt Pellegrini