@@ -613,14 +613,14 @@ void encode_video_to_file(
613613 const at::Tensor& frames,
614614 int64_t frame_rate,
615615 std::string_view file_name,
616- std::optional<std::string > codec = std::nullopt ,
616+ std::optional<std::string_view > codec = std::nullopt ,
617617 std::optional<std::string_view> pixel_format = std::nullopt ,
618618 std::optional<double > crf = std::nullopt ,
619619 std::optional<std::string_view> preset = std::nullopt ,
620620 std::optional<std::vector<std::string>> extra_options = std::nullopt ) {
621621 VideoStreamOptions videoStreamOptions;
622- videoStreamOptions.codec = codec;
623- videoStreamOptions.pixelFormat = pixel_format;
622+ videoStreamOptions.codec = std::move ( codec) ;
623+ videoStreamOptions.pixelFormat = std::move ( pixel_format) ;
624624 videoStreamOptions.crf = crf;
625625 videoStreamOptions.preset = preset;
626626
@@ -641,15 +641,15 @@ at::Tensor encode_video_to_tensor(
641641 const at::Tensor& frames,
642642 int64_t frame_rate,
643643 std::string_view format,
644- std::optional<std::string > codec = std::nullopt ,
644+ std::optional<std::string_view > codec = std::nullopt ,
645645 std::optional<std::string_view> pixel_format = std::nullopt ,
646646 std::optional<double > crf = std::nullopt ,
647647 std::optional<std::string_view> preset = std::nullopt ,
648648 std::optional<std::vector<std::string>> extra_options = std::nullopt ) {
649649 auto avioContextHolder = std::make_unique<AVIOToTensorContext>();
650650 VideoStreamOptions videoStreamOptions;
651- videoStreamOptions.codec = codec;
652- videoStreamOptions.pixelFormat = pixel_format;
651+ videoStreamOptions.codec = std::move ( codec) ;
652+ videoStreamOptions.pixelFormat = std::move ( pixel_format) ;
653653 videoStreamOptions.crf = crf;
654654 videoStreamOptions.preset = preset;
655655
@@ -672,7 +672,7 @@ void _encode_video_to_file_like(
672672 int64_t frame_rate,
673673 std::string_view format,
674674 int64_t file_like_context,
675- std::optional<std::string > codec = std::nullopt ,
675+ std::optional<std::string_view > codec = std::nullopt ,
676676 std::optional<std::string_view> pixel_format = std::nullopt ,
677677 std::optional<double > crf = std::nullopt ,
678678 std::optional<std::string_view> preset = std::nullopt ,
@@ -684,8 +684,8 @@ void _encode_video_to_file_like(
684684 std::unique_ptr<AVIOFileLikeContext> avioContextHolder (fileLikeContext);
685685
686686 VideoStreamOptions videoStreamOptions;
687- videoStreamOptions.codec = codec;
688- videoStreamOptions.pixelFormat = pixel_format;
687+ videoStreamOptions.codec = std::move ( codec) ;
688+ videoStreamOptions.pixelFormat = std::move ( pixel_format) ;
689689 videoStreamOptions.crf = crf;
690690 videoStreamOptions.preset = preset;
691691
0 commit comments