我可以使用 ffmpeg 对损坏的视频文件使用好的视频文件的参数吗?

我可以使用 ffmpeg 对损坏的视频文件使用好的视频文件的参数吗?

我有一台旧的迷你高清摄像机,它使用 MJPEG 编解码器输出 AVI 文件。我有一些新文件无法在 Windows 视频实用程序中打开,我想修复它们。ffprobe 抱怨:

[avi @ 000001d0b6125980] Could not find codec parameters for stream 0 (Video: mjpeg (MJPG / 0x47504A4D), none(bt470bg/unknown/unknown), 1920x1080): unspecified pixel format
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options

但是,我确实有一些旧文件可以正常播放。是否可以使用从好的视频文件中获取的参数让 ffmpeg 修复坏的视频文件?


以下是 mediainfo 输出:

General
Complete name                            : D:\path_to_file\MOV00036.AVI
Format                                   : AVI
Format/Info                              : Audio Video Interleave
Format settings                          : BitmapInfoHeader / PcmWaveformat
File size                                : 19.1 MiB
Duration                                 : 5 min 2 s
Overall bit rate                         : 530 kb/s
Frame rate                               : 30.000 FPS
Director                                 : Generplus
Original source form/Distributed by      : Generplus
Recorded date                            : 2010-06-29
Copyright                                : Generplus

Video
ID                                       : 0
Format                                   : JPEG
Codec ID                                 : MJPG
Duration                                 : 5 min 2 s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate                               : 30.000 FPS
Color space                              : YUV
Compression mode                         : Lossy

Audio
ID                                       : 1
Format                                   : PCM
Format settings                          : Little / Signed
Codec ID                                 : 1
Duration                                 : 5 min 2 s
Bit rate mode                            : Constant
Bit rate                                 : 512 kb/s
Channel(s)                               : 1 channel
Sampling rate                            : 32.0 kHz
Bit depth                                : 16 bits
Stream size                              : 18.4 MiB (97%)
Alignment                                : Aligned on interleaves

ffprobe 输出:

ffprobe -i "D:\path_to_file\MOV00036.AVI"
ffprobe version N-113238-g1c061bf0d4 Copyright (c) 2007-2024 the FFmpeg developers
  built with gcc 13.2.0 (Rev3, Built by MSYS2 project)
  configuration:  --disable-static --enable-shared --pkg-config=pkgconf --cc='ccache gcc' --cxx='ccache g++' --ld='ccache g++' --extra-cxxflags=-fpermissive --extra-cflags=-Wno-int-conversion --disable-autodetect --disable-debug --disable-w32threads --disable-sdl2 --enable-gpl --enable-version3 --enable-fontconfig --enable-iconv --enable-libass --enable-libdav1d --enable-libfreetype --enable-libharfbuzz --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libsnappy --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libzimg --enable-lzma --enable-zlib --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libxvid --enable-libgsm --enable-libsvtav1 --enable-libaom --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-amf --enable-vulkan --enable-libvmaf --enable-libglslang --enable-vulkan --enable-schannel --extra-cflags=-DLIBTWOLAME_STATIC --extra-libs=-lstdc++ --extra-libs=-liconv --shlibdir=/local64/bin-video
  libavutil      58. 36.101 / 58. 36.101
  libavcodec     60. 37.100 / 60. 37.100
  libavformat    60. 20.100 / 60. 20.100
  libavdevice    60.  4.100 / 60.  4.100
  libavfilter     9. 17.100 /  9. 17.100
  libswscale      7.  6.100 /  7.  6.100
  libswresample   4. 13.100 /  4. 13.100
  libpostproc    57.  4.100 / 57.  4.100
[avi @ 000001d0b6125980] Could not find codec parameters for stream 0 (Video: mjpeg (MJPG / 0x47504A4D), none(bt470bg/unknown/unknown), 1920x1080): unspecified pixel format
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, avi, from 'D:\path_to_file\MOV00036.AVI':
  Metadata:
    ISRC            : Generplus
    artist          : Generplus
    copyright       : Generplus
    date            : 2010-06-29
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: mjpeg (MJPG / 0x47504A4D), none(bt470bg/unknown/unknown), 1920x1080, 30 fps, 30 tbr, 30 tbn
  Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 32000 Hz, 1 channels, s16, 512 kb/s

在一个较旧的、好的文件上的 ffprobe 输出:

ffprobe -i "D:\path_to_file\MOV00035.AVI"
ffprobe version N-113238-g1c061bf0d4 Copyright (c) 2007-2024 the FFmpeg developers
  built with gcc 13.2.0 (Rev3, Built by MSYS2 project)
  configuration:  --disable-static --enable-shared --pkg-config=pkgconf --cc='ccache gcc' --cxx='ccache g++' --ld='ccache g++' --extra-cxxflags=-fpermissive --extra-cflags=-Wno-int-conversion --disable-autodetect --disable-debug --disable-w32threads --disable-sdl2 --enable-gpl --enable-version3 --enable-fontconfig --enable-iconv --enable-libass --enable-libdav1d --enable-libfreetype --enable-libharfbuzz --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libsnappy --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libzimg --enable-lzma --enable-zlib --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libxvid --enable-libgsm --enable-libsvtav1 --enable-libaom --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-amf --enable-vulkan --enable-libvmaf --enable-libglslang --enable-vulkan --enable-schannel --extra-cflags=-DLIBTWOLAME_STATIC --extra-libs=-lstdc++ --extra-libs=-liconv --shlibdir=/local64/bin-video
  libavutil      58. 36.101 / 58. 36.101
  libavcodec     60. 37.100 / 60. 37.100
  libavformat    60. 20.100 / 60. 20.100
  libavdevice    60.  4.100 / 60.  4.100
  libavfilter     9. 17.100 /  9. 17.100
  libswscale      7.  6.100 /  7.  6.100
  libswresample   4. 13.100 /  4. 13.100
  libpostproc    57.  4.100 / 57.  4.100
[avi @ 000001e1facd59c0] non-interleaved AVI
Input #0, avi, from 'D:\path_to_file\MOV00035.AVI':
  Metadata:
    ISRC            : Generplus
    artist          : Generplus
    copyright       : Generplus
    date            : 2010-06-29
  Duration: 00:01:32.30, start: 0.000000, bitrate: 26286 kb/s
  Stream #0:0: Video: mjpeg (Baseline) (MJPG / 0x47504A4D), yuvj420p(pc, bt470bg/unknown/unknown), 1920x1080, 25707 kb/s, 30 fps, 30 tbr, 30 tbn
  Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 32000 Hz, 1 channels, s16, 512 kb/s

相关内容