ffmpeg webm 到 mp4 转换失败

ffmpeg webm 到 mp4 转换失败

尝试将 webm 文件转换为 mp4。

inputfile.webm 上的 ffprobe 信息

$ ffprobe -v quiet -print_format json -show_format -show_streams inputfile.webm
{
    "streams": [
        {
            "index": 0,
            "codec_name": "vp8",
            "codec_long_name": "On2 VP8",
            "profile": "0",
            "codec_type": "video",
            "codec_time_base": "1/30",
            "codec_tag_string": "[0][0][0][0]",
            "codec_tag": "0x0000",
            "width": 640,
            "height": 480,
            "coded_width": 640,
            "coded_height": 480,
            "has_b_frames": 0,
            "sample_aspect_ratio": "1:1",
            "display_aspect_ratio": "4:3",
            "pix_fmt": "yuv420p",
            "level": -99,
            "field_order": "progressive",
            "refs": 1,
            "r_frame_rate": "30/1",
            "avg_frame_rate": "30/1",
            "time_base": "1/1000",
            "start_pts": 0,
            "start_time": "0.000000",
            "disposition": {
                "default": 1,
                "dub": 0,
                "original": 0,
                "comment": 0,
                "lyrics": 0,
                "karaoke": 0,
                "forced": 0,
                "hearing_impaired": 0,
                "visual_impaired": 0,
                "clean_effects": 0,
                "attached_pic": 0,
                "timed_thumbnails": 0
            }
        },
        {
            "index": 1,
            "codec_name": "opus",
            "codec_long_name": "Opus (Opus Interactive Audio Codec)",
            "codec_type": "audio",
            "codec_time_base": "1/48000",
            "codec_tag_string": "[0][0][0][0]",
            "codec_tag": "0x0000",
            "sample_fmt": "fltp",
            "sample_rate": "48000",
            "channels": 1,
            "channel_layout": "mono",
            "bits_per_sample": 0,
            "r_frame_rate": "0/0",
            "avg_frame_rate": "0/0",
            "time_base": "1/1000",
            "start_pts": 0,
            "start_time": "0.000000",
            "duration_ts": 12333,
            "duration": "12.333000",
            "disposition": {
                "default": 1,
                "dub": 0,
                "original": 0,
                "comment": 0,
                "lyrics": 0,
                "karaoke": 0,
                "forced": 0,
                "hearing_impaired": 0,
                "visual_impaired": 0,
                "clean_effects": 0,
                "attached_pic": 0,
                "timed_thumbnails": 0
            }
        }
    ],
    "format": {
        "filename": "inputfile.webm",
        "nb_streams": 2,
        "nb_programs": 0,
        "format_name": "matroska,webm",
        "format_long_name": "Matroska / WebM",
        "start_time": "0.000000",
        "duration": "12.333000",
        "size": "1609303",
        "bit_rate": "1043900",
        "probe_score": 100,
        "tags": {
            "encoder": "Lavf56.40.101",
            "creation_time": "2020-06-12T11:32:05.000000Z"
        }
    }
}

ffmpeg 转换日志

$ ffmpeg -i inputfile.webm out.mp4
ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
  built with Apple clang version 11.0.3 (clang-1103.0.32.59)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.2.2_3 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags=-fno-stack-check --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Input #0, matroska,webm, from 'inputfile.webm':
  Metadata:
    encoder         : Lavf56.40.101
    creation_time   : 2020-06-12T11:32:05.000000Z
  Duration: 00:00:12.33, start: 0.000000, bitrate: 1043 kb/s
    Stream #0:0: Video: vp8, yuv420p(progressive), 640x480, SAR 1:1 DAR 4:3, 30 fps, 30 tbr, 1k tbn, 1k tbc (default)
    Stream #0:1: Audio: opus, 48000 Hz, mono, fltp (default)
Stream mapping:
  Stream #0:0 -> #0:0 (vp8 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (opus (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0x7f9e64811600] using SAR=1/1
[libx264 @ 0x7f9e64811600] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x7f9e64811600] profile High, level 5.0
[libx264 @ 0x7f9e64811600] 264 - core 155 r2917 0a84d98 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=18 lookahead_threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Too many packets buffered for output stream 0:0.577014:32:22.77 bitrate=  -0.0kbits/s dup=45 drop=0 speed=N/A
[libx264 @ 0x7f9e64811600] frame I:1     Avg QP:16.69  size: 56001
[libx264 @ 0x7f9e64811600] frame P:33    Avg QP:19.46  size:  9705
[libx264 @ 0x7f9e64811600] frame B:95    Avg QP:19.23  size:   662
[libx264 @ 0x7f9e64811600] consecutive B-frames:  0.8%  0.0%  4.6% 94.7%
[libx264 @ 0x7f9e64811600] mb I  I16..4: 46.7% 36.4% 16.9%
[libx264 @ 0x7f9e64811600] mb P  I16..4:  4.0%  9.4%  0.5%  P16..4:  6.5%  1.2%  0.6%  0.0%  0.0%    skip:77.8%
[libx264 @ 0x7f9e64811600] mb B  I16..4:  0.1%  0.1%  0.0%  B16..8:  6.0%  0.1%  0.0%  direct: 0.7%  skip:93.0%  L0:44.7% L1:54.8% BI: 0.4%
[libx264 @ 0x7f9e64811600] 8x8 transform intra:61.3% inter:37.9%
[libx264 @ 0x7f9e64811600] coded y,uvDC,uvAC intra: 8.6% 3.3% 1.3% inter: 0.9% 0.9% 0.1%
[libx264 @ 0x7f9e64811600] i16 v,h,dc,p: 41% 52%  6%  1%
[libx264 @ 0x7f9e64811600] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 42% 16% 41%  0%  0%  0%  0%  0%  0%
[libx264 @ 0x7f9e64811600] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 32% 40% 17%  2%  2%  2%  2%  1%  3%
[libx264 @ 0x7f9e64811600] i8c dc,h,v,p: 88%  8%  3%  0%
[libx264 @ 0x7f9e64811600] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x7f9e64811600] ref P L0: 75.5% 13.1%  9.1%  2.3%
[libx264 @ 0x7f9e64811600] ref B L0: 82.1% 16.4%  1.5%
[libx264 @ 0x7f9e64811600] ref B L1: 97.0%  3.0%
[libx264 @ 0x7f9e64811600] kb/s:816.97
Conversion failed!

答案1

添加-max_muxing_queue_size输出选项:

ffmpeg -i input.webm -max_muxing_queue_size 512 out.mp4

相关内容