I normally use avidemux to convert mp4s to Xvid AVI for my Philips Streamium SLM5500 which only seems to support Xvid. Normally I select MPEG-4 ASP (Xvid) at Two Pass with an average bitrate f 1500kb/s for video and AC3 (lav) audio and it converts correctly.

However, I'm trying to using avconv so I can automate the process with a script, but when I do this the video stutters and stops playing part way through. I have a suspicion its something to do with a faulty audio conversion.

The commands I'm using are as follows:
Code:
avconv -y -i video.mp4 -pass 1 -vtag xvid -c:a ac3 -b:a 128k -b:v 1500k -f avi /dev/null
avconv -y -i video.mp4 -pass 2 -vtag xvid -c:a ac3 -b:a 128k -b:v 1500k -f avi video.avi
There is a bewildering array of arguments for avconv. Is there something I'm doing wrong? Is there a way I can script avidemux from a headless server?

Please see command line output:

Code:
$ avconv -y -i video.mp4 -pass 1 -vtag xvid -an -b:v 1500k -f avi /dev/null
avconv version 0.8.5-6:0.8.5-0ubuntu0.12.10.1, Copyright (c) 2000-2012 the Libav developers
  built on Jan 24 2013 14:49:20 with gcc 4.7.2
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 1
    compatible_brands: isomavc1
    creation_time   : 2013-02-04 13:53:38
  Duration: 00:44:09.16, start: 0.000000, bitrate: 669 kb/s
    Stream #0.0(und): Video: h264 (High), yuv420p, 720x404 [PAR 1:1 DAR 180:101], 538 kb/s, 25 fps, 25 tbr, 100 tbn, 50 tbc
    Metadata:
      creation_time   : 2013-02-04 13:53:38
    Stream #0.1(und): Audio: ac3, 44100 Hz, stereo, s16, 127 kb/s
    Metadata:
      creation_time   : 2013-02-04 13:53:42
[buffer @ 0x7f4c40] w:720 h:404 pixfmt:yuv420p
Output #0, avi, to '/dev/null':
  Metadata:
    major_brand     : isom
    minor_version   : 1
    compatible_brands: isomavc1
    creation_time   : 2013-02-04 13:53:38
    ISFT            : Lavf53.21.1
    Stream #0.0(und): Video: mpeg4, yuv420p, 720x404 [PAR 1:1 DAR 180:101], q=2-31, pass 1, 1500 kb/s, 25 tbn, 25 tbc
    Metadata:
      creation_time   : 2013-02-04 13:53:38
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> mpeg4)
Press ctrl-c to stop encoding
frame=66227 fps=328 q=2.0 Lsize=       0kB time=2649.16 bitrate=   0.0kbits/s    
video:401602kB audio:0kB global headers:0kB muxing overhead -100.000000%
$ avconv -y -i video.mp4 -pass 2 -vtag xvid -c:a ac3 -b:a 128k -b:v 1500k -f avi video.avi
avconv version 0.8.5-6:0.8.5-0ubuntu0.12.10.1, Copyright (c) 2000-2012 the Libav developers
  built on Jan 24 2013 14:49:20 with gcc 4.7.2
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 1
    compatible_brands: isomavc1
    creation_time   : 2013-02-04 13:53:38
  Duration: 00:44:09.16, start: 0.000000, bitrate: 669 kb/s
    Stream #0.0(und): Video: h264 (High), yuv420p, 720x404 [PAR 1:1 DAR 180:101], 538 kb/s, 25 fps, 25 tbr, 100 tbn, 50 tbc
    Metadata:
      creation_time   : 2013-02-04 13:53:38
    Stream #0.1(und): Audio: ac3, 44100 Hz, stereo, s16, 127 kb/s
    Metadata:
      creation_time   : 2013-02-04 13:53:42
[buffer @ 0x12b4f00] w:720 h:404 pixfmt:yuv420p
Incompatible sample format 's16' for codec 'ac3', auto-selecting format 'flt'
[mpeg4 @ 0x12b3ec0] [lavc rc] Using all of requested bitrate is not necessary for this video with these parameters.
Output #0, avi, to 'video.avi':
  Metadata:
    major_brand     : isom
    minor_version   : 1
    compatible_brands: isomavc1
    creation_time   : 2013-02-04 13:53:38
    ISFT            : Lavf53.21.1
    Stream #0.0(und): Video: mpeg4, yuv420p, 720x404 [PAR 1:1 DAR 180:101], q=2-31, pass 2, 1500 kb/s, 25 tbn, 25 tbc
    Metadata:
      creation_time   : 2013-02-04 13:53:38
    Stream #0.1(und): Audio: ac3, 44100 Hz, stereo, flt, 128 kb/s
    Metadata:
      creation_time   : 2013-02-04 13:53:42
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> mpeg4)
  Stream #0:1 -> #0:1 (ac3 -> ac3)
Press ctrl-c to stop encoding
Input stream #0:1 frame changed from rate:44100 fmt:s16 ch:2 to rate:44100 fmt:flt ch:2
frame=66227 fps=284 q=2.2 Lsize=  458486kB time=2649.13 bitrate=1417.8kbits/s    
video:413716kB audio:41393kB global headers:0kB muxing overhead 0.741969%