Skip to content

Commit 7078fd9

Browse files
update examples and README.md
1 parent d283308 commit 7078fd9

3 files changed

Lines changed: 95 additions & 84 deletions

File tree

README.md

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ This package uses the **[FFmpeg](https://ffmpeg.org)** to package media content
2424
- [Metadata](#metadata)
2525
- [Conversion](#conversion)
2626
- [Several Open Source Players](#several-open-source-players)
27+
- [FAQs](#faqs)
2728
- [Contributing and Reporting Bugs](#contributing-and-reporting-bugs)
2829
- [Credits](#credits)
2930
- [License](#license)
@@ -183,8 +184,7 @@ import sys
183184

184185
def monitor(ffmpeg, duration, time_, time_left, process):
185186
"""
186-
You can monitor ffmpeg command line and handle the process. For example, you can update a field in your database
187-
or log it to a file.
187+
Handling proccess.
188188
189189
Examples:
190190
1. Logging or printing ffmpeg command
@@ -194,16 +194,17 @@ def monitor(ffmpeg, duration, time_, time_left, process):
194194
if "something happened":
195195
process.terminate()
196196
197-
3. Email someone to notice the time of finishing process
198-
if time_left > 3600 and not already_send: # if it takes more than one hour and you did not email them already
197+
3. Email someone to inform about the time of finishing process
198+
if time_left > 3600 and not already_send: # if it takes more than one hour and you have not emailed them already
199+
ready_time = time_left + time.time()
199200
Email.send(
200201
201-
subject='Your video will be ready at %s seconds' % time_left,
202-
message='Your video takes more than an hour ...'
202+
subject='Your video will be ready by %s' % datetime.timedelta(seconds=ready_time),
203+
message='Your video takes more than %s hour(s) ...' % round(time_left / 3600)
203204
)
204205
already_send = True
205206
206-
4. Create a socket connection and show a progress bar(and other parameters) to users
207+
4. Create a socket connection and show a progress bar(or other parameters) to your users
207208
Socket.broadcast(
208209
address=127.0.0.1
209210
port=5050
@@ -372,11 +373,21 @@ You can use these libraries to play your streams.
372373
- **[FFmpeg(ffplay)](https://github.com/FFmpeg/FFmpeg) (Recommended)**
373374
- **[VLC media player](https://github.com/videolan/vlc)**
374375

375-
**NOTE-1:** You must pass a **link of the master playlist(manifest)**(i.e. `https://www.aminyazdanpanah.com/?"PATH TO STREAM DIRECTORY"/dash-stream.mpd` or `/PATH_TO_STREAM_DIRECTORY/hls-stream.m3u8` ) to these players.
376+
## FAQs
377+
**I created stream files and now what should I pass to a player?**
378+
You must pass a **master playlist(manifest) URL**(e.x. `https://www.aminyazdanpanah.com/?"PATH TO STREAM DIRECTORY"/dash-stream.mpd` or `/PATH_TO_STREAM_DIRECTORY/hls-stream.m3u8` ) to a player.
379+
See the demo page of these players for more information(**[hls.js Demo](https://hls-js.netlify.app/demo/)**, **[dash.js Demo](https://reference.dashif.org/dash.js/v3.1.2/samples/dash-if-reference-player/index.html)**, **[videojs Demo](https://videojs.com/advanced?video=elephantsdream)** and etc).
376380

377-
**NOTE-2:** If you save your stream content to a cloud(i.e. **[Amazon S3](https://aws.amazon.com/s3)**), the link of your master playlist and other contents **MUST BE PUBLIC**.
381+
**My player does not show the quality selector button to change the video quality?**
382+
Some Players do not have an embedded quality selector button to change this option and you should install(or add) the plugin for this use case. For example, if you are using Videojs to play your stream, you can install **[videojs-hls-quality-selector](https://github.com/chrisboustead/videojs-hls-quality-selector)** to show the quality selector. For adding a plugin to other players, you can easily Google it!
378383

379-
**NOTE-3:** As you may know, **[IOS](https://www.apple.com/ios)** does not have native support for DASH. Although there are some libraries such as **[Viblast](https://github.com/Viblast/ios-player-sdk)** and **[MPEGDASH-iOS-Player](https://github.com/MPEGDASHPlayer/MPEGDASH-iOS-Player)** to support this technique, I have never tested them. So maybe some of them will not work properly.
384+
**I uploaded my stream files to a cloud but it does not play on my website?**
385+
If you save your stream content to a cloud(i.e. **[Amazon S3](https://aws.amazon.com/s3)**), make sure your contents are **PUBLIC**. If they are not, you must change the access control.
386+
387+
**Does [IOS](https://www.apple.com/ios) support the DASH stream?**
388+
No, IOS does not have native support for DASH. Although there are some libraries such as **[Viblast](https://github.com/Viblast/ios-player-sdk)** and **[MPEGDASH-iOS-Player](https://github.com/MPEGDASHPlayer/MPEGDASH-iOS-Player)** to support this technique, I have never tested them. So maybe some of them will not work properly.
389+
390+
See [this page](https://video.aminyazdanpanah.com/start?r=faq#faq) for more FAQs.
380391

381392

382393
## Contributing and Reporting Bugs

examples/dash.py

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -24,43 +24,43 @@
2424

2525
def monitor(ffmpeg, duration, time_, time_left, process):
2626
"""
27-
You can monitor ffmpeg command line and handle the process. For example, you can update a field in your database
28-
or log it to a file.
29-
30-
Examples:
31-
1. Logging or printing ffmpeg command
32-
logging.info(ffmpeg) or print(ffmpeg)
33-
34-
2. Handling Process object
35-
if "something happened":
36-
process.terminate()
37-
38-
3. Email someone to notice the time of finishing process
39-
if time_left > 3600 and not already_send: # if it takes more than one hour and you did not email them already
40-
Email.send(
41-
42-
subject='Your video will be ready at %s seconds' % time_left,
43-
message='Your video takes more than an hour ...'
44-
)
45-
already_send = True
46-
47-
4. Create a socket connection and show a progress bar(and other parameters) to users
48-
Socket.broadcast(
49-
address=127.0.0.1
50-
port=5050
51-
data={
52-
percentage = per,
53-
time_left = datetime.timedelta(seconds=int(time_left))
54-
}
55-
)
56-
57-
:param ffmpeg: ffmpeg command line
58-
:param duration: duration of the video
59-
:param time_: current time of transcoded video
60-
:param time_left: seconds left to finish the video process
61-
:param process: subprocess object
62-
:return: None
63-
"""
27+
Handling proccess.
28+
29+
Examples:
30+
1. Logging or printing ffmpeg command
31+
logging.info(ffmpeg) or print(ffmpeg)
32+
33+
2. Handling Process object
34+
if "something happened":
35+
process.terminate()
36+
37+
3. Email someone to inform about the time of finishing process
38+
if time_left > 3600 and not already_send: # if it takes more than one hour and you have not emailed them already
39+
ready_time = time_left + time.time()
40+
Email.send(
41+
42+
subject='Your video will be ready by %s' % datetime.timedelta(seconds=ready_time),
43+
message='Your video takes more than %s hour(s) ...' % round(time_left / 3600)
44+
)
45+
already_send = True
46+
47+
4. Create a socket connection and show a progress bar(or other parameters) to your users
48+
Socket.broadcast(
49+
address=127.0.0.1
50+
port=5050
51+
data={
52+
percentage = per,
53+
time_left = datetime.timedelta(seconds=int(time_left))
54+
}
55+
)
56+
57+
:param ffmpeg: ffmpeg command line
58+
:param duration: duration of the video
59+
:param time_: current time of transcoded video
60+
:param time_left: seconds left to finish the video process
61+
:param process: subprocess object
62+
:return: None
63+
"""
6464
per = round(time_ / duration * 100)
6565
sys.stdout.write(
6666
"\rTranscoding...(%s%%) %s left [%s%s]" %

examples/hls.py

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -24,43 +24,43 @@
2424

2525
def monitor(ffmpeg, duration, time_, time_left, process):
2626
"""
27-
You can monitor ffmpeg command line and handle the process. For example, you can update a field in your database
28-
or log it to a file.
29-
30-
Examples:
31-
1. Logging or printing ffmpeg command
32-
logging.info(ffmpeg) or print(ffmpeg)
33-
34-
2. Handling Process object
35-
if "something happened":
36-
process.terminate()
37-
38-
3. Email someone to notice the time of finishing process
39-
if time_left > 3600 and not already_send: # if it takes more than one hour and you did not email them already
40-
Email.send(
41-
42-
subject='Your video will be ready at %s seconds' % time_left,
43-
message='Your video takes more than an hour ...'
44-
)
45-
already_send = True
46-
47-
4. Create a socket connection and show a progress bar(and other parameters) to users
48-
Socket.broadcast(
49-
address=127.0.0.1
50-
port=5050
51-
data={
52-
percentage = per,
53-
time_left = datetime.timedelta(seconds=int(time_left))
54-
}
55-
)
56-
57-
:param ffmpeg: ffmpeg command line
58-
:param duration: duration of the video
59-
:param time_: current time of transcoded video
60-
:param time_left: seconds left to finish the video process
61-
:param process: subprocess object
62-
:return: None
63-
"""
27+
Handling proccess.
28+
29+
Examples:
30+
1. Logging or printing ffmpeg command
31+
logging.info(ffmpeg) or print(ffmpeg)
32+
33+
2. Handling Process object
34+
if "something happened":
35+
process.terminate()
36+
37+
3. Email someone to inform about the time of finishing process
38+
if time_left > 3600 and not already_send: # if it takes more than one hour and you have not emailed them already
39+
ready_time = time_left + time.time()
40+
Email.send(
41+
42+
subject='Your video will be ready by %s' % datetime.timedelta(seconds=ready_time),
43+
message='Your video takes more than %s hour(s) ...' % round(time_left / 3600)
44+
)
45+
already_send = True
46+
47+
4. Create a socket connection and show a progress bar(or other parameters) to your users
48+
Socket.broadcast(
49+
address=127.0.0.1
50+
port=5050
51+
data={
52+
percentage = per,
53+
time_left = datetime.timedelta(seconds=int(time_left))
54+
}
55+
)
56+
57+
:param ffmpeg: ffmpeg command line
58+
:param duration: duration of the video
59+
:param time_: current time of transcoded video
60+
:param time_left: seconds left to finish the video process
61+
:param process: subprocess object
62+
:return: None
63+
"""
6464
per = round(time_ / duration * 100)
6565
sys.stdout.write(
6666
"\rTranscoding...(%s%%) %s left [%s%s]" %

0 commit comments

Comments
 (0)