ffmpeg-在ubuntu 18.10错误上将mkv转换为mp4?

时间:2019-01-15 05:01:27

标签: ffmpeg

我正在尝试使用ffmpeg在Ubuntu 18.10上将某些mkvs转换为mp4,并且仍然出现以下错误。阿比的想法?

我正在关注https://linuxconfig.org/install-ffmpeg-on-ubuntu-18-04-bionic-beaver-linux#h2-operating-system-and-software-versions

我已经安装了ffmpeg并已安装:

sudo apt install -y libopus-dev libmp3lame-dev libfdk-aac-dev libvpx-dev libx264-dev yasm libass-dev libtheora-dev libvorbis-dev mercurial cmake

我用输出运行的命令:

ffmpeg -i 'video.mkv' -codec copy 'video.mp4' -strict -2 -y
ffmpeg version 4.0.2-2 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 8 (Ubuntu 8.2.0-7ubuntu1)
  configuration: --prefix=/usr --extra-version=2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      56. 14.100 / 56. 14.100
  libavcodec     58. 18.100 / 58. 18.100
  libavformat    58. 12.100 / 58. 12.100
  libavdevice    58.  3.100 / 58.  3.100
  libavfilter     7. 16.100 /  7. 16.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  1.100 /  5.  1.100
  libswresample   3.  1.100 /  3.  1.100
  libpostproc    55.  1.100 / 55.  1.100
Trailing options were found on the commandline.
Input #0, matroska,webm, from 'ALL nyannyancosplay tik toks (Chronological order) (HD-720p)-WxewnMF4j6Y.mkv':
  Metadata:
    COMPATIBLE_BRANDS: iso6avc1mp41
    MAJOR_BRAND     : dash
    MINOR_VERSION   : 0
    ENCODER         : Lavf58.12.100
  Duration: 00:27:39.74, start: -0.007000, bitrate: 834 kb/s
    Stream #0:0: Video: h264 (Main), yuv420p(progressive), 790x720 [SAR 1:1 DAR 79:72], 29.97 fps, 29.97 tbr, 1k tbn, 59.94 tbc (default)
    Metadata:
      HANDLER_NAME    : ISO Media file produced by Google Inc. Created on: 01/13/2019.
      DURATION        : 00:27:39.724000000
    Stream #0:1(eng): Audio: opus, 48000 Hz, stereo, fltp (default)
    Metadata:
      DURATION        : 00:27:39.741000000
[mp4 @ 0x560e85326100] track 1: codec frame size is not set
[mp4 @ 0x560e85326100] opus in MP4 support is experimental, add '-strict -2' if you want to use it.
Could not write header for output file #0 (incorrect codec parameters ?): Experimental feature
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
    Last message repeated 1 times

我也尝试添加-strict -2无济于事。

2 个答案:

答案 0 :(得分:3)

order of options很重要:

ffmpeg [global options] [input options] -i input [output options] output

您的示例具有经常被忽略的尾随选项。

使用:

ffmpeg -y -i 'video.mkv' -codec copy -strict -2 'video.mp4'

答案 1 :(得分:1)

如果在使用<tbody> {this.state.movies.map(movie => ( <tr> <td>{movie.title}</td> <td>{movie.genre.name}</td> <td>{movie.numberInStock}</td> <td>{movie.dailyRentalRate}</td> </tr> ))} </tbody> 选项后有人遇到无声音问题,则可以尝试在-strict -2之后使用-c:a aac选项,如下所示:

-c copy