Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add wait_keyframe feature in the record module #274

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open

Add wait_keyframe feature in the record module #274

wants to merge 1 commit into from

Conversation

maxdolle
Copy link

I'm using the record module with a low record_interval (1 minute).
When I try to merge the segment files, the video stutters because the segment files have no video frame before the first key frame, and the first key frame can only appear after a few seconds.

This pull request provides an option "record_wait_keyframe"; when enabled, the next segment file always starts with a keyframe.

Tested with nginx 1.13.8, and behaviour verified with ffprobe -show_frames.

First video frame in a segment file with record_wait_keyframe disabled:

[FRAME]
media_type=video
stream_index=1
key_frame=1
pkt_pts=1251
pkt_pts_time=1.251000
...
[/FRAME]

First video frame in a segment file with record_wait_keyframe enabled:

[FRAME]
media_type=video
stream_index=1
key_frame=1
pkt_pts=80
pkt_pts_time=0.080000
...
[/FRAME]

@baxerus
Copy link

baxerus commented May 22, 2018

You have the code written already, but when you using such short recording intervals you could look into using the HLS segmenting feature instead (with long segments). The segments are well formed in terms of starting with keyframes.

@maxdolle
Copy link
Author

That's a good idea, it would make the server compatible with audio-only streams too.
I haven't managed to make the fragment size higher than 10s though, I'm get #EXT-X-DISCONTINUITY.

@baxerus
Copy link

baxerus commented May 25, 2018

This a bug that is closed even it is not fixed ☹️.
See: #152
As a workaround you simply also have to set hls_max_fragment to something a GOP-size or two longer that hls_fragment, because it is calculated wrong.

Perhaps you could also file a new bug report for this.

@sergey-dryabzhinsky
Copy link
Owner

@maxdolle I like idea of new option - the same meaning as for live secton option

@sergey-dryabzhinsky
Copy link
Owner

Please, add definition to doc/directives.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants