Search code examples
djangoogg3gpavconv

3gp audio to ogg conversion does not work


I have a django app and use a call to subprocess.call('avconv -i ' + fileName + ' ' + fileNew, shell=True). The input file is a .3gp file which has only aac mono audio stream converted to an .ogg file. Conversion succeeds, but the new file seems to be damaged and audio will not play.

Here is what I got after trying to get information for one of the input files:

xxx:/workspace/build$ avconv -i audio.3gp
avconv version 0.8.10-4:0.8.10-0ubuntu0.12.04.1, Copyright (c) 2000-2013 the Libav developers
  built on Feb  6 2014 20:56:59 with gcc 4.6.3
audio.3gp: Invalid data found when processing input

Here is the successful convert:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/workspace/multi-device-audio-project/webapp/../static/data/matpat.3gp':
  Metadata:
    major_brand     : 3gp4
    minor_version   : 0
    compatible_brands: isom3gp4
    creation_time   : 2014-02-17 10:53:36
  Duration: 00:00:20.60, start: 0.000000, bitrate: 13 kb/s
    Stream #0.0(eng): Audio: aac, 8000 Hz, mono, s16, 12 kb/s
    Metadata:
      creation_time   : 2014-02-17 10:53:36
Output #0, ogg, to '/workspace/multi-device-audio-project/webapp/../static/data/matpat.ogg':
  Metadata:
    major_brand     : 3gp4
    minor_version   : 0
    compatible_brands: isom3gp4
    creation_time   : 2014-02-17 10:53:36
    encoder         : Lavf53.21.1
    Stream #0.0(eng): Audio: flac, 8000 Hz, mono, s16, 200 kb/s
    Metadata:
      creation_time   : 2014-02-17 10:53:36
Stream mapping:
  Stream #0:0 -> #0:0 (aac -> flac)
Press ctrl-c to stop encoding
size=     216kB time=20.66 bitrate=  85.5kbits/s
video:0kB audio:214kB global headers:0kB muxing overhead 0.612994%

Here is one of the sample files: link

The following usage strings also return me an error : audio.3gp: Invalid data found when processing input::

avconv -i audio.3gp -vn -acodec libvorbis -aq 50 audio.ogg
avconv -i audio.3gp -acodec vorbis audio.ogg

Could the input files be broken, I think they are recorded on a Nexus 7?


Solution

  • At the end I was able to discover the source of the problem. As I expected, the .3gp files were not properly created as they contained only audio information which resulted in avconv not being able to recognise and convert them. Changing the application to work with .aac fixed the issue.