[FFmpeg-devel] [PATCH] Fixed incorrect timestamps and initialization issues in transcoding.c example.
Brian C. Wiles
brian at streamcomm.com
Wed Jul 25 01:18:17 EEST 2018
---
doc/examples/transcoding.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/doc/examples/transcoding.c b/doc/examples/transcoding.c
index a83fa3a185..bf653f7c50 100644
--- a/doc/examples/transcoding.c
+++ b/doc/examples/transcoding.c
@@ -2,6 +2,7 @@
* Copyright (c) 2010 Nicolas George
* Copyright (c) 2011 Stefano Sabatini
* Copyright (c) 2014 Andrey Utkin
+ * Copyright (c) 2018 Brian C. Wiles.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -517,6 +518,11 @@ int main(int argc, char **argv)
return 1;
}
+ av_register_all();
+ avcodec_register_all();
+ avfilter_register_all();
+ avformat_network_init();
+
if ((ret = open_input_file(argv[1])) < 0)
goto end;
if ((ret = open_output_file(argv[2])) < 0)
@@ -554,7 +560,9 @@ int main(int argc, char **argv)
}
if (got_frame) {
- frame->pts = frame->best_effort_timestamp;
+ frame->pts = av_rescale_q(frame->best_effort_timestamp,
+ stream_ctx[stream_index].dec_ctx->time_base,
+ stream_ctx[stream_index].enc_ctx->time_base);
ret = filter_encode_write_frame(frame, stream_index);
av_frame_free(&frame);
if (ret < 0)
--
2.17.1
More information about the ffmpeg-devel
mailing list