Skip to content

Commit

Permalink
Add support for frame rate pull down
Browse files Browse the repository at this point in the history
  • Loading branch information
KarlGallagher committed Jun 7, 2021
1 parent 4cc6859 commit 98da2f5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
10 changes: 10 additions & 0 deletions streamer/bitrate_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ class VideoResolutionName(configuration.RuntimeMapKeyValidator):
'144p': VideoResolution({
'max_width': 256,
'max_height': 144,
'max_frame_rate': 30,
'bitrates': {
'h264': '108k',
'vp9': '96k',
Expand All @@ -231,6 +232,7 @@ class VideoResolutionName(configuration.RuntimeMapKeyValidator):
'240p': VideoResolution({
'max_width': 426,
'max_height': 240,
'max_frame_rate': 30,
'bitrates': {
'h264': '242k',
'vp9': '151k',
Expand All @@ -241,6 +243,7 @@ class VideoResolutionName(configuration.RuntimeMapKeyValidator):
'360p': VideoResolution({
'max_width': 640,
'max_height': 360,
'max_frame_rate': 30,
'bitrates': {
'h264': '400k',
'vp9': '277k',
Expand All @@ -251,6 +254,7 @@ class VideoResolutionName(configuration.RuntimeMapKeyValidator):
'480p': VideoResolution({ # NTSC analog broadcast TV resolution
'max_width': 854,
'max_height': 480,
'max_frame_rate': 30,
'bitrates': {
'h264': '1M',
'vp9': '512k',
Expand All @@ -261,6 +265,7 @@ class VideoResolutionName(configuration.RuntimeMapKeyValidator):
'576p': VideoResolution({ # PAL analog broadcast TV resolution
'max_width': 1024,
'max_height': 576,
'max_frame_rate': 30,
'bitrates': {
'h264': '1.5M',
'vp9': '768k',
Expand All @@ -282,6 +287,7 @@ class VideoResolutionName(configuration.RuntimeMapKeyValidator):
'720p-hfr': VideoResolution({
'max_width': 1280,
'max_height': 720,
'max_frame_rate': 60,
'bitrates': {
'h264': '3M',
'vp9': '2M',
Expand All @@ -303,6 +309,7 @@ class VideoResolutionName(configuration.RuntimeMapKeyValidator):
'1080p-hfr': VideoResolution({
'max_width': 1920,
'max_height': 1080,
'max_frame_rate': 60,
'bitrates': {
'h264': '5M',
'vp9': '3M',
Expand All @@ -324,6 +331,7 @@ class VideoResolutionName(configuration.RuntimeMapKeyValidator):
'1440p-hfr': VideoResolution({
'max_width': 2560,
'max_height': 1440,
'max_frame_rate': 60,
'bitrates': {
'h264': '14M',
'vp9': '9M',
Expand All @@ -345,6 +353,7 @@ class VideoResolutionName(configuration.RuntimeMapKeyValidator):
'4k-hfr': VideoResolution({
'max_width': 4096,
'max_height': 2160,
'max_frame_rate': 60,
'bitrates': {
'h264': '25M',
'vp9': '18M',
Expand All @@ -366,6 +375,7 @@ class VideoResolutionName(configuration.RuntimeMapKeyValidator):
'8k-hfr': VideoResolution({
'max_width': 8192,
'max_height': 4320,
'max_frame_rate': 60,
'bitrates': {
'h264': '60M',
'vp9': '36M',
Expand Down
3 changes: 3 additions & 0 deletions streamer/transcoder_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,9 @@ def _encode_video(self, stream: VideoOutputStream, input: Input) -> List[str]:
filters.append('pp=fd')
args.extend(['-r', str(input.frame_rate)])

if stream.resolution.max_frame_rate < input.frame_rate:
args.extend(['-r', str(stream.resolution.max_frame_rate)])

filters.extend(input.filters)

hwaccel_api = self._pipeline_config.hwaccel_api
Expand Down

0 comments on commit 98da2f5

Please sign in to comment.