5

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
halfer
  • 19,824
  • 17
  • 99
  • 186
Matt Pellegrini
  • 159
  • 1
  • 3
  • 11

2 Answers2

2

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

Vadim Kalinsky
  • 928
  • 8
  • 18
  • This just gives me "Expected number for vsync but found: drop" – Matt Pellegrini Jan 13 '14 at 22:17
  • What the ffmpeg version do you use? – Vadim Kalinsky Jan 14 '14 at 15:47
  • Hmm... actually you're using libav, not ffmpeg. – Vadim Kalinsky Jan 14 '14 at 16:06
  • That needs explaining. I typed the command exactly, how is it not ffmpeg? Same error when the command is replicated, but replacing ffmpeg with avconv which I understand is what I should be using. – Matt Pellegrini Jan 14 '14 at 20:14
  • It's beyond common sense :-) ffmpeg is an opensource project which contains bunch of libraries (libavformat/codec/etc) and utilities like ffserver, ffplay, ffprobe and ffmpeg itself. Couple of years ago some of key figures from ffmpeg community mutinied against ffmpeg maintainer Michael Niedermayer, and made their own ffmpeg, with name "libav". For some reason the original ffmpeg has been replaced with avconv in some linux distributives. So when you're typing 'ffmpeg', you actually run avconv, which has different command line options than original ffmpeg executable. – Vadim Kalinsky Jan 14 '14 at 21:08
1

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!

Matt Pellegrini
  • 159
  • 1
  • 3
  • 11