diff --git a/src/lib.rs b/src/lib.rs index 65ea177..f7e2d26 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -256,7 +256,7 @@ fn process_bsf( } loop { - let mut new_packet = Packet::empty(); + let mut new_packet = Packet::new(packet.size() + 2048); let ret = av_bsf_receive_packet(filter.ptr, packet.as_mut_ptr()); if ret < 0 { break; @@ -265,6 +265,11 @@ fn process_bsf( break; } new_packet.set_stream(packet.stream()); + new_packet.set_flags(packet.flags()); + new_packet.set_dts(packet.dts()); + new_packet.set_pts(packet.pts()); + new_packet.set_duration(packet.duration()); + // new_packet.set_position(packet.position()); new_packets.push(new_packet.clone()); } } @@ -437,6 +442,7 @@ fn handle(params: HandleParams) -> anyhow::Result<()> { } if skip_until_first_key_frame { + debug!("Skipping until the first key frame"); continue; } diff --git a/test.py b/test.py index 43e45f8..f6da8ba 100644 --- a/test.py +++ b/test.py @@ -16,13 +16,13 @@ def bytes_to_bits_binary(byte_data): # set env LOGLEVEL=info # file = "/home/ivan/Downloads/1_underground_supercut_reencode_bug_ab.mp4" # file = "/home/ivan/Downloads/1_underground_supercut.mp4" - file = "/home/ivan/Downloads/1_underground_supercut_reencode_bug.mp4" + file = "/home/ivan/Downloads/1_underground_supercut_reencode_bug_x265.mp4" # file = "/home/ivan/Downloads/1_underground_supercut_reencode_bug_aud.mp4" s = FFMpegSource(file, params=[], queue_len=10, decode=False, block_if_queue_full=True, - ffmpeg_log_level=FFmpegLogLevel.Trace) - s.log_level = FFmpegLogLevel.Trace + ffmpeg_log_level=FFmpegLogLevel.Info) + s.log_level = FFmpegLogLevel.Info # counter = 0 while True: try: @@ -40,8 +40,8 @@ def bytes_to_bits_binary(byte_data): first_hex_res = " ".join(format(x, '02x') for x in payload[:16]) last_hex_res = " ".join(format(x, '02x') for x in payload[-4:]) code = decode_exp_golomb(payload[:16]) - int_val = int(code, 2) - print("Payload bin start:", int_val, code) + # int_val = int(code, 2) + print("Payload bin start:", code) print("Payload hex start:", first_hex_res) # if len(payload) - 4 > int_val: # first_hex_res = " ".join(format(x, '02x') for x in payload[4 + int_val:20 + int_val])