Skip to content

Commit

Permalink
refactor: ♻️ make h265 working and force h264 method in python IRSaver
Browse files Browse the repository at this point in the history
  • Loading branch information
dubusster committed Nov 8, 2024
1 parent 5b4561c commit de56816
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/cpp/video_io/h264.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ namespace rir

fname = filename;
fps = fpsrate;
codec_name = "h264"; // codecn;// "libx264"; // codecn;
codec_name = codecn;
std::string ext = codec_name;
frame_width = width;
frame_height = height;
Expand Down Expand Up @@ -624,13 +624,7 @@ namespace rir
kvazaar = NULL;
if (codec_name == "h265")
{
kvazaar = av_codec_iterate(NULL);
while (kvazaar)
{
if (kvazaar->id == AV_CODEC_ID_HEVC && strcmp(kvazaar->name, "libkvazaar") == 0)
break;
kvazaar = av_codec_iterate((void **)kvazaar);
}
kvazaar = avcodec_find_encoder_by_name("libkvazaar");
}

if ((err = avformat_alloc_output_context2(&ofctx, oformat, NULL, tmp_name.c_str()) < 0))
Expand Down
2 changes: 2 additions & 0 deletions src/python/librir/video_io/IRMovie.py
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,8 @@ def to_h264(
with IRSaver(dst_filename, w, h, h, clevel) as s:
s.set_global_attributes(attrs)
s.set_parameter("threads", cthreads)
# Force codec to be h264
s.set_parameter("codec", "h264")
saved = 0
for i in range(start_img, start_img + count):
img = self.load_pos(i, 0)
Expand Down

0 comments on commit de56816

Please sign in to comment.