ffmpeg producing empty MP4 files

2019-09-15 09:08发布

问题:

I am trying to use ffmpeg to convert MTS files to MP4 files. It seems as though the command is running correctly, but the resulting files end up being empty.

joshua@joshua-VirtualBox:~$ ffmpeg -i /media/sf_2017-04/SD_044/00007.MTS /media/sf_2017-04/SD_04/000007.mp4
ffmpeg version 0.8.17-4:0.8.17-0ubuntu0.12.04.2, Copyright (c) 2000-2014 the Libav developers
  built on Apr  1 2016 14:28:02 with gcc 4.6.3
The ffmpeg program is only provided for script compatibility and will be removed
in a future release. It has been deprecated in the Libav project to allow for
incompatible command line syntax improvements in its replacement called avconv
(see Changelog for details). Please use avconv instead.
Input #0, mpegts, from '/media/sf_2017-04/SD_044/00007.MTS':
  Duration: 00:01:17.07, start: 1.927822, bitrate: 25053 kb/s
  Program 1 
    Stream #0.0[0x1011]: Video: h264 (High), yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], 59.96 fps, 59.94 tbr, 90k tbn, 119.88 tbc
    Stream #0.1[0x1100]: Audio: ac3, 48000 Hz, stereo, s16, 256 kb/s
    Stream #0.2[0x1200]: Data: [144][0][0][0] / 0x0090
File '/media/sf_2017-04/SD_04/000007.mp4' already exists. Overwrite ? [y/N] y
[buffer @ 0x88772a0] w:1920 h:1080 pixfmt:yuv420p
ffmpeg -i /media/sf_2017-04/SD_044/00007.MTS /media/sf_2017-04/SD_04/000007.mp4
ffmpeg version 0.8.17-4:0.8.17-0ubuntu0.12.04.2, Copyright (c) 2000-2014 the Libav developers
  built on Apr  1 2016 14:28:02 with gcc 4.6.3
The ffmpeg program is only provided for script compatibility and will be removed
in a future release. It has been deprecated in the Libav project to allow for
incompatible command line syntax improvements in its replacement called avconv
(see Changelog for details). Please use avconv instead.
Input #0, mpegts, from '/media/sf_2017-04/SD_044/00007.MTS':
  Duration: 00:01:17.07, start: 1.927822, bitrate: 25053 kb/s
  Program 1 
    Stream #0.0[0x1011]: Video: h264 (High), yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], 59.96 fps, 59.94 tbr, 90k tbn, 119.88 tbc
    Stream #0.1[0x1100]: Audio: ac3, 48000 Hz, stereo, s16, 256 kb/s
    Stream #0.2[0x1200]: Data: [144][0][0][0] / 0x0090
File '/media/sf_2017-04/SD_04/000007.mp4' already exists. Overwrite ? [y/N] y
[buffer @ 0x88772a0] w:1920 h:1080 pixfmt:yuv420p
encoder 'aac' is experimental and might produce bad results.
Add '-strict experimental' if you want to use it.

回答1:

In your ffmpeg version, aac codec in ffmpeg is still experimental, ffmpeg automatically select aac for the output codec since you didn't specify with -c:a. But you need to manually enable it.

Like the output information said, add extra parameters -strict -2 or -strict experimental will work.



标签: ffmpeg