summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMole Shang <[email protected]>2023-08-10 12:56:04 +0800
committerMole Shang <[email protected]>2023-08-10 12:56:04 +0800
commit08431c7635699da2c5129929d7dd3f6b71b431bf (patch)
treeb1fc55b1bb118b887a92eee5c34c3e7bf70717b3
parent06feb4557af89dfa8e695a5e89f77d38e6342fb4 (diff)
downloadhinata-08431c7635699da2c5129929d7dd3f6b71b431bf.tar.gz
hinata-08431c7635699da2c5129929d7dd3f6b71b431bf.tar.bz2
hinata-08431c7635699da2c5129929d7dd3f6b71b431bf.zip
utils/ffmpeg: fix regression and temporarily disable debug log
-rw-r--r--src/utils/ffmpeg.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/utils/ffmpeg.c b/src/utils/ffmpeg.c
index 694400c..98d2ba1 100644
--- a/src/utils/ffmpeg.c
+++ b/src/utils/ffmpeg.c
@@ -152,7 +152,7 @@ int merge_av(const char *videofn, const char *audiofn, const char *outfn) {
ret = av_read_frame(input1_format_context, &packet);
if (ret < 0)
break;
- in_stream = input1_format_context->streams[stream_index];
+ in_stream = input1_format_context->streams[packet.stream_index];
if (packet.stream_index >= number_of_streams ||
streams_list[packet.stream_index] < 0) {
av_packet_unref(&packet);
@@ -161,7 +161,7 @@ int merge_av(const char *videofn, const char *audiofn, const char *outfn) {
packet.stream_index = streams_list[packet.stream_index];
out_stream = output_format_context->streams[packet.stream_index];
/* copy packet */
- log_packet(input1_format_context, &packet, "in");
+ // log_packet(input1_format_context, &packet, "in");
packet.pts = av_rescale_q_rnd(packet.pts, in_stream->time_base,
out_stream->time_base,
AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX);
@@ -171,7 +171,7 @@ int merge_av(const char *videofn, const char *audiofn, const char *outfn) {
packet.duration = av_rescale_q(packet.duration, in_stream->time_base,
out_stream->time_base);
packet.pos = -1;
- log_packet(output_format_context, &packet, "out");
+ // log_packet(output_format_context, &packet, "out");
ret = av_interleaved_write_frame(output_format_context, &packet);
if (ret < 0) {
@@ -269,6 +269,9 @@ int remux(const char *in_filename, const char *out_filename) {
goto end;
}
+ DEBUG_PRINT("duration: %.2Lf\n",
+ (long double)ifmt_ctx->duration / AV_TIME_BASE);
+
av_dump_format(ifmt_ctx, 0, in_filename, 0);
avformat_alloc_output_context2(&ofmt_ctx, NULL, NULL, out_filename);
@@ -347,12 +350,12 @@ int remux(const char *in_filename, const char *out_filename) {
pkt->stream_index = stream_mapping[pkt->stream_index];
out_stream = ofmt_ctx->streams[pkt->stream_index];
- log_packet(ifmt_ctx, pkt, "in");
+ // log_packet(ifmt_ctx, pkt, "in");
/* copy packet */
av_packet_rescale_ts(pkt, in_stream->time_base, out_stream->time_base);
pkt->pos = -1;
- log_packet(ofmt_ctx, pkt, "out");
+ // log_packet(ofmt_ctx, pkt, "out");
ret = av_interleaved_write_frame(ofmt_ctx, pkt);
/* pkt is now blank (av_interleaved_write_frame() takes ownership of