Comments (17)
You are welcome, let me know regarding your progress, I'm really interested in it :-)
Hey @kokorin Many thanks for this wonderful library, since you have asked my progress about the project. I was able to build a complete streaming server using spring boot using you lib.
Instead of converting RTSP to MP4 like I showed in my previous code, I consume the RTSP stream and then convert it to HLS. Also I have optimized the code to not to repeat for each individual request.
Unfortunately I cannot share screen shots or disclose further details respecting the nature of the project. Sorry for that.
Many thanks Again @kokorin God Bless
from jaffree.
@Just625 I believe segments and manifest are stored on disk using ffmpeg. User's player requests m3u8 manifest using http, it's served from disk, then player starts requesting segments which are also served from disk
@Just625 sorry for the delayed response, yes this is what i did..
In short -> this is how it goes
- Client requests a camera stream through a REST API
- FFmpeg reads RTSP stream and start dumping chunks in server root (in mycase a folder inside IIS root)
- My backend waits (Deferred Result in Spring Boot)until index.m3u8 gets generated for the requested stream and respond back to the client the link of the chunks (IIS folder mentioned in step 2) as response to API mentioned in step 1
- The link received is played by Hls.js in my angular frontend
from jaffree.
@SheikhZayed thank you for updating me, I'm really glad you managed to make it working.
from jaffree.
@Just625 I believe segments and manifest are stored on disk using ffmpeg. User's player requests m3u8 manifest using http, it's served from disk, then player starts requesting segments which are also served from disk
from jaffree.
@Just625 I didn't get it: does it work for you? if you need further advises use discussions, not issues.
And one more thing: consider using fragmented MP4 chunks instead of TS.
from jaffree.
Hello!
First of all controllers are not intended to transfer real time data.
Second, you set frame count to 100, and you got 100 frames in output:
Notice reported FPS - it's 15, not 1/10. Which gives 100/15 = 6.66 seconds.
Third, you set also max stream duration. FFMPEG will stop at either 100th frame, or after 1 hour.
I would highly recommend to revisit the approach to delivering a stream to a client. With current approach ffmpeg will be started for every client, which is not optimal of course.
It's better to read rtsp stream and write fragmented MP4 chunks on disk. When a client connects, chunks should be served from disk.
from jaffree.
Thanks @kokorin
This is my first attempt with RTSP streams, your answer's to my following questions would be helpful ?
- Your comment "First of all controllers are not intended to transfer real time data" is even valid if i use Spring Streaming Response body which is intended for the realtime data transfer purpose ?
- Your comment "It's better to read rtsp stream and write fragmented MP4 chunks" , I'm planning to convert RTSP to HLS and then save ts/m3u8 files and expose those files to client. Is this way optimal ?
from jaffree.
Your comment "First of all controllers are not intended to transfer real time data" is even valid if i use Spring Streaming Response body which is intended for the realtime data transfer purpose ?
Yes. Consider that HTTP requests pass through different HTTP reverse proxy servers. Default response timeout is 30 seconds. So intermediate servers will close connection after timeout, despite server transfers data. I can recommend you to read about long polling technic.
Your comment "It's better to read rtsp stream and write fragmented MP4 chunks" , I'm planning to convert RTSP to HLS and then save ts/m3u8 files and expose those files to client. Is this way optimal ?
Yes, it would be much better. ffmpeg allows to dump chunks on disk, and it will update manifest file periodically. So you need only to keep tracking of old chunks and delete them after some time (10-30 minutes).
from jaffree.
Thanks @kokorin for the great library and your help regarding my comments..
from jaffree.
You are welcome, let me know regarding your progress, I'm really interested in it :-)
from jaffree.
sure, i will share the updates :)
@kokorin does the API have any callback that gets fired if the index.m3u8 is created for the first time
from jaffree.
Sorry @SheikhZayed but you ask unrelated questions in "not-an-issue" thread. If you mean ffmpeg API - check ffmpeg. If you mean Jaffree - you can find examples in readme. Rule of thumb: before implementing something with Jaffree just experiment with ffmpeg CLI.
from jaffree.
Thanks @kokorin
from jaffree.
Hi @SheikhZayed, can you share a bit more info about how you send the hls files to clients?
from jaffree.
@kokorin thank you for the fast reply. So I created a Restfull API to get file from disk using the input as the file name. In the FFmpeg command: I add "-hls_base_url http://my-api-i-just-created/". So in front-end I use videojs library and I just put the API in src property of the video tag to get the .m3u8 file and it will automatically call that API many times to get child files (.ts files)
from jaffree.
Hi @kokorin, yes it works for me.
Thanks for the advice, I didn't know about fragmented MP4 before. I will try to use it to replace TS
from jaffree.
@Just625 I didn't get it: does it work for you? if you need further advises use discussions, not issues. And one more thing: consider using fragmented MP4 chunks instead of TS.
@kokorin what is the benifit of using fragmented MP4 over TS ?
from jaffree.
Related Issues (20)
- use the example: Cut and scale media file, but it doesn't work HOT 8
- How do you get the error message returned by FFmpeg? HOT 4
- Global option doesn't work HOT 2
- Process quit silently in windows server 2019 HOT 3
- FFMpeg process takes 10sec to start the stream HOT 4
- Add HLS re-streaming example of live stream HOT 1
- Converting H264 Bytestream to ISMV HOT 1
- Cannot get formed FFMPEG cli command as string HOT 2
- How to use Jaffree with Spring Boot for streaming a RTSP ? HOT 7
- Draw BufferedImage(ARGB) on video frames? HOT 7
- how to concat video.
- DemuxerInput.java not found HOT 1
- Connection refused error With OutputStream and WebSocket HOT 2
- ProcessHandler will terminate execution prematurely if a FrameConsumer is too slow HOT 12
- MacOS builds fail on FFmpegTest.testSizeLimit() HOT 2
- Process execution has ended with non-zero status: -1073741819 HOT 1
- How to perform screen recorder using this library? HOT 6
- Expose the `pid` to be able to kill the process manually. HOT 13
- TCP negotiation failed HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jaffree.