У меня проблемы со сложным фильтром, я масштабировал его до 720p, но он по-прежнему выводит изображение низкого качества. Я могу подтвердить, что источник входного сигнала находится в 720p, но то, что получается, похоже на 240p.

ffmpeg -re -i "https://d2zihajmogu5jn.cloudfront.net/bipbop-advanced/bipbop_16x9_variant.m3u8" -i ./public/images/ACE.png -i ./public/images/logo2.jpg -i ./public/images/crunchy.png -i ./public/images/red.jpg -filter_complex \
    "[0]scale=1290:720,setsar=1[ovrl0]; \
     [1]scale=40:40[ovrl1]; \
     [2]scale=40:40[ovrl2]; \
     [3]scale=40:40[ovrl3]; \
     [4]scale=40:40[ovrl4]; \
     [ovrl0][ovrl1] overlay=x=(main_w-overlay_w)/1.025:y=(main_h-overlay_h)/18:enable='lt(mod(t,40),10)'[v1]; \
     [v1][ovrl2] overlay=x=(main_w-overlay_w)/1.025:y=(main_h-overlay_h)/18:enable='between(mod(t,40),10,20)'[v2]; \
     [v2][ovrl3] overlay=x=(main_w-overlay_w)/1.025:y=(main_h-overlay_h)/18:enable='gt(mod(t,40),20)'[v3]; \
     [v3][ovrl4] overlay=x=(main_w-overlay_w)/1.025:y=(main_h-overlay_h)/18:enable='gt(mod(t,40),30)'" -acodec aac -vcodec libx264 -f flv "rtmp://a.rtmp.youtube.com/live2/2222-2222-2222-2222"

консольный вывод

ffmpeg version 3.4.1 Copyright (c) 2000-2017 the FFmpeg developers
  built with Apple LLVM version 9.0.0 (clang-900.0.39.2)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/3.4.1 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfontconfig --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma --enable-nonfree
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
[hls,applehttp @ 0x7f9fdf002200] Opening 'http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8' for reading
[hls,applehttp @ 0x7f9fdf002200] Opening 'http://devimages.apple.com/iphone/samples/bipbop/gear2/prog_index.m3u8' for reading
[hls,applehttp @ 0x7f9fdf002200] Opening 'http://devimages.apple.com/iphone/samples/bipbop/gear3/prog_index.m3u8' for reading
[hls,applehttp @ 0x7f9fdf002200] Opening 'http://devimages.apple.com/iphone/samples/bipbop/gear4/prog_index.m3u8' for reading
[hls,applehttp @ 0x7f9fdf002200] Opening 'http://devimages.apple.com/iphone/samples/bipbop/gear1/fileSequence0.ts' for reading
[hls,applehttp @ 0x7f9fdf002200] Opening 'http://devimages.apple.com/iphone/samples/bipbop/gear2/fileSequence0.ts' for reading
[hls,applehttp @ 0x7f9fdf002200] Opening 'http://devimages.apple.com/iphone/samples/bipbop/gear3/fileSequence0.ts' for reading
[hls,applehttp @ 0x7f9fdf002200] Opening 'http://devimages.apple.com/iphone/samples/bipbop/gear4/fileSequence0.ts' for reading
Input #0, hls,applehttp, from 'http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8':
  Duration: 00:30:01.00, start: 10.000000, bitrate: 0 kb/s
  Program 0 
    Metadata:
      variant_bitrate : 200000
    Stream #0:0: Audio: aac (LC) ([15][0][0][0] / 0x000F), 22050 Hz, mono, fltp
    Metadata:
      variant_bitrate : 200000
    Stream #0:1: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p(tv, smpte170m/smpte170m/bt709), 192x144, 14.99 fps, 14.99 tbr, 90k tbn, 180k tbc
    Metadata:
      variant_bitrate : 200000
  Program 1 
    Metadata:
      variant_bitrate : 311111
    Stream #0:2: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p(tv, smpte170m/smpte170m/bt709), 320x240, 29.97 fps, 29.97 tbr, 90k tbn, 180k tbc
    Metadata:
      variant_bitrate : 311111
    Stream #0:3: Audio: aac (LC) ([15][0][0][0] / 0x000F), 22050 Hz, mono, fltp
    Metadata:
      variant_bitrate : 311111
  Program 2 
    Metadata:
      variant_bitrate : 484444
    Stream #0:4: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p(tv, smpte170m/smpte170m/bt709), 480x360, 29.97 fps, 29.97 tbr, 90k tbn, 180k tbc
    Metadata:
      variant_bitrate : 484444
    Stream #0:5: Audio: aac (LC) ([15][0][0][0] / 0x000F), 22050 Hz, mono, fltp
    Metadata:
      variant_bitrate : 484444
  Program 3 
    Metadata:
      variant_bitrate : 737777
    Stream #0:6: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p(tv, smpte170m/smpte170m/bt709), 480x360, 29.97 fps, 29.97 tbr, 90k tbn, 180k tbc
    Metadata:
      variant_bitrate : 737777
    Stream #0:7: Audio: aac (LC) ([15][0][0][0] / 0x000F), 22050 Hz, mono, fltp
    Metadata:
      variant_bitrate : 737777
Input #1, png_pipe, from './public/images/ACE.png':
  Duration: N/A, bitrate: N/A
    Stream #1:0: Video: png, pal8(pc), 200x200 [SAR 2835:2835 DAR 1:1], 25 tbr, 25 tbn, 25 tbc
Input #2, image2, from './public/images/logo2.jpg':
  Duration: 00:00:00.04, start: 0.000000, bitrate: 49832 kb/s
    Stream #2:0: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 2371x1967 [SAR 300:300 DAR 2371:1967], 25 tbr, 25 tbn, 25 tbc
Input #3, png_pipe, from './public/images/crunchy.png':
  Duration: N/A, bitrate: N/A
    Stream #3:0: Video: png, pal8(pc), 225x225, 25 tbr, 25 tbn, 25 tbc
Input #4, image2, from './public/images/red.jpg':
  Duration: 00:00:00.04, start: 0.000000, bitrate: 4862 kb/s
    Stream #4:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 482x372 [SAR 300:300 DAR 241:186], 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:1 (h264) -> scale (graph 0)
  Stream #1:0 (png) -> scale (graph 0)
  Stream #2:0 (mjpeg) -> scale (graph 0)
  Stream #3:0 (png) -> scale (graph 0)
  Stream #4:0 (mjpeg) -> scale (graph 0)
  overlay (graph 0) -> Stream #0:0 (libx264)
  Stream #0:0 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[swscaler @ 0x7f9fdf071c00] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x7f9fde9bc400] deprecated pixel format used, make sure you did set range correctly
[libx264 @ 0x7f9fe0034800] using SAR=1/1
[libx264 @ 0x7f9fe0034800] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0x7f9fe0034800] profile High, level 3.2
[libx264 @ 0x7f9fe0034800] 264 - core 148 r2795 aaa9aa8 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - 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=6 lookahead_threads=1 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=14 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, flv, to 'rtmp://a.rtmp.youtube.com/live2/2222-2222-2222-2222':
  Metadata:
    encoder         : Lavf57.83.100
    Stream #0:0: Video: h264 (libx264) ([7][0][0][0] / 0x0007), yuv420p, 1290x720 [SAR 1:1 DAR 43:24], q=-1--1, 14.99 fps, 1k tbn, 14.99 tbc (default)
    Metadata:
      encoder         : Lavc57.107.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1: Audio: aac (LC) ([10][0][0][0] / 0x000A), 22050 Hz, mono, fltp, 69 kb/s
    Metadata:
      variant_bitrate : 200000
      encoder         : Lavc57.107.100 aac
[hls,applehttp @ 0x7f9fdf002200] Opening 'http://devimages.apple.com/iphone/samples/bipbop/gear1/fileSequence1.ts' for reading
[hls,applehttp @ 0x7f9fdf002200] No longer receiving playlist 1
[hls,applehttp @ 0x7f9fdf002200] No longer receiving playlist 2
[hls,applehttp @ 0x7f9fdf002200] No longer receiving playlist 3
[hls,applehttp @ 0x7f9fdf002200] Opening 'http://devimages.apple.com/iphone/samples/bipbop/gear1/fileSequence2.ts' for reading
[hls,applehttp @ 0x7f9fdf002200] Opening 'http://devimages.apple.com/iphone/samples/bipbop/gear1/fileSequence3.ts' for reading
[hls,applehttp @ 0x7f9fdf002200] Opening 'http://devimages.apple.com/iphone/samples/bipbop/gear1/fileSequence4.ts' for reading
[hls,applehttp @ 0x7f9fdf002200] Opening 'http://devimages.apple.com/iphone/samples/bipbop/gear1/fileSequence5.ts' for reading
[hls,applehttp @ 0x7f9fdf002200] Opening 'http://devimages.apple.com/iphone/samples/bipbop/gear1

1 ответ1

0

Ваш вход m3u8 содержит четыре видеопотока: самый маленький размер - 192x144, а самый большой - только 480x360. Вывод консоли показывает, что выбран поток 192x144. Вы масштабируете до 1290x720. Повышение масштаба с 192x144 (или 480x360) до 1290x720 будет выглядеть дрянно, несмотря ни на что.

Рекомендуемое решение - найти вход с более высоким разрешением и избежать масштабирования.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками .