gpt4 book ai didi

FFMPEG - 视频中带有 Splash 图像的绿色转换

转载 作者:行者123 更新时间:2023-12-04 23:12:42 27 4
gpt4 key购买 nike

我正在使用 FFMPEG 制作包含单个单色 JPG 图像的视频:

ffmpeg -y -loop 1 -framerate 30 -t 5 -i SplashBW.jpg Splash.mp4

生成的视频有两个问题:
  • 当用 VLC 观看时,它有一个绿色 Actor
  • 当用“电影和电视”观看时(我怀疑这是 Windows 10
    查看器 - MP4 文件的关联似乎已被劫持
    在我的电脑上)它有一个绿色转换和一个主要的闪烁
    0.5秒左右。

  • 使用 Irfan View 查看时,它看起来不错。我不知道问题出在原始 JPG、FFMPEG 命令还是查看器上。自然,我希望它在所有输出上都能正确渲染。

    当我打开它们时,下面的前两个链接在我的浏览器 (Chrome) 中看起来不错。第三个链接是我尝试使用 Film and TV 播放视频时看到的屏幕记录。应用程序。

    B&W image

    Resulting video

    screen grab of video playing on my PC

    FFMPEG 运行的日志:
    C:\Users\Raymond\Desktop\Chorus\Videos\Virtual Choir>call ffmpeg -y -loglevel verbose -loop 1 -framerate 30 -t 5 -i SplashBW.jpg Splash.mp4
    ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
    built with gcc 9.2.1 (GCC) 20200122
    configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libope
    ncore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --
    enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuv
    id --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
    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
    libswscale 5. 5.100 / 5. 5.100
    libswresample 3. 5.100 / 3. 5.100
    libpostproc 55. 5.100 / 55. 5.100
    [AVIOContext @ 000001e6f6ccdd00] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6ccde80] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6d59b00] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6ccde40] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6ccdf00] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6ccdfc0] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cce180] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cce240] Statistics: 159785 bytes read, 0 seeks
    Last message repeated 1 times
    [AVIOContext @ 000001e6f6cd33c0] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd3480] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd3640] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd3700] Statistics: 159785 bytes read, 0 seeks
    Last message repeated 19 times
    Input #0, image2, from 'SplashBW.jpg':
    Duration: 00:00:00.03, start: 0.000000, bitrate: 38348 kb/s
    Stream #0:0: Video: mjpeg (Baseline), 1 reference frame, gray(bt470bg/unknown/unknown, center), 1920x1080 [SAR 1:1 DAR 16:9], 30 fps, 30 tbr, 30 tbn, 30 tbc
    Stream mapping:
    Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
    Press [q] to stop, [?] for help
    [graph 0 input from stream 0:0 @ 000001e6f6cd2ec0] w:1920 h:1080 pixfmt:gray tb:1/30 fr:30/1 sar:1/1 sws_param:flags=2
    [libx264 @ 000001e6f6d57100] using SAR=1/1
    [libx264 @ 000001e6f6d57100] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
    [libx264 @ 000001e6f6d57100] profile High, level 4.0, 4:0:0, 8-bit
    [libx264 @ 000001e6f6d57100] 264 - core 159 - H.264/MPEG-4 AVC codec - Copyleft 2003-2019 - 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 chro
    ma_me=0 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 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 weigh
    tb=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
    Output #0, mp4, to 'Splash.mp4':
    Metadata:
    encoder : Lavf58.29.100
    Stream #0:0: Video: h264 (libx264), 1 reference frame (avc1 / 0x31637661), gray(center), 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 30 fps, 15360 tbn, 30 tbc
    Metadata:
    encoder : Lavc58.54.100 libx264
    Side data:
    cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    [AVIOContext @ 000001e6f8b98e00] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5300] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd51c0] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5c40] Statistics: 159785 bytes read, 0 seeks
    Last message repeated 1 times
    [AVIOContext @ 000001e6f6cd5300] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5440] Statistics: 159785 bytes read, 0 seeks
    Last message repeated 1 times
    [AVIOContext @ 000001e6f6cd5040] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5980] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5040] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5840] Statistics: 159785 bytes read, 0 seeksspeed= 0x
    [AVIOContext @ 000001e6f6cd5580] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd51c0] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5300] Statistics: 159785 bytes read, 0 seeks
    Last message repeated 1 times
    [AVIOContext @ 000001e6f6cd5ac0] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5440] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5c40] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5440] Statistics: 159785 bytes read, 0 seeks
    Last message repeated 1 times
    [AVIOContext @ 000001e6f6cd5300] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5700] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd4f00] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5700] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5c40] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5300] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5700] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5300] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5ac0] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5840] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd4f00] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5040] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5700] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5ac0] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd51c0] Statistics: 159785 bytes read, 0 seeks
    Last message repeated 1 times
    [AVIOContext @ 000001e6f6cd5c40] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5040] Statistics: 159785 bytes read, 0 seeks1.0kbits/s speed=0.359x
    Last message repeated 1 times
    [AVIOContext @ 000001e6f6cd5840] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5ac0] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd51c0] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5580] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5440] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5700] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5c40] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5300] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd51c0] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd4f00] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd51c0] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5700] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5ac0] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5700] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5ac0] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd51c0] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5ac0] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5c40] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5840] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5580] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd51c0] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5300] Statistics: 159785 bytes read, 0 seeks
    Last message repeated 1 times
    [AVIOContext @ 000001e6f6cd51c0] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd4f00] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5040] Statistics: 159785 bytes read, 0 seeks0.3kbits/s speed=0.828x
    [AVIOContext @ 000001e6f6cd5ac0] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5040] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5580] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd51c0] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd4f00] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd51c0] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5ac0] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5840] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5580] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd51c0] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5840] Statistics: 159785 bytes read, 0 seeks
    Last message repeated 1 times
    [AVIOContext @ 000001e6f6cd5700] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5ac0] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5840] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5040] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd4f00] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd51c0] Statistics: 159785 bytes read, 0 seeks
    Last message repeated 1 times
    [AVIOContext @ 000001e6f6cd5300] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5ac0] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5700] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd51c0] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5840] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd4f00] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5300] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5c40] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5700] Statistics: 159785 bytes read, 0 seeks
    Last message repeated 1 times
    [AVIOContext @ 000001e6f6cd5580] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5840] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5700] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5440] Statistics: 159785 bytes read, 0 seeks0.2kbits/s speed=1.16x
    [AVIOContext @ 000001e6f6cd5ac0] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5040] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd4f00] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5040] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5ac0] Statistics: 159785 bytes read, 0 seeks
    Last message repeated 2 times
    [AVIOContext @ 000001e6f6cd5440] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5040] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5300] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5040] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5440] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5700] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5980] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5c40] Statistics: 159785 bytes read, 0 seeks
    Last message repeated 1 times
    [AVIOContext @ 000001e6f6cd5040] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd4f00] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5c40] Statistics: 159785 bytes read, 0 seeks
    [AVIOContext @ 000001e6f6cd5ac0] Statistics: 159785 bytes read, 0 seeks
    No more output streams to write to, finishing.
    frame= 150 fps= 51 q=-1.0 Lsize= 142kB time=00:00:04.90 bitrate= 237.8kbits/s speed=1.65x
    video:140kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.855892%
    Input file #0 (SplashBW.jpg):
    Input stream #0:0 (video): 151 packets read (24127535 bytes); 151 frames decoded;
    Total: 151 packets (24127535 bytes) demuxed
    Output file #0 (Splash.mp4):
    Output stream #0:0 (video): 150 frames encoded; 150 packets muxed (143004 bytes);
    Total: 150 packets (143004 bytes) muxed
    [AVIOContext @ 000001e6f6d59240] Statistics: 2 seeks, 4 writeouts
    [libx264 @ 000001e6f6d57100] frame I:1 Avg QP:18.13 size:131209
    [libx264 @ 000001e6f6d57100] frame P:38 Avg QP:16.03 size: 87
    [libx264 @ 000001e6f6d57100] frame B:111 Avg QP:24.33 size: 70
    [libx264 @ 000001e6f6d57100] consecutive B-frames: 1.3% 0.0% 0.0% 98.7%
    [libx264 @ 000001e6f6d57100] mb I I16..4: 1.8% 96.0% 2.2%
    [libx264 @ 000001e6f6d57100] mb P I16..4: 0.0% 0.0% 0.0% P16..4: 0.0% 0.0% 0.0% 0.0% 0.0% skip:99.9%
    [libx264 @ 000001e6f6d57100] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 0.0% 0.0% 0.0% direct: 0.0% skip:100.0% L0:21.7% L1:78.3% BI: 0.0%
    [libx264 @ 000001e6f6d57100] 8x8 transform intra:96.0% inter:98.7%
    [libx264 @ 000001e6f6d57100] coded y intra: 94.7% inter: 0.0%
    [libx264 @ 000001e6f6d57100] i16 v,h,dc,p: 24% 37% 5% 34%
    [libx264 @ 000001e6f6d57100] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 46% 22% 11% 3% 3% 3% 4% 3% 5%
    [libx264 @ 000001e6f6d57100] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 79% 9% 2% 1% 2% 1% 4% 1% 1%
    [libx264 @ 000001e6f6d57100] i8c dc,h,v,p: 100% 0% 0% 0%
    [libx264 @ 000001e6f6d57100] Weighted P-Frames: Y:0.0%
    [libx264 @ 000001e6f6d57100] ref P L0: 96.6% 0.7% 1.3% 1.3%
    [libx264 @ 000001e6f6d57100] ref B L0: 96.9% 2.1% 1.0%
    [libx264 @ 000001e6f6d57100] ref B L1: 94.8% 5.2%
    [libx264 @ 000001e6f6d57100] kb/s:227.72
    [AVIOContext @ 000001e6f6ccb880] Statistics: 32768 bytes read, 0 seeks

    最佳答案

    您的输入图像只有一个分量 channel - 亮度。大多数播放器处理包含三个分量 channel 的 H.264 流 - 亮度或“亮度”(Y)和两个用于色度或“颜色”(U 和 V)。当 H.264 编码器对仅 luma 流进行编码时,它会使用许多播放器无法很好处理的语法来存储它。因此,我们告诉 ffmpeg 在将其发送到编码器之前添加具有中性值的色度分量(因为源中没有色价)。我们将添加最常见的 YUV 编码形式 - yuv420p。

    所以,

    ffmpeg -y -loop 1 -framerate 30 -t 5 -i SplashBW.jpg -pix_fmt yuv420p Splash.mp4

    关于FFMPEG - 视频中带有 Splash 图像的绿色转换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62097328/

    27 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com