☒ this will add a layer of complexity as the video is divided into small segments, but the end user browser still gets an unencrypted stream. You cannot really prevent downloading since the end user will need to play the video. However, if you were to have the video segments encrypted on the server side and provide a key to the end user to have their browser decrypt the video, this would add a level of complexity that most would just assume that they cannot access the videos.
This was an exceptional episode. I had a few questions/requests: - I'm wondering whether you could provide a few more resources about what you researched in order to figure out how to work with FFMPEG and HLS. For example, how often and where might you look to keep tabs on new developments/make updates so that you keep up with high quality video serving? - What are the tradeoffs that you've found to using mp4 over webm ? Since we have already broken out ffmpeg, should we add a step to transcode to webm instead of mp4? - I'm curious why did you choose to go with a bash script over writing an FFMPEG wrapper in ruby (or using an existing gem, like streamio-ffmpeg)? - When you deploy this to production -- how do you monitor resource usage/failures? - How might you write tests for an the `ConvertHls` class? - How might you debug the bash script if you deploy to prod?
- I'm wondering whether you could provide a few more resources about what you researched in order to figure out how to work with FFMPEG and HLS. For example, how often and where might you look to keep tabs on new developments/make updates so that you keep up with high quality video serving?
Honestly, I forget the resources that I came across while researching this episode. It was several weeks of research to get to this final product. However, the github pages for the videojs and https://github.com/videojs/http-streaming are good resources
☒
- What are the tradeoffs that you've found to using mp4 over webm ? Since we have already broken out ffmpeg, should we add a step to transcode to webm instead of mp4?
The web now-a-days works pretty good using MP4. So far, I've not seen any issues on the browsers and devices that i've tested on.
- I'm curious why did you choose to go with a bash script over writing an FFMPEG wrapper in ruby (or using an existing gem, like streamio-ffmpeg)?
I didn't want to add an additional dependency to my application. The bash script is complicated, but easy enough to debug locally.
- When you deploy this to production -- how do you monitor resource usage/failures?
I run the conversion in a background job. The background job handles retrying as well as notifications. As far as resources go, and since these are happening in a background job, I would rely on the infrastructure to handle notifications of peaks and autoscaling.
- How might you write tests for an the `ConvertHls` class?
I would probably include a tiny video file within my repo and use that as my test case. As edge cases arise, perhaps with other formats, those could be added as well. I would try to keep each video file <= 1MB (or have them externally available).
- How might you debug the bash script if you deploy to prod?
So far, I've not had to worry about this. Everything has been working fairly well. It is actually what I'm using on Drifting Ruby right now. However, if I did have to debug a production issue, I would probably pull down the video file in question and test it locally.
☒ In this example, it is persisting the data into memory for the life of the request. If there are a bunch of concurrent streams, then this could be problematic. However, on the 2GB RAM servers that I'm running Drifting Ruby on, I haven't seen it become a real issue yet.
☒Thanks! My current cluster is running 2 servers @ 4GB RAM each, so should be fine for the small amount of traffic that I have. I think what I'll want to know is how I can monitor so I know when I need to scale further.
☒ ooo that could be tricky. You could do an in app or email notification whenever it finishes. On this site, I have a slack notification which lets me know when it's finished. You may look into something like this https://superuser.com/a/1460400/86978 and then implement it with a progress bar ui like in this episode https://www.driftingruby.com/episodes/realtime-client-updates-from-background-jobs-with-stimulus
☒ It's likely some kind of issue with improper codecs or something. I do use handbrake on all of my videos before I upload them. I use the Web 1080p conversion. I don't know what that translates to on ffmpeg, but you might need to do some kind of transcoding before creating the variants.
Where are you receiving this error? All of the videos I use are using the H.264 video codec along with AAC Audio codec. If you're getting this error when transcoding the video, what version of ffmpeg do you have? I have a few different versions that are running on various machines that have done the transcoding.
And how to minimize segment size, right now its nearly 12mb which makes my server very slow on returning response. all I want to make segments to be very smaller in size (in kb) what is the way ?
That's going to greatly depend on the encoding quality. Check out Handbrake to see some of the settings and determine what is acceptable encoding quality. You can also look at the command running in the terminal (with top or htop) to get the ffmpeg settings used.
I don't think that I've tried using the M1 directly to do the encoding. I've always tested within a docker container since that's where I do most of my development.
This was an exceptional episode. I had a few questions/requests:
- I'm wondering whether you could provide a few more resources about what you researched in order to figure out how to work with FFMPEG and HLS. For example, how often and where might you look to keep tabs on new developments/make updates so that you keep up with high quality video serving?
- What are the tradeoffs that you've found to using mp4 over webm ? Since we have already broken out ffmpeg, should we add a step to transcode to webm instead of mp4?
- I'm curious why did you choose to go with a bash script over writing an FFMPEG wrapper in ruby (or using an existing gem, like streamio-ffmpeg)?
- When you deploy this to production -- how do you monitor resource usage/failures?
- How might you write tests for an the `ConvertHls` class?
- How might you debug the bash script if you deploy to prod?
Thanks!
Honestly, I forget the resources that I came across while researching this episode. It was several weeks of research to get to this final product. However, the github pages for the videojs and https://github.com/videojs/http-streaming are good resources
The web now-a-days works pretty good using MP4. So far, I've not seen any issues on the browsers and devices that i've tested on.
I didn't want to add an additional dependency to my application. The bash script is complicated, but easy enough to debug locally.
I run the conversion in a background job. The background job handles retrying as well as notifications. As far as resources go, and since these are happening in a background job, I would rely on the infrastructure to handle notifications of peaks and autoscaling.
I would probably include a tiny video file within my repo and use that as my test case. As edge cases arise, perhaps with other formats, those could be added as well. I would try to keep each video file <= 1MB (or have them externally available).
So far, I've not had to worry about this. Everything has been working fairly well. It is actually what I'm using on Drifting Ruby right now. However, if I did have to debug a production issue, I would probably pull down the video file in question and test it locally.
It seems that aac is a built in default, and im on ffmpeg v4
Just wondering if anyone has encountered the same, as my googling skills have failed me.
Any solution on this error ?
Its when transcoding the file, I guess its with this line -c:a aac
I don't think that I've tried using the M1 directly to do the encoding. I've always tested within a docker container since that's where I do most of my development.
it needs a space before new line char
Please correct it in your code sample