.MOV file has audio synchronization errors in any editor but plays fine in VLC

2

I have a .mov file with H.264 1080p video and raw 16-bit PCM audio that I need to edit (remove a portion of).

The original file plays fine in Gnome's movie player and VLC but as soon as I open the file in any editor it fails, with the audio going way off (as in there is no audio past about half way – not talking milliseconds here!)

Editors/transcoders I've tried: VLC, Handbrake, Avidemux, OpenShot.

I don't understand why the original plays fine but can't be transcoded or opened in an editor without this problem. On the transcoders I've tried all sorts of combinations of audio/video/containers.

Anybody know a reliable one, or something I might be doing wrong?

(I'm using Ubuntu 12.04)

This was requested:

$ffmpeg -i VBFT\ FINAL.mov 
ffmpeg version N-54234-gef90639 Copyright (c) 2000-2013 the FFmpeg developers
  built on Jun 28 2013 05:26:06 with gcc 4.6 (Debian 4.6.3-1)
  configuration: --prefix=/root/ffmpeg-static/64bit --extra-cflags='-I/root/ffmpeg-static/64bit/include -static' --extra-ldflags='-L/root/ffmpeg-static/64bit/lib -static' --extra-libs='-lxml2 -lexpat -lfreetype' --enable-static --disable-shared --disable-ffserver --disable-doc --enable-bzlib --enable-zlib --enable-postproc --enable-runtime-cpudetect --enable-libx264 --enable-gpl --enable-libtheora --enable-libvorbis --enable-libmp3lame --enable-gray --enable-libass --enable-libfreetype --enable-libopenjpeg --enable-libspeex --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-version3 --enable-libvpx
  libavutil      52. 37.101 / 52. 37.101
  libavcodec     55. 17.100 / 55. 17.100
  libavformat    55. 10.100 / 55. 10.100
  libavdevice    55.  2.100 / 55.  2.100
  libavfilter     3. 77.101 /  3. 77.101
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x388f6a0] multiple edit list entries, a/v desync might occur, patch welcome
Guessed Channel Layout for  Input Stream #0.1 : stereo
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'VBFT FINAL.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 537199360
    compatible_brands: qt  
    creation_time   : 2013-03-04 16:54:43
  Duration: 00:02:37.24, start: 0.000000, bitrate: 9349 kb/s
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1920x1080, 4017 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
    Metadata:
      creation_time   : 2013-03-04 16:54:43
      handler_name    : Apple Alias Data Handler
      timecode        : 01:00:00:00
    Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, stereo, s16, 1536 kb/s
    Metadata:
      creation_time   : 2013-03-04 16:54:43
      handler_name    : Apple Alias Data Handler
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74)
    Metadata:
      creation_time   : 2013-03-04 16:54:51
      handler_name    : Apple Alias Data Handler
      timecode        : 01:00:00:00
At least one output file must be specified

artfulrobot

Posted 2013-07-23T16:38:28.073

Reputation: 197

@slhck yeah, it's v. odd. The video looks OK, I can seek to frames fine, but the audio seems to have been sort of squashed or something such that audio that should be at 90% is found at 45%, then it sort of runs out and the last half of the video is silent. The audio sounds OK - it's not high pitched or anytyhing. – artfulrobot – 2013-07-23T16:49:28.977

Can you provide this file? – llogan – 2013-07-23T17:11:10.677

"multiple edit list entries, a/v desync might occur, patch welcome" :) Most free (and open source) video tools rely on the same FFmpeg libraries, so no wonder you experience the same error everywhere. So the real question is, where does the file come from? It seems to have been created incorrectly. – slhck – 2013-07-23T17:48:02.890

Ok, thanks. It's from an external source (school kids) so I don't expect I'll be able to do anything with this now. Ah well. Thanks for help. – artfulrobot – 2013-07-23T19:20:25.707

Answers

1

You could try extracting the audio manually and then merging it back in:

ffmpeg -i input.mov -c:a copy out.wav
ffmpeg -i input.mov -i out.wav -c:v copy -c:a libfaac -map 0 -map 1 out.mp4

The resulting MP4 file will contain the original video stream and the audio stream encoded as AAC audio, which is supported in the MP4 container. This should give you a file that you can easily edit in any video editing program.

Or, if you want to cut out something, you can do it right away with ffmpeg:

ffmpeg -i input.mov -i out.wav -ss 00:01:23 -c:v copy -c:a libfaac -to 00:02:34 -map 0:v -map 1 out.mp4

Here, -ss and -to specify start and stop timestamps, respectively. -map 0:v -map 1 tells ffmpeg to map the video stream of the first input file and the second file completely to the output.

slhck

Posted 2013-07-23T16:38:28.073

Reputation: 182 472

Thanks. I'll give this a try tomorrow when I'm next with the file. – artfulrobot – 2013-07-24T05:52:16.260

On the static-linked version I get Unknown encoder 'libfaac'. On Ubuntu's ffmpeg I get Unrecognized option 'c:v' when trying to run the 2nd command..? – artfulrobot – 2013-07-25T08:14:07.503

Ubuntu's ffmpeg is broken and outdated. Please don't use it. You need avconv or a recent static build of ffmpeg. If you don't have libfaac use -c:a aac -strict experimental instead.

– slhck – 2013-07-25T08:19:47.127

The static build you told me to download gives the 'Unknown encoder' error. I just tried Ubuntu's for fun! Using the static built ffmpeg with the strict experimental, or using Ubuntu 12.04's avconv now gives the same error "Data stream encoding not supported yet (only streamcopy)"... PS. I have libfaac0 installed already – artfulrobot – 2013-07-25T08:26:03.753

Maybe try adding -dn as an option after the input to disable copying of the data streams. If that doesn't work, can you run this with the static build again and give us the complete console output? – slhck – 2013-07-25T09:08:07.227

Thanks, putting -dn after the wav input gets it working. But, sadly, after all that the result is the same as described in the question. (Also it ends up with 2 audio streams as it copies the .mov's as well.). Thanks anyway! – artfulrobot – 2013-07-25T09:20:23.030