Giter VIP home page Giter VIP logo

Comments (8)

vbence avatar vbence commented on August 22, 2024

Thanks for the report. The 100% CPU thing is an unrelated (known) issue, patch coming soon for that one.

The Buffer full exception is caused by your stream exceeding the 2 megabytes of maximal fragment size. Please make sure that key frames are inserted frequently enough into the stream. the -g 125 seems pretty high. You can check out the parts about the ideal fragment size in the readme.

On the other hand... in theory 8 seconds of your stream (of 1800 kbps) should still fit into the 2MByte buffer. If you are using a frame rate higher than 16 it should be OK, but let's try something like -g 60 and see what happens... :)

from stream-m.

fflo avatar fflo commented on August 22, 2024

Hi vbence,
reducing the key frame rate results in random ffmpeg / stream-m freeze, like i.e.:

flo@[...]:~$ /opt/ffmpeg-git/bin/ffmpeg -i "udp://@239.100.0.3:1234?overrun_nonfatal=1&fifo_size=50000000" -map 0:0 -map 0:1 -filter:v "scale=iw*sar:ih , pad=max(iw\,ih*(16/9)):ow/(16/9):(ow-iw)/2:(oh-ih)/2" -aspect 16:9 -s 640x352 -async 1 -c:v libvpx -g 60 -b:v 1660k -quality realtime -cpu-used 2 -threads 4 -minrate 0k -maxrate 1880k -bufsize 8500k -qmin 10 -qmax 42 -lag-in-frames 8 -c:a libvorbis -ac 2 -ab 96k -ar 44100 -sn -f webm 'http://localhost:8080/publish/first?password=secret'
ffmpeg version N-71157-g7c6b043 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.7 (Debian 4.7.2-5)
  configuration: --prefix=/opt/ffmpeg-git --enable-gpl --enable-pthreads --enable-libx264 --enable-librtmp --enable-nonfree --enable-libmp3lame --enable-libfdk-aac --enable-openssl --enable-gnutls --enable-libvpx --enable-libvorbis
  libavutil      54. 21.100 / 54. 21.100
  libavcodec     56. 32.100 / 56. 32.100
  libavformat    56. 26.101 / 56. 26.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 13.101 /  5. 13.101
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
[mpeg2video @ 0x292b6c0] Invalid frame dimensions 0x0.
    Last message repeated 4 times
[mpegts @ 0x29043c0] Could not find codec parameters for stream 3 (Unknown: none ([5][0][0][0] / 0x0005)): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[mpegts @ 0x29043c0] Could not find codec parameters for stream 4 (Unknown: none ([11][0][0][0] / 0x000B)): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mpegts, from 'udp://@239.100.0.3:1234?overrun_nonfatal=1&fifo_size=50000000':
  Duration: N/A, start: 81912.896889, bitrate: N/A
  Program 32
    Metadata:
      service_name    : Das Erste
      service_provider: BR
    Stream #0:0[0x201]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv), 720x576 [SAR 64:45 DAR 16:9], max. 2692 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x202](deu): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 192 kb/s (clean effects)
    Stream #0:2[0x204](ger): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006)
    Stream #0:3[0x816]: Unknown: none ([5][0][0][0] / 0x0005)
    Stream #0:4[0x87c]: Unknown: none ([11][0][0][0] / 0x000B)
-async is forwarded to lavfi similarly to -af aresample=async=1:min_hard_comp=0.100000:first_pts=0.
[libvpx @ 0x293e340] v1.3.0-5807-g0c85718
Output #0, webm, to 'http://localhost:8080/publish/first?password=secret':
  Metadata:
    encoder         : Lavf56.26.101
    Stream #0:0: Video: vp8 (libvpx), yuv420p, 640x352 [SAR 44:45 DAR 16:9], q=10-42, 1660 kb/s, 25 fps, 1k tbn, 25 tbc
    Metadata:
      encoder         : Lavc56.32.100 libvpx
    Stream #0:1(deu): Audio: vorbis (libvorbis), 44100 Hz, stereo, fltp, 96 kb/s (clean effects)
    Metadata:
      encoder         : Lavc56.32.100 libvorbis
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg2video (native) -> vp8 (libvpx))
  Stream #0:1 -> #0:1 (mp2 (native) -> vorbis (libvorbis))
Press [q] to stop, [?] for help
[mpegts @ 0x29043c0] PES packet size mismatche=00:52:06.04 bitrate=1601.9kbits/s
[mp2 @ 0x29466c0] Header missing
Error while decoding stream #0:1: Invalid data found when processing input
[mpeg2video @ 0x2946200] ac-tex damaged at 38 10
[mpeg2video @ 0x2946200] Warning MVs not available
[mpeg2video @ 0x2946200] concealing 90 DC, 90 AC, 90 MV errors in I frame
frame=84836 fps= 25 q=0.0 size=  673335kB time=00:56:34.20 bitrate=1625.1kbits/s

It's freezing at frame 84836; stream-m is showing 100% cpu load since the freeze and delivers the last 2 seconds pushed to the service on URL request.
Do you have an idea what may cause ffmpeg to freeze completely trying to push a stream to stream-m on localhost?
I've already tried out different versions of ffmpeg and avconv with the same result...

-Flo

from stream-m.

vbence avatar vbence commented on August 22, 2024

The 100% CPU is (probably) caused by ffmpeg unexpectedly closing the connection (and stream-m not handling it too well). So the cause should be on the ffmpeg side of things.

It might be some quirk in the input (if you are reading the stream from a DVB tuner, practically any random error can be in the data). What happens if you write the output to a local file instead of http?

from stream-m.

fflo avatar fflo commented on August 22, 2024

Transcoding the same source stream with x264 / libfdk_aac and pushing it to ffserver works without any flaw, i.e.:

ffmpeg -i udp://@239.100.0.3:1234?overrun_nonfatal=1&fifo_size=25000000 -override_ffserver -vf scale=iw*sar:ih , pad=max(iw\,ih*(16/9)):ow/(16/9):(ow-iw)/2:(oh-ih)/2 -aspect 16:9 -s 640x352 -async 1 -map 0:1 -c:a libfdk_aac -ab 64k -ac 2 -ar 44100 -flags +global_header -map 0:0 -c:v libx264 -profile:v main -preset:v veryfast -level 3.1 -x264opts keyint=125:min-keyint=10:crf=15 -maxrate 1660k -bufsize 8500k -flags +global_header http://127.0.0.1:8088/74.ffm

What may cause ffmpeg and ivconv to freeze completely while pushing a webm live stream to stream-m?
It seems to me that the issue preferrably arises in case of massive input video change (like i.e. ads or previews running).

I keep on debugging this issue with -loglevel debug, tcpdump and writing to a file simultaneously with a second thread and let you know on the results.

from stream-m.

fflo avatar fflo commented on August 22, 2024

According to loglevel -debug ffmpeg is freezing occasionally while Starting new cluster at offset, i.e.

[webm @ 0x28f3600] Writing block at offset 17, size 265, pts 472824, dts 472824, duration 23, flags 128
[webm @ 0x28f3600] Writing block at offset 289, size 6093, pts 472843, dts 472843, duration 40, flags 0
[webm @ 0x28f3600] Writing block at offset 6389, size 310, pts 472847, dts 472847, duration 23, flags 128
[webm @ 0x28f3600] Writing block at offset 6706, size 253, pts 472870, dts 472870, duration 23, flags 128
[webm @ 0x28f3600] Writing block at offset 6966, size 3576, pts 472883, dts 472883, duration 40, flags 0
[webm @ 0x28f3600] Writing block at offset 10549, size 309, pts 472893, dts 472893, duration 23, flags 128
Cliping frame in rate conversion by 0.113045
    Last message repeated 2 times
[webm @ 0x28f3600] Writing block at offset 10865, size 245, pts 472917, dts 472917, duration 23, flags 128
[webm @ 0x28f3600] Writing block at offset 11117, size 5474, pts 472923, dts 472923, duration 40, flags 0
[webm @ 0x28f3600] Writing block at offset 16598, size 301, pts 472940, dts 472940, duration 23, flags 128
[webm @ 0x28f3600] Writing block at offset 16906, size 5975, pts 472963, dts 472963, duration 40, flags 0
[webm @ 0x28f3600] Writing block at offset 22888, size 251, pts 472963, dts 472963, duration 23, flags 128
[webm @ 0x28f3600] Writing block at offset 23146, size 287, pts 472986, dts 472986, duration 23, flags 128
[webm @ 0x28f3600] Writing block at offset 23440, size 17451, pts 473003, dts 473003, duration 40, flags 0
[webm @ 0x28f3600] Starting new cluster at offset 40899 bytes, pts 473009dts 473009
[webm @ 0x28f3600] Writing block at offset 17, size 247, pts 473009, dts 473009, duration 23, flags 128
[webm @ 0x28f3600] Writing block at offset 271, size 282, pts 473033, dts 473033, duration 23, flags 128
[webm @ 0x28f3600] Writing block at offset 560, size 8666, pts 473043, dts 473043, duration 40, flags 0
[webm @ 0x28f3600] Writing block at offset 9233, size 299, pts 473056, dts 473056, duration 23, flags 128
[webm @ 0x28f3600] Writing block at offset 9539, size 295, pts 473079, dts 473079, duration 23, flags 128
[webm @ 0x28f3600] Writing block at offset 9841, size 5228, pts 473083, dts 473083, duration 40, flags 0
Cliping frame in rate conversion by 0.113045
    Last message repeated 1 times
[webm @ 0x28f3600] Writing block at offset 15076, size 283, pts 473102, dts 473102, duration 23, flags 128
[webm @ 0x28f3600] Writing block at offset 15366, size 8835, pts 473123, dts 473123, duration 40, flags 0
[webm @ 0x28f3600] Writing block at offset 24208, size 246, pts 473126, dts 473126, duration 23, flags 128
[webm @ 0x28f3600] Writing block at offset 24461, size 292, pts 473149, dts 473149, duration 23, flags 128
[webm @ 0x28f3600] Writing block at offset 24760, size 8387, pts 473163, dts 473163, duration 40, flags 0
[webm @ 0x28f3600] Starting new cluster at offset 33154 bytes, pts 473172dts 473172

Seems this may be an unfixed ffmpeg bug, according to https://ffmpeg.org/pipermail/ffmpeg-user/2012-March/005464.html ...
Do you have an idea what ffmpeg is trying to do while Starting a new cluster at offset?

from stream-m.

fflo avatar fflo commented on August 22, 2024

The Buffer full exception also occurs using -g 60.

ffmpeg does not freeze saving the results to a file; I'm only able to reproduce the freeze problem using stream-m as the output.

Do you have an idea how further debug this issue :)

from stream-m.

vbence avatar vbence commented on August 22, 2024

Hmm... can you save part of the raw stream to a ts file and reproduce the problem with it? With that / theoretical - file I'm sure I can trap it.

from stream-m.

fflo avatar fflo commented on August 22, 2024

Hi vbence,
can you please publish a release containing the latest commits?
I would like to tryout if the issues meanwhile have been resolved (by ffmpeg or stream-m).

from stream-m.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.