eegmak
@eegmak

Как оптимизировать ffmpeg команду?

Запускаю в терминале такую команду:
ffmpeg -i rtsp://192.168.0.100/live/ch00_0 -vcodec copy -acodec copy -f flv rtmp://a.rtmp.youtube.com/live2/8xfz-w7te-78bp-rbfr-bg36

Вот что рассказывает о себе терминал, который является приложением termux:
$ ffmpeg -i rtsp://192.168.0.100/live/ch00_0 -vcodec copy -acodec copy -f flv rtmp://a.rtmp.youtube.com/live2/8xfz-w7te-78bp-rbfr-bg36
ffmpeg version 4.2.1 Copyright (c) 2000-2019 the FFmpeg developers
  built with Android (5220042 based on r346389c) clang version 8.0.7 (https://android.googlesource.com/toolchain/clang b55f2d4ebfd35bf643d27dbca1bb228957008617) (https://android.googlesource.com/toolchain/llvm 3c393fe7a7e13b0fba4ac75a01aa683d7a5b11cd) (based on LLVM 8.0.7svn)
  configuration: --arch=armeabi-v7a --as=arm-linux-androideabi-clang --cc=arm-linux-androideabi-clang --cxx=arm-linux-androideabi-clang++ --cross-prefix=arm-linux-androideabi- --disable-indevs --disable-outdevs --enable-indev=lavfi --disable-static --disable-symver --disable-lzma --enable-cross-compile --enable-gnutls --enable-gpl --enable-libass --enable-libmp3lame --enable-libfreetype --enable-libvorbis --enable-libopus --enable-libx264 --enable-libx265 --enable-libxvid --enable-libvpx --enable-shared --enable-libsoxr --prefix=/data/data/com.termux/files/usr --target-os=android --extra-libs=-landroid-glob --enable-neon
  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
[udp @ 0xb8c62900] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
[udp @ 0xb8c64d70] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)
[udp @ 0xb8c65260] 'circular_buffer_size' option was set but it is not supported on this build (pthread support is required)

Вот как ffmpeg распознал поток ввода(rtps камера)
И поток вывода(ютуб)
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, rtsp, from 'rtsp://192.168.0.100/live/ch00_0':
  Metadata:
    title           : h264+pcma
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: h264 (High), yuv420p(progressive), 1920x1080, 8 fps, 8 tbr, 90k tbn, 16 tbc
    Stream #0:1: Audio: pcm_alaw, 8000 Hz, mono, s16, 64 kb/s
Output #0, flv, to 'rtmp://a.rtmp.youtube.com/live2/8xfz-w7te-78bp-rbfr-bg36':
  Metadata:
    title           : h264+pcma
    encoder         : Lavf58.29.100
    Stream #0:0: Video: h264 (High) ([7][0][0][0] / 0x0007), yuv420p(progressive), 1920x1080, q=2-31, 8 fps, 8 tbr, 1k tbn, 90k tbc
    Stream #0:1: Audio: pcm_alaw ([7][0][0][0] / 0x0007), 8000 Hz, mono, s16, 64 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)

после показывается предупреждение
[flv @ 0xb8d34760] Non-monotonous DTS in output stream 0:0; previous: 215, current: 30; changing to 215. This may result in incorrect timestamps in the output file.
[flv @ 0xb8d34760] Non-monotonous DTS in output stream 0:0; previous: 215, current: 54; changing to 215. This may result in incorrect timestamps in the output file.
[flv @ 0xb8d34760] Non-monotonous DTS in output stream 0:0; previous: 215, current: 70; changing to 215. This may result in incorrect timestamps in the output file.
[flv @ 0xb8d34760] Non-monotonous DTS in output stream 0:0; previous: 215, current: 92; changing to 215. This may result in incorrect timestamps in the output file.
[flv @ 0xb8d34760] Non-monotonous DTS in output stream 0:0; previous: 215, current: 107; changing to 215. This may result in incorrect timestamps in the output file.

После чего жутко тормозящее видео с артефактами в паузах-фризах начинает транслироваться, но вылетает через минут пять. Во время зависаний мелькают постоянно такие ошибки:
[rtsp @ 0xb8c60c20] RTP: missed 7 packets         [rtsp @ 0xb8c60c20] max delay reached. need to consume packet
[rtsp @ 0xb8c60c20] RTP: missed 3 packets
[rtsp @ 0xb8c60c20] max delay reached. need to consume packet
[rtsp @ 0xb8c60c20] RTP: missed 1 packets

Что вы посоветуете чтобы избавиться от зависаний, во время которых пропадает и звук?
  • Вопрос задан
  • 257 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы