[FFmpeg-user] Problem keeping live stream in sync during transcode

Dragan Miljković dragan at bsnet.rs
Tue Feb 10 22:19:32 CET 2015


Hi

I've been banging my head for three weeks now trying to find a solution
for my problem but I had no luck so far. I'm trying to transcode a
DVB-S2 h264 stream into a lower rate h264 but sooner or later the
transcoded stream gets out of sync. The input stream is taken from a
satellite and I guess it has some sporadic errors which make output go
out of sync but is there an option which would make ffmpeg correct
on-the-fly these error by duplicating or dropping incorrect audio/video
frames? Please help!

The current command line I use is:

ffmpeg -i 'udp://239.1.4.3:1234?fifo_size=1000000&overrun_nonfatal=1' \
-map 0:0 -map 0:1 -c:v libx264 -preset faster -b:v 1500k -maxrate 2000k
-bufsize 3000k -g 25 -r 25 -crf 28 -fflags +genpts -vf yadif=0:-1:0 \
-ac 2 -b:a 128k -ar 44100 -acodec aac -strict experimental -vsync 1 \
-f mpegts udp://239.1.4.3:2015


And this is what I get:

ffmpeg version 2.5.git Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
  configuration: --prefix=/root/ffmpeg_build
--extra-cflags=-I/root/ffmpeg_build/include
--extra-ldflags=-L/root/ffmpeg_build/lib --bindir=/root/bin --enable-gpl
--enable-libass --enable-libfdk-aac --enable-libfreetype
--enable-libmp3lame --enable-libopus --enable-libtheora
--enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree
  libavutil      54. 18.100 / 54. 18.100
  libavcodec     56. 21.102 / 56. 21.102
  libavformat    56. 19.100 / 56. 19.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5.  9.104 /  5.  9.104
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
[h264 @ 0x2776540] non-existing PPS 0 referenced
[h264 @ 0x2776540] SEI type 1 size 8 truncated at 5
[h264 @ 0x2776540] non-existing PPS 0 referenced
[h264 @ 0x2776540] decode_slice_header error
[h264 @ 0x2776540] no frame!
[h264 @ 0x2776540] non-existing PPS 0 referenced
[h264 @ 0x2776540] SEI type 4 size 112 truncated at 111
[h264 @ 0x2776540] non-existing PPS 0 referenced
[h264 @ 0x2776540] decode_slice_header error
[h264 @ 0x2776540] no frame!
[h264 @ 0x2776540] non-existing PPS 0 referenced
[h264 @ 0x2776540] SEI type 1 size 8 truncated at 5
[h264 @ 0x2776540] non-existing PPS 0 referenced
[h264 @ 0x2776540] decode_slice_header error
[h264 @ 0x2776540] no frame!
[h264 @ 0x2776540] non-existing PPS 0 referenced
[h264 @ 0x2776540] SEI type 4 size 112 truncated at 111
[h264 @ 0x2776540] non-existing PPS 0 referenced
[h264 @ 0x2776540] decode_slice_header error
[h264 @ 0x2776540] no frame!
[h264 @ 0x2776540] non-existing PPS 0 referenced
[h264 @ 0x2776540] SEI type 1 size 8 truncated at 5
[h264 @ 0x2776540] non-existing PPS 0 referenced
[h264 @ 0x2776540] decode_slice_header error
[h264 @ 0x2776540] no frame!
[h264 @ 0x2776540] SEI type 4 size 112 truncated at 111
[h264 @ 0x2776540] mmco: unref short failure
    Last message repeated 1 times
[h264 @ 0x2776540] number of reference frames (0+4) exceeds max (3;
probably corrupt input), discarding one
[h264 @ 0x2776540] SEI type 1 size 8 truncated at 5
[h264 @ 0x2776540] SEI type 4 size 112 truncated at 111
[h264 @ 0x2776540] SEI type 1 size 8 truncated at 5
[h264 @ 0x2776540] SEI type 4 size 112 truncated at 111
[h264 @ 0x2776540] SEI type 1 size 8 truncated at 5
[h264 @ 0x2776540] SEI type 4 size 112 truncated at 111
[h264 @ 0x2776540] SEI type 1 size 8 truncated at 5
[h264 @ 0x2776540] SEI type 4 size 112 truncated at 111
[h264 @ 0x2776540] SEI type 1 size 8 truncated at 5
[h264 @ 0x2776540] SEI type 4 size 112 truncated at 111
[h264 @ 0x2776540] SEI type 1 size 8 truncated at 5
[h264 @ 0x2776540] SEI type 4 size 112 truncated at 111
[h264 @ 0x2776540] SEI type 1 size 8 truncated at 5
[h264 @ 0x2776540] SEI type 4 size 112 truncated at 111
[h264 @ 0x2776540] SEI type 1 size 8 truncated at 5
[h264 @ 0x2776540] SEI type 4 size 112 truncated at 111
[h264 @ 0x2776540] SEI type 1 size 8 truncated at 5
[h264 @ 0x2776540] SEI type 4 size 112 truncated at 111
[h264 @ 0x2776540] SEI type 1 size 8 truncated at 5
[h264 @ 0x2776540] SEI type 4 size 112 truncated at 111
[h264 @ 0x2776540] SEI type 1 size 8 truncated at 5
[h264 @ 0x2776540] SEI type 4 size 112 truncated at 111
[h264 @ 0x2776540] SEI type 1 size 8 truncated at 5
Input #0, mpegts, from
'udp://239.1.4.3:1234?fifo_size=1000000&overrun_nonfatal=1':
  Duration: N/A, start: 35152.263556, bitrate: N/A
  Program 473
    Metadata:
      service_name    : Discovery Serbia
      service_provider: POLARIS
    Stream #0:0[0x8ec]: Video: h264 (High) ([27][0][0][0] / 0x001B),
yuv420p(tv, bt470bg), 720x576 [SAR 12:11 DAR 15:11], 25 fps, 50 tbr, 90k
tbn, 50 tbc
    Stream #0:1[0x8ed](eng): Audio: mp2 ([3][0][0][0] / 0x0003), 48000
Hz, stereo, s16p, 128 kb/s
  Program 461
    Metadata:
      service_name    : RTS 1
      service_provider: POLARIS
  Program 462
    Metadata:
      service_name    : RTS 2
      service_provider: POLARIS
  Program 463
    Metadata:
      service_name    : Arena Sport 1
      service_provider: POLARIS
  Program 464
    Metadata:
      service_name    : Arena Sport 2
      service_provider: POLARIS
  Program 465
    Metadata:
      service_name    : Arena Sport 3
      service_provider: POLARIS
  Program 466
    Metadata:
      service_name    : Arena Sport 4
      service_provider: POLARIS
  Program 467
    Metadata:
      service_name    : Timocka TV
      service_provider: POLARIS
  Program 468
    Metadata:
      service_name    : PRVA
      service_provider: POLARIS
  Program 469
    Metadata:
      service_name    : RTV Novi Pazar
      service_provider: POLARIS
  Program 470
    Metadata:
      service_name    : TV B92
      service_provider: POLARIS
  Program 471
    Metadata:
      service_name    : Happy TV
      service_provider: POLARIS
  Program 472
    Metadata:
      service_name    : AXN Adria
      service_provider: POLARIS
  Program 474
    Metadata:
      service_name    : KCN
      service_provider: POLARIS
  Program 475
    Metadata:
      service_name    : Arena Sport BIH
      service_provider: POLARIS
  Program 476
    Metadata:
      service_name    : RTV1
      service_provider: POLARIS
  Program 477
    Metadata:
      service_name    : National Geographic
      service_provider: BULSATCOM
  Program 478
    Metadata:
      service_name    : Sky Plus
      service_provider: POLARIS
  Program 479
    Metadata:
      service_name    : Minimax
      service_provider: BULSATCOM
  Program 481
    Metadata:
      service_name    : OBN
      service_provider: POLARIS
  Program 482
    Metadata:
      service_name    : Arena Sport 5
      service_provider: POLARIS
  Program 483
    Metadata:
      service_name    : BNT World
      service_provider: BULSATCOM
  Program 488
    Metadata:
      service_name    : MGM
      service_provider: BULSATCOM
  Program 480
    Metadata:
      service_name    : Ekids
      service_provider: BULSATCOM
  Program 496
    Metadata:
      service_name    : City TV
      service_provider: BULSATCOM
  Program 489
    Metadata:
      service_name    : Comedy Central
      service_provider: BULSATCOM
  Program 486
    Metadata:
      service_name    : Evrokom
      service_provider: BULSATCOM
  Program 495
    Metadata:
      service_name    : ID Xtra
      service_provider: BULSATCOM
  Program 497
    Metadata:
      service_name    : BG TOP MUSIC
      service_provider: BULSATCOM
  Program 498
    Metadata:
      service_name    : MagicTV
      service_provider: BULSATCOM
  Program 499
    Metadata:
      service_name    : Cinemax
      service_provider: BULSATCOM
  Program 490
    Metadata:
      service_name    : BG Radio
      service_provider: BULSATCOM
  Program 493
    Metadata:
      service_name    : Tangra MegaRock
      service_provider: BULSATCOM
  Program 491
    Metadata:
      service_name    : Darik Radio
      service_provider: BULSATCOM
  Program 492
    Metadata:
      service_name    : Radio 1 Rock
      service_provider: BULSATCOM
  Program 494
    Metadata:
      service_name    : NRJ
      service_provider: BULSATCOM
  Program 502
    Metadata:
      service_name    : radio Payner
      service_provider: BULSATCOM
  Program 1020
    Metadata:
      service_name    : DATA11
      service_provider: BULSATCOM
  Program 1022
    Metadata:
      service_name    : CHL11
      service_provider: BULSATCOM
  Program 1021
    Metadata:
      service_name    : MSG11
      service_provider: BULSATCOM
  Program 1024
    Metadata:
      service_name    : MSGP11
      service_provider: BULSATCOM
[libx264 @ 0x2789320] using SAR=12/11
[libx264 @ 0x2789320] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 0x2789320] profile High, level 3.0
Output #0, mpegts, to 'udp://239.1.4.3:2015':
  Metadata:
    encoder         : Lavf56.19.100
    Stream #0:0: Video: h264 (libx264), yuv420p, 720x576 [SAR 12:11 DAR
15:11], q=-1--1, 1500 kb/s, 25 fps, 90k tbn, 25 tbc
    Metadata:
      encoder         : Lavc56.21.102 libx264
    Stream #0:1(eng): Audio: aac, 44100 Hz, stereo, fltp, 128 kb/s
    Metadata:
      encoder         : Lavc56.21.102 aac
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (mp2 (native) -> aac (native))
Press [q] to stop, [?] for help
[h264 @ 0x32a8d80] SEI type 1 size 8 truncated at 5
[h264 @ 0x32edb20] SEI type 4 size 112 truncated at 111

With the latest version I get a huge number of these warnings (SEI type
truncated) but I could live with that if it would only stay in sync.

It seems to me that the transcoded stream gets out of sync when I get these:

[h264 @ 0x175b280] number of reference frames (0+4) exceeds max (3;
probably corrupt input), discarding one
[h264 @ 0x175b280] reference picture missing during reorder
[h264 @ 0x175b280] Missing reference picture, default is 1020573
[h264 @ 0x12049a0] mmco: unref short failure
[h264 @ 0x143c980] mmco: unref short failure

Is there any way to make ffmpeg "resiliant to these errors??
Thank you!!


More information about the ffmpeg-user mailing list