Does FFmpeg append blank black video to the end of the MP4 files when compressed from MOV

compressionffmpegpowershellvideovideo conversion

I have several large MOV files that I want to compress to MP4.

Unfortunately, when I use FFmpeg, it appends lots of black (blank) video at the end.

(The destination file is longer than the source file.)

For example, I have a file that is 02:22:01 in duration (and the FFmpeg output logs confirm this).

But when I run the following command (which takes more than 20 minutes even on "ultrafast"), I get an MP4 file that looks mostly good but has lots of black frames appended to the end such that the total video duration becomes 3:59:59.

ffmpeg -i "F:\video_project\uncompressed\Tape_12.mov" -vcodec libx264 -preset ultrafast -crf 18 -n -threads 16 -f mp4 "F:\video_project\compressed\Tape_12.mp4" 2>&1

This happens with my other MOV-to-MP4 conversions too. The duration of black video appended to the end can be 20 to 80+ minutes long (it's not the same for each different video).

What am I doing wrong?

My logs are here.

P.S. I'm using PowerShell 4 in Windows 7.

Update:

In response to LordNeckBeard, when I run ffmpeg.exe -i F:\video_project\compressed\Tape_12.mp4, the result is:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'F:\video_project\compressed\Tape_12.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf55.22.101
  Duration: 03:59:59.94, start: 0.033333, bitrate: 5389 kb/s
    Stream #0:0(eng): Video: h264 (High 4:2:2) (avc1 / 0x31637661), yuv422p, 720x480 [SAR 10:11 DAR 15:11], 5252 kb/s, 29.97 fps, 29.97 tbr, 11988 tbn, 59.94 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler

In response to Rajib, when I run ffmpeg.exe -i F:\video_project\uncompressed\Tape_12.mov, the result is:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'F:\video_project\uncompressed\Tape_12.mov':
  Metadata:
    creation_time   : 2014-01-05 02:35:17
  Duration: 02:22:01.04, start: -6.064083, bitrate: 51226 kb/s
    Stream #0:0(eng): Video: dvvideo (dvc  / 0x20637664), yuv411p, 720x480 [SAR 8:9 DAR 4:3], 28771 kb/s, SAR 10:11 DAR
15:11, 29.97 fps, 29.97 tbr, 2997 tbn, 29.97 tbc (default)
    Metadata:
      creation_time   : 2014-01-05 06:35:18
      handler_name    : Apple Alias Data Handler
    Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, mono, s16, 768 kb/s (default)
    Metadata:
      creation_time   : 2014-01-05 06:35:18
      handler_name    : Apple Alias Data Handler
    Stream #0:2(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, mono, s16, 768 kb/s (default)
    Metadata:
      creation_time   : 2014-01-05 06:35:18
      handler_name    : Apple Alias Data Handler

Best Answer

The problem is probably that you are not speeding up the audio track so the new video stays as long as the original one. Either delete the audio track with the -an option or speed it up accordingly with the ​atempo audio filter.

Related Question