4

I am attemping to use ffmpeg to add a silent audio track to a video file (Instagram requires video files to have an audio track to allow them to upload, for whatever reason), and I am using the following command:

ffmpeg -f lavfi -i aevalsrc=0 -i input.mkv -shortest -c:v copy -c:a libvo_aacenc output.mp4

The input file "input.mkv" is 00:00:06 (i.e. 6 seconds). However, the resultant "output.mp4" comes out at 00:02:31 (i.e. 2 minutes 31 seconds), obviously much longer. After 6 seconds, the video seems to freeze on the last frame for the remainder. Naturally, this is not the result I expected or wanted.

Anyone able to suggest what mistake I have made in this command, and how to properly achieve what I am wanting? I'd like to be able to write a little batch script or something to automatically convert videos to the correct format required for Instagram for future use.

EDIT: As requested, here is the ffmpeg output:

ffmpeg version N-50911-g9efcfbe Copyright (c) 2000-2013 the FFmpeg developers
  built on Mar 13 2013 21:26:48 with gcc 4.7.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libg
sm --enable-libilbc --enable-libmp3lame --enable-libopencore-amrnb --enable-libo
pencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-li
bschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-lib
twolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enabl
e-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 19.100 / 52. 19.100
  libavcodec     55.  0.100 / 55.  0.100
  libavformat    55.  0.100 / 55.  0.100
  libavdevice    54.  4.100 / 54.  4.100
  libavfilter     3. 45.103 /  3. 45.103
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
[lavfi @ 02259b00] Estimating duration from bitrate, this may be inaccurate
Input #0, lavfi, from 'aevalsrc=0':
  Duration: N/A, start: 0.000000, bitrate: 2822 kb/s
    Stream #0:0: Audio: pcm_f64le, 44100 Hz, mono, dbl, 2822 kb/s
Input #1, matroska,webm, from 'input.mkv':
  Metadata:
    ENCODER         : Lavf55.0.100
  Duration: 00:00:06.10, start: 0.000000, bitrate: 5123 kb/s
    Stream #1:0: Video: h264 (High), yuv420p, 1620x1080 [SAR 1:1 DAR 3:2], 10 fp
s, 10 tbr, 1k tbn, 20 tbc (default)
File 'output.mp4' already exists. Overwrite ? [y/N] y
Output #0, mp4, to 'output.mp4':
  Metadata:
    encoder         : Lavf55.0.100
    Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1620x1080 [SAR 1
:1 DAR 3:2], q=2-31, 10 fps, 16k tbn, 1k tbc (default)
    Stream #0:1: Audio: aac ([64][0][0][0] / 0x0040), 44100 Hz, mono, s16, 128 k
b/s
Stream mapping:
  Stream #1:0 -> #0:0 (copy)
  Stream #0:0 -> #0:1 (pcm_f64le -> libvo_aacenc)
Press [q] to stop, [?] for help
frame=   59 fps=0.0 q=-1.0 Lsize=    4961kB time=00:01:12.38 bitrate= 561.4kbits
/s
video:3814kB audio:1132kB subtitle:0 global headers:0kB muxing overhead 0.304997
%

I should also note that this time the resultant "output.mp4" was 00:01:12 - this length seems to be somewhat "random", as of course the exact same command was used as when I did it previously.

10
  • Can you test a more recent build? Does it also occur with a different encoder? -c:a aac -strict experimental.
    – llogan
    Dec 26, 2014 at 21:29
  • @LordNeckbeard Using the experimental (?) aac encoder made it work as expected, thanks very much Dec 26, 2014 at 22:36
  • I'm curious if the recent build with libvo_aacenc is still problematic.
    – llogan
    Dec 26, 2014 at 23:08
  • I can't seem to duplicate this using ffmpeg from current git master compiled with vo-aacenc 0.1.3.
    – llogan
    Dec 27, 2014 at 21:12
  • @LordNeckbeard I haven't tried with a more recent build, I probably should update my ffmpeg build sometime. It's quite possible this issue is resolved with a newer build, which in hindsight should maybe have been the first thing I tried. Dec 28, 2014 at 21:22

1 Answer 1

3

The solution was simply to update to a newer build of ffmpeg. With the latest git build as of 13/01/2015, this was no longer an issue. Using an alternative aac encoder also worked, but updating to a newer build is probably the better solution overall.

1
  • Yes, this is always the first step when encountering a problem with ffmpeg. See FFmpeg Download page for builds, source code, and other options.
    – llogan
    Jan 13, 2015 at 20:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .