FFMPEG - Зеленый оттенок с изображением Spla sh в видео - PullRequest
0 голосов
/ 30 мая 2020

Я использую FFMPEG для создания видео, состоящего из одного моноблока chrome Изображение в формате JPG:

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

Есть две проблемы с итоговым видео:

  • При просмотре с помощью VL C он имеет зеленый оттенок
  • При просмотре с помощью «Кино и ТВ» (я подозреваю, что это программа просмотра Windows 10 - ассоциация для файлов MP4, похоже, была взломана на моем P C) он имеет зеленый оттенок и преобладающее мерцание каждые 0,5 секунды или около того.

При просмотре через Irfan View выглядит нормально. Я не знаю, связана ли проблема с исходным JPG, командой FFMPEG или программами просмотра. Естественно, я хочу, чтобы он правильно отображался на всех выходах.

Первые две ссылки ниже выглядят нормально в моем браузере (Chrome), когда я их открываю. Третья ссылка - это запись экрана того, что я вижу, когда пытаюсь воспроизвести видео с помощью приложения Film and TV.

Ч / б изображение

Результирующее видео

снимок экрана видео, воспроизводимого на моем P C

Журнал запуска 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

1 Ответ

1 голос
/ 30 мая 2020

Ваше входное изображение имеет только один компонентный канал - яркость. Большинство плееров имеют дело с потоками H.264, содержащими три компонентных канала - яркость или «яркость» (Y) и два для цветности или «цвета» (U и V). Когда кодер H.264 кодирует поток только для яркости, он сохраняет его, используя синтаксис, с которым многие проигрыватели плохо справляются. Итак, мы говорим ffmpeg добавить компоненты цветности, которые будут иметь нейтральные значения (поскольку в источнике нет валентности цвета), прежде чем отправлять их в кодировщик. Мы добавим наиболее распространенную форму кодирования YUV - yuv420p.

Итак,

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