Analogous to the (a)showinfo lavfi filters, logs basic packet information. Mainly useful for debugging/testing/development.
Unified · Split
| @@ -23,6 +23,7 @@ version <next>: · 22 unmodified lines | |||
| 23 | - ffmpeg CLI -bsf option may now be used for input as well as output | 23 | - ffmpeg CLI -bsf option may now be used for input as well as output |
| 24 | - ffmpeg CLI options may now be used as -/opt <path>, which is equivalent | 24 | - ffmpeg CLI options may now be used as -/opt <path>, which is equivalent |
| 25 | to -opt <contents of file <path>> | 25 | to -opt <contents of file <path>> |
| 26 | - showinfo bitstream filter | ||
| 26 | 27 | ||
| 27 | version 6.1: | 28 | version 6.1: |
| 28 | - libaribcaption decoder | 29 | - libaribcaption decoder |
| @@ -887,6 +887,10 @@ For example, to set PTS equal to DTS (not recommended if B-frames are involved): · 886 unmodified lines | |||
| 887 | ffmpeg -i INPUT -c:a copy -bsf:a setts=pts=DTS out.mkv | 887 | ffmpeg -i INPUT -c:a copy -bsf:a setts=pts=DTS out.mkv |
| 888 | @end example | 888 | @end example |
| 889 | 889 | ||
| 890 | @section showinfo | ||
| 891 | Log basic packet information. Mainly useful for testing, debugging, | ||
| 892 | and development. | ||
| 893 | |||
| 890 | @anchor{text2movsub} | 894 | @anchor{text2movsub} |
| 891 | @section text2movsub | 895 | @section text2movsub |
| 892 | 896 | ||
| @@ -58,6 +58,7 @@ extern const FFBitStreamFilter ff_pgs_frame_merge_bsf; · 57 unmodified lines | |||
| 58 | extern const FFBitStreamFilter ff_prores_metadata_bsf; | 58 | extern const FFBitStreamFilter ff_prores_metadata_bsf; |
| 59 | extern const FFBitStreamFilter ff_remove_extradata_bsf; | 59 | extern const FFBitStreamFilter ff_remove_extradata_bsf; |
| 60 | extern const FFBitStreamFilter ff_setts_bsf; | 60 | extern const FFBitStreamFilter ff_setts_bsf; |
| 61 | extern const FFBitStreamFilter ff_showinfo_bsf; | ||
| 61 | extern const FFBitStreamFilter ff_text2movsub_bsf; | 62 | extern const FFBitStreamFilter ff_text2movsub_bsf; |
| 62 | extern const FFBitStreamFilter ff_trace_headers_bsf; | 63 | extern const FFBitStreamFilter ff_trace_headers_bsf; |
| 63 | extern const FFBitStreamFilter ff_truehd_core_bsf; | 64 | extern const FFBitStreamFilter ff_truehd_core_bsf; |
| @@ -36,6 +36,7 @@ OBJS-$(CONFIG_PGS_FRAME_MERGE_BSF) += bsf/pgs_frame_merge.o · 35 unmodified lines | |||
| 36 | OBJS-$(CONFIG_PRORES_METADATA_BSF) += bsf/prores_metadata.o | 36 | OBJS-$(CONFIG_PRORES_METADATA_BSF) += bsf/prores_metadata.o |
| 37 | OBJS-$(CONFIG_REMOVE_EXTRADATA_BSF) += bsf/remove_extradata.o | 37 | OBJS-$(CONFIG_REMOVE_EXTRADATA_BSF) += bsf/remove_extradata.o |
| 38 | OBJS-$(CONFIG_SETTS_BSF) += bsf/setts.o | 38 | OBJS-$(CONFIG_SETTS_BSF) += bsf/setts.o |
| 39 | OBJS-$(CONFIG_SHOWINFO_BSF) += bsf/showinfo.o | ||
| 39 | OBJS-$(CONFIG_TEXT2MOVSUB_BSF) += bsf/movsub.o | 40 | OBJS-$(CONFIG_TEXT2MOVSUB_BSF) += bsf/movsub.o |
| 40 | OBJS-$(CONFIG_TRACE_HEADERS_BSF) += bsf/trace_headers.o | 41 | OBJS-$(CONFIG_TRACE_HEADERS_BSF) += bsf/trace_headers.o |
| 41 | OBJS-$(CONFIG_TRUEHD_CORE_BSF) += bsf/truehd_core.o | 42 | OBJS-$(CONFIG_TRUEHD_CORE_BSF) += bsf/truehd_core.o |
| @@ -0,0 +1,63 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2024 Anton Khirnov <anton@khirnov.net> | ||
| 3 | * | ||
| 4 | * This file is part of FFmpeg. | ||
| 5 | * | ||
| 6 | * FFmpeg is free software; you can redistribute it and/or | ||
| 7 | * modify it under the terms of the GNU Lesser General Public | ||
| 8 | * License as published by the Free Software Foundation; either | ||
| 9 | * version 2.1 of the License, or (at your option) any later version. | ||
| 10 | * | ||
| 11 | * FFmpeg is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 14 | * Lesser General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU Lesser General Public | ||
| 17 | * License along with FFmpeg; if not, write to the Free Software | ||
| 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 19 | */ | ||
| 20 | |||
| 21 | #include <inttypes.h> | ||
| 22 | |||
| 23 | #include "bsf.h" | ||
| 24 | #include "bsf_internal.h" | ||
| 25 | |||
| 26 | #include "libavutil/log.h" | ||
| 27 | #include "libavutil/timestamp.h" | ||
| 28 | |||
| 29 | typedef struct ShowinfoContext { | ||
| 30 | uint64_t nb_packets; | ||
| 31 | } ShowinfoContext; | ||
| 32 | |||
| 33 | static int showinfo_filter(AVBSFContext *ctx, AVPacket *pkt) | ||
| 34 | { | ||
| 35 | ShowinfoContext *priv = ctx->priv_data; | ||
| 36 | int ret; | ||
| 37 | |||
| 38 | ret = ff_bsf_get_packet_ref(ctx, pkt); | ||
| 39 | if (ret < 0) | ||
| 40 | return ret; | ||
| 41 | |||
| 42 | av_log(ctx, AV_LOG_INFO, | ||
| 43 | "n:%7"PRIu64" " | ||
| 44 | "size:%7d " | ||
| 45 | "pts:%s pt:%s " | ||
| 46 | "dts:%s dt:%s " | ||
| 47 | "ds:%"PRId64" d:%s " | ||
| 48 | "\n", | ||
| 49 | priv->nb_packets, pkt->size, | ||
| 50 | av_ts2str(pkt->pts), av_ts2timestr(pkt->pts, &ctx->time_base_in), | ||
| 51 | av_ts2str(pkt->dts), av_ts2timestr(pkt->dts, &ctx->time_base_in), | ||
| 52 | pkt->duration, av_ts2timestr(pkt->duration, &ctx->time_base_in)); | ||
| 53 | |||
| 54 | priv->nb_packets++; | ||
| 55 | |||
| 56 | return 0; | ||
| 57 | } | ||
| 58 | |||
| 59 | const FFBitStreamFilter ff_showinfo_bsf = { | ||
| 60 | .p.name = "showinfo", | ||
| 61 | .filter = showinfo_filter, | ||
| 62 | .priv_data_size = sizeof(ShowinfoContext), | ||
| 63 | }; | ||