Skip to content

Commit 648c55e

Browse files
Add support for disabling b-frames in video_codec transformation parameter
1 parent ab8121e commit 648c55e

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

cloudinary/utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,9 @@ def process_video_codec_param(param):
530530
out_param = out_param + ':' + param['profile']
531531
if 'level' in param:
532532
out_param = out_param + ':' + param['level']
533+
if param.get('b_frames') is False:
534+
out_param = out_param + ':' + 'bframes_no'
535+
533536
return out_param
534537

535538

test/test_utils.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,18 @@ def test_video_codec(self):
794794
'level': '3.1'}},
795795
expected_url=VIDEO_UPLOAD_PATH + "vc_h264:basic:3.1/video_id")
796796

797+
# b_frames=True -> should not add b_frames parameter
798+
self.__test_cloudinary_url(public_id="video_id", options={'resource_type': 'video',
799+
'video_codec': {'codec': 'h265', 'profile': 'auto',
800+
'level': 'auto', 'b_frames': True}},
801+
expected_url=VIDEO_UPLOAD_PATH + "vc_h265:auto:auto/video_id")
802+
803+
# should support a b_frames parameter - b_frames=False -> bframes_no
804+
self.__test_cloudinary_url(public_id="video_id", options={'resource_type': 'video',
805+
'video_codec': {'codec': 'h265', 'profile': 'auto',
806+
'level': 'auto', 'b_frames': False}},
807+
expected_url=VIDEO_UPLOAD_PATH + "vc_h265:auto:auto:bframes_no/video_id")
808+
797809
def test_audio_codec(self):
798810
# should support a string value
799811
self.__test_cloudinary_url(public_id="video_id", options={'resource_type': 'video', 'audio_codec': 'acc'},

0 commit comments

Comments
 (0)