GithubHelp home page GithubHelp logo

delayed video on rtsp stream about ijkplayer HOT 13 OPEN

bilibili avatar bilibili commented on May 13, 2024
delayed video on rtsp stream

from ijkplayer.

Comments (13)

adilmalik07 avatar adilmalik07 commented on May 13, 2024 1

I try to play stream using ffplay from terminal and there was a latency for ~1 second.

Also what is the best to integrate this library in another project because currently files being used are very scattered.

from ijkplayer.

bbcallen avatar bbcallen commented on May 13, 2024

Modify these macros to reduce latency.

#define DEFAULT_HIGH_WATER_MARK_IN_BYTES    (128 * 1024)

#define DEFAULT_MAX_HIGH_WATER_MARK_IN_MS       (5 * 1000)
#define DEFAULT_NORMAL_HIGH_WATER_MARK_IN_MS    (2 * 1000)
#define DEFAULT_FAST_HIGH_WATER_MARK_IN_MS      (100)

#define MAX_QUEUE_SIZE (15 * 1024 * 1024)
#define MIN_FRAMES 50000

from ijkplayer.

bbcallen avatar bbcallen commented on May 13, 2024

FYI, The original MIN_FRAMES in ffplay is

#define MIN_FRAMES 5

from ijkplayer.

tulkas85 avatar tulkas85 commented on May 13, 2024

Thank you, but I have now other questions.

I must change these values af ff_ffplay_def.h , is right ?
Can you suggest me some value ?
I could set

#define DEFAULT_MAX_HIGH_WATER_MARK_IN_MS       ( 1000)
#define DEFAULT_NORMAL_HIGH_WATER_MARK_IN_MS    (500)
#define DEFAULT_FAST_HIGH_WATER_MARK_IN_MS      (100)
#define MIN_FRAMES 5

but these ????

#define DEFAULT_HIGH_WATER_MARK_IN_BYTES    (128 * 1024)
#define MAX_QUEUE_SIZE (15 * 1024 * 1024)

After edit file, from which step of your guide I have to start with the compilation? ndk-build ???

I've read something about analyzeDuration :
https://bbs.vitamio.org/topics/220/parts/51751e9d1b27a78e1c0000fe?locale=zh-CN

It can help ?

from ijkplayer.

bbcallen avatar bbcallen commented on May 13, 2024

Your value is fine, ndk-build is enough.

The macros should work with HLS. But for rtsp/rtmp/etc, I don't have much knowledge about them.

The analyzeDuration can be set through ijkmp_set_codec_option(), which could be easily exposed to java layer as ijkmp_set_format_option() does.

from ijkplayer.

tulkas85 avatar tulkas85 commented on May 13, 2024

with these values I have a delay of 3 secs ... now is better.
I have rtsp stream, so this values work with rtsp too.
But now how can I further reduce the delay?

from ijkplayer.

bbcallen avatar bbcallen commented on May 13, 2024

Set these values to 0 is OK. In fact, the original ffplay doesn't have these limit.

#define DEFAULT_MAX_HIGH_WATER_MARK_IN_MS       (0)
#define DEFAULT_NORMAL_HIGH_WATER_MARK_IN_MS    (0)
#define DEFAULT_FAST_HIGH_WATER_MARK_IN_MS      (0)

I add them for streaming video on network with bad quality traffic.

Also have a look at these code commented out by me.

#ifdef FFP_MERGE
        if (is->paused != is->last_paused) {
            is->last_paused = is->paused;
            if (is->paused)
                is->read_pause_return = av_read_pause(ic);
            else
                av_read_play(ic);
        }
#endif
#if CONFIG_RTSP_DEMUXER || CONFIG_MMSH_PROTOCOL
        if (is->paused &&
                (!strcmp(ic->iformat->name, "rtsp") ||
                 (ic->pb && !strncmp(ffp->input_filename, "mmsh:", 5)))) {
            /* wait 10 ms to avoid trying to get another packet */
            /* XXX: horrible */
            SDL_Delay(10);
            continue;
        }
#endif

I'm not sure if they are related to the delay.

from ijkplayer.

tulkas85 avatar tulkas85 commented on May 13, 2024

I confirm that MIN_FRAMES 5 reduce delay, but video stream is less stable on long durate. Videoview often goes in error state.
I don't see improvements by varying other parameters

from ijkplayer.

bbcallen avatar bbcallen commented on May 13, 2024

No idea at all. Try your local ffplay from apt-get, yum, macport, hombrew, blablabla.

from ijkplayer.

loveq369 avatar loveq369 commented on May 13, 2024

What's the meaning "FFP_MERGE".

from ijkplayer.

adilmalik07 avatar adilmalik07 commented on May 13, 2024

I'm getting a delay of 4-7 seconds on iOS using this library while ffplay has <=1 second delay on mac using local wifi. Any idea how to resolve this issue?

from ijkplayer.

progamertr avatar progamertr commented on May 13, 2024

Which client do you get under 1 second latency ?

Are you sure that both your clients use same transport layer ?

from ijkplayer.

jsumitro-appscore avatar jsumitro-appscore commented on May 13, 2024

I try to play an UDP stream and I am experiencing a significant delay, about 7 seconds.
I have modify the macros in ff_ffplay_def.h and re-compile the library by running the compile-ffmpeg and compile-ijk again. However, the delays remains the same.

Any idea why? Is there any macros that needs to be changed as well?

from ijkplayer.

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.