nagyistoce / aimc

Automatically exported from code.google.com/p/aimc
0 stars 0 forks source link

Mismatch between audio duration and movie duration - sample-rate issue? #2

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi - on mac 10.4.11 using a recent hg clone of AIMC, I ran AIMCopy to generate 
a movie from an audio file. The resulting movie is 70 seconds long, though the 
input audio file is only half that (36 seconds).

When I play the movie back, the soundtrack does play at the right rate, but 
ends halfway through the movie. The visuals appear out of sync - it's hard to 
tell by eye but it does look like the visual analysis comes out at half-speed.

Here's my command and its output:
http://pastebin.com/TqV7cECc

I'm using the bundled config file, and a script file with just a single line to 
process that one file.

Here's a description of the audio file:
$ sndfile-info Chloris-chloris_XC28961-uk.wav 
Version : libsndfile-1.0.24
========================================
File : Chloris-chloris_XC28961-uk.wav
Length : 3092106
RIFF : 3092098
WAVE
fmt  : 16
  Format        : 0x1 => WAVE_FORMAT_PCM
  Channels      : 1
  Sample Rate   : 44100
  Block Align   : 2
  Bit Width     : 16
  Bytes/sec     : 88200
data : 3092062
End
----------------------------------------
Sample Rate : 44100
Frames      : 1546031
Channels    : 1
Format      : 0x00010002
Sections    : 1
Seekable    : TRUE
Duration    : 00:00:35.057
Signal Max  : 8517 (-11.70 dB)

the soundfile is originally from http://www.xeno-canto.org/XC28961

Can you spot what might be causing this?

Original issue reported on code.google.com by danstow...@gmail.com on 2 Apr 2012 at 10:34

GoogleCodeExporter commented 9 years ago
Hi,
It looks as if ffmpeg is ignoring the frame rate set with the -r flag on the 
command line below:

ffmpeg -y -i "Chloris-chloris_XC28961-uk.wav" -i 
"/tmp/AIM-C-movie.1RzQlb/001024.png" -sameq -r 50.06 -ar 44100 -acodec 
pcm_s16le  "Chloris-chloris_XC28961-uk.mov.mov"

because a few lines later in your output I see

Input #1, image2, from '/tmp/AIM-C-movie.1RzQlb/%06d.png':
  Duration: 00:01:10.20, start: 0.000000, bitrate: N/A
    Stream #1.0: Video: png, rgb24, 800x600, 25 fps, 25 tbr, 25 tbn, 25 tbc

I've added another -r flag before the -i for the png files in the ffmpeg 
command line, and that seems to do the trick.

Original comment by tomwalt...@google.com on 1 May 2012 at 11:32

GoogleCodeExporter commented 9 years ago
Hi - this fixes it for me, on my Ubuntu machine. On my ageing Mac 10.4, I'm not 
sure why but processing is taking forever, with the updated code: it took about 
4 days, then I killed it, then I tried again and I think it's been nearly a 
week now. The "AIMCopy" process is running at about 93% CPU pretty consistently 
- not much memory used, no "ffmpeg" child processes, so I don't really know 
why. But at least I can get it running on Ubuntu...

Original comment by danstow...@gmail.com on 14 May 2012 at 4:01

GoogleCodeExporter commented 9 years ago
I feel your pain. The slowness of producing movies has been annoying me for 
some time. On any fairly recent machine the signal processing code runs in real 
time but exporting each frame as a png takes forever. I think cairo is really 
the wrong thing to be using here. The realtime visualisation has OpenGL 
support, so I might try using that instead for making movies.

Original comment by t...@tomwalters.co.uk on 14 May 2012 at 5:52