[FFmpeg-user] Need assistance finding l transcoding

James E. Baird James.Baird at ccr.net
Thu Dec 13 22:49:56 EET 2018


Moritz,

>Does it need to be fixed bitrate? (Just wondering.)

It does need to be a CBR. It will be converted to an adaptive stream for a streaming app

>Is this ultimately the issue? That you can't encode at real time?

These are live streams that need to be forwarded off, packaged in HLS and sent to streaming app and accessible within 1 minute from broadcast so that is part of it.

>At "constant"/average bitrate (-b:v), you should be able to use libx264's presets to trade off quality for speed. Perhaps you can achieve >1.0x that way. I don't see how you will do three simultaneous encodes though.
>BTW, eight CPUs to encode 1280x720 at 59.94 in realtime seems sort of heavy. Are these Atom cores or something similarly weak?

I felt that I should get more horsepower as well and that is the main reason I started this thread. I have been working with live streams for a few years now but surprisingly, this is the first time I have needed to dig into transcoding like this so I was hoping there was something glaringly inefficient about how I was trying to get to the end result. I see some venders of transcoders using CPUs that are not as powerful as this one on their transcoding hardware (without GPU or ASIC chips) and I am assuming they are leveraging FFMPEG or something similar in the background.

I have edited my command a bit. The biggest performance change I am seeing is changing the preset to ultrafast. I am not sure that quality will work yet but it gets the utilization down to 350% CPU usage. The other performance gain comes from combing the 3 output bitrates into a single command. Not sure if anyone has further suggestions for this?

=========== New command ============
transcoder:~$ ffmpeg -i 'udp://@239.129.2.110:59110?fifo_size=1000000&overrun_nonfatal=1' \
> -c:v libx264 -x264opts keyint=120:no-scenecut -preset ultrafast -b:v 6000k -minrate 6000k -maxrate 6000k -bufsize 12000k -profile:v high -level 4.0 -c:a aac -f mpegts udp://@239.129.2.240:59240 \
> -c:v libx264 -x264opts keyint=120:no-scenecut -preset ultrafast -b:v 3500k -minrate 3500k -maxrate 3500k -bufsize 9000k -profile:v high -level 4.0 -c:a aac -f mpegts udp://@239.129.2.241:59241 \
> -c:v libx264 -x264opts keyint=120:no-scenecut -preset ultrafast -b:v 1500k -minrate 1500k -maxrate 1500k -bufsize 3000k -profile:v high -level 4.0 -c:a aac -f mpegts udp://@239.129.2.242:59242

===========OUTPUT ===============
ffmpeg version 3.4.4-0ubuntu0.18.04.1 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
  configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  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
[mpeg2video @ 0x556b70e9c580] Invalid frame dimensions 0x0.
    Last message repeated 7 times
Input #0, mpegts, from 'udp://@239.129.2.110:59110?fifo_size=1000000&overrun_nonfatal=1':
  Duration: N/A, start: 95234.341144, bitrate: N/A
  Program 3
    Stream #0:0[0x31]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, bt709, bottom first), 1280x720 [SAR 1:1 DAR 16:9], Closed Captions, 59.94 fps, 59.94 tbr, 90k tbn, 119.88 tbc
    Stream #0:1[0x34](eng): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 5.1(side), fltp, 384 kb/s
    Stream #0:2[0x35](spa): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 128 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg2video (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (ac3 (native) -> aac (native))
  Stream #0:0 -> #1:0 (mpeg2video (native) -> h264 (libx264))
  Stream #0:1 -> #1:1 (ac3 (native) -> aac (native))
  Stream #0:0 -> #2:0 (mpeg2video (native) -> h264 (libx264))
  Stream #0:1 -> #2:1 (ac3 (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0x556b70e951e0] using SAR=1/1
[libx264 @ 0x556b70e951e0] using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX XOP FMA4
[libx264 @ 0x556b70e951e0] profile Constrained Baseline, level 4.0
Output #0, mpegts, to 'udp://@239.129.2.240:59240':
  Metadata:
    encoder         : Lavf57.83.100
    Stream #0:0: Video: h264 (libx264), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 6000 kb/s, 59.94 fps, 90k tbn, 59.94 tbc
    Metadata:
      encoder         : Lavc57.107.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 6000000/0/6000000 buffer size: 12000000 vbv_delay: -1
    Stream #0:1(eng): Audio: aac (LC), 48000 Hz, 5.1(side), fltp, 341 kb/s
    Metadata:
      encoder         : Lavc57.107.100 aac
[libx264 @ 0x556b70e8d040] using SAR=1/1
[libx264 @ 0x556b70e8d040] using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX XOP FMA4
[libx264 @ 0x556b70e8d040] profile Constrained Baseline, level 4.0
Output #1, mpegts, to 'udp://@239.129.2.241:59241':
  Metadata:
    encoder         : Lavf57.83.100
    Stream #1:0: Video: h264 (libx264), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 3500 kb/s, 59.94 fps, 90k tbn, 59.94 tbc
    Metadata:
      encoder         : Lavc57.107.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 3500000/0/3500000 buffer size: 9000000 vbv_delay: -1
    Stream #1:1(eng): Audio: aac (LC), 48000 Hz, 5.1(side), fltp, 341 kb/s
    Metadata:
      encoder         : Lavc57.107.100 aac
[libx264 @ 0x556b71482860] using SAR=1/1
[libx264 @ 0x556b71482860] using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX XOP FMA4
[libx264 @ 0x556b71482860] profile Constrained Baseline, level 4.0
Output #2, mpegts, to 'udp://@239.129.2.242:59242':
  Metadata:
    encoder         : Lavf57.83.100
    Stream #2:0: Video: h264 (libx264), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 1500 kb/s, 59.94 fps, 90k tbn, 59.94 tbc
    Metadata:
      encoder         : Lavc57.107.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 1500000/0/1500000 buffer size: 3000000 vbv_delay: -1
    Stream #2:1(eng): Audio: aac (LC), 48000 Hz, 5.1(side), fltp, 341 kb/s
    Metadata:
      encoder         : Lavc57.107.100 aac
frame=163201 fps= 60 q=27.0 q=30.0 q=36.0 size= 2257986kB time=00:45:22.90 bitrate=6793.3kbits/s speed=   1x


CONFIDENTIALITY NOTICE: This e-mail including attachments is covered by the Electronic Communications Privacy Act, 18 U.S.C. ยงยง2510-2521, is confidential and may contain information that is privileged, confidential or otherwise protected from use and disclosure. If you are not the intended recipient, you are hereby notified that any review, disclosure, copying, or dissemination of this transmission, or taking of any action in reliance on its contents, or other use is strictly prohibited. If you have received this transmission in error, please reply to the sender listed above immediately and permanently delete this message from your inbox.


More information about the ffmpeg-user mailing list