From: Gyan Doshi <ffmpeg@gyani.pro> To: ffmpeg-devel@ffmpeg.org Subject: Re: [FFmpeg-devel] [PATCH 2/2] ffprobe: show seekability details in format section Date: Mon, 14 Apr 2025 10:09:35 +0530 Message-ID: <ebac78d5-578b-4ff4-ba3f-797f952adfa1@gyani.pro> (raw) In-Reply-To: <DM8P223MB0365B8C3EDA17E5CAC6414D3BAB02@DM8P223MB0365.NAMP223.PROD.OUTLOOK.COM> On 2025-04-13 09:48 pm, softworkz . wrote: > >> -----Original Message----- >> From: ffmpeg-devel<ffmpeg-devel-bounces@ffmpeg.org> On Behalf Of Gyan >> Doshi >> Sent: Sonntag, 13. April 2025 13:16 >> To:ffmpeg-devel@ffmpeg.org >> Subject: [FFmpeg-devel] [PATCH 2/2] ffprobe: show seekability details in >> format section >> >> --- >> fftools/ffprobe.c | 49 +++++++++++++++++++++++++++- >> tests/ref/fate/cavs-demux | 2 +- >> tests/ref/fate/ffprobe_compact | 2 +- >> tests/ref/fate/ffprobe_csv | 2 +- >> tests/ref/fate/ffprobe_default | 1 + >> tests/ref/fate/ffprobe_flat | 1 + >> tests/ref/fate/ffprobe_ini | 1 + >> tests/ref/fate/ffprobe_json | 1 + >> tests/ref/fate/ffprobe_xml | 2 +- >> tests/ref/fate/ffprobe_xsd | 2 +- >> tests/ref/fate/flv-demux | 2 +- >> tests/ref/fate/gapless-mp3-side-data | 2 +- >> tests/ref/fate/oggopus-demux | 2 +- >> tests/ref/fate/ts-demux | 2 +- >> tests/ref/fate/ts-opus-demux | 2 +- >> tests/ref/fate/ts-small-demux | 2 +- >> tests/ref/fate/ts-timed-id3-demux | 2 +- >> 17 files changed, 64 insertions(+), 13 deletions(-) >> >> diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c >> index e0a7322523..8b09afb8c1 100644 >> --- a/fftools/ffprobe.c >> +++ b/fftools/ffprobe.c >> @@ -2260,7 +2260,7 @@ static int show_format(AVTextFormatContext *tfc, >> InputFile *ifile) >> { >> AVFormatContext *fmt_ctx = ifile->fmt_ctx; >> int64_t size = fmt_ctx->pb ? avio_size(fmt_ctx->pb) : -1; >> - int ret = 0; >> + int seekable, ret = 0; >> >> avtext_print_section_header(tfc, NULL, SECTION_ID_FORMAT); >> print_str_validate("filename", fmt_ctx->url); >> @@ -2279,6 +2279,53 @@ static int show_format(AVTextFormatContext *tfc, >> InputFile *ifile) >> if (fmt_ctx->bit_rate > 0) print_val ("bit_rate", fmt_ctx- >>> bit_rate, unit_bit_per_second_str); >> else print_str_opt("bit_rate", "N/A"); >> print_int("probe_score", fmt_ctx->probe_score); >> + >> + seekable = avformat_query_seekable(fmt_ctx); >> + if (seekable > 0) { >> + int gen = 1, ante = 0; >> + AVBPrint seek_str; >> + av_bprint_init(&seek_str, 0, AV_BPRINT_SIZE_AUTOMATIC); >> + >> + av_bprintf(&seek_str, "yes, by"); >> + if (seekable & AVSEEKABLE_TIME) { >> + av_bprintf(&seek_str, " time"); >> + if (seekable & AVSEEKABLE_PTS) >> + av_bprintf(&seek_str, "(pts)"); >> + else >> + av_bprintf(&seek_str, "(dts)"); >> + ante = 1; >> + } >> + if (seekable & AVSEEKABLE_BYTE) { >> + av_bprintf(&seek_str, "%cbyte-offset", ante ? ',':' '); >> + ante = 1; >> + } >> + if (seekable & AVSEEKABLE_FRAME) { >> + av_bprintf(&seek_str, "%cframe-index", ante ? ',':' '); >> + } >> + >> + ante = 0; >> + av_bprintf(&seek_str, " via"); >> + if (seekable & AVSEEKABLE_DEMUXER) { >> + av_bprintf(&seek_str, " demuxer"); >> + gen = 0; >> + ante = 1; >> + } >> + if (seekable & AVSEEKABLE_PKTSCAN) { >> + av_bprintf(&seek_str, "%cpacket-scan", ante ? ',':' '); >> + gen = 0; >> + ante = 0; >> + } >> + if (gen) >> + av_bprintf(&seek_str, " generic seek"); >> + >> + if (seekable & AVSEEKABLE_FWDONLY) >> + av_bprintf(&seek_str, " (forward only)"); >> + >> + print_str("seekable", seek_str.str); >> + } >> + else >> + print_str("seekable", "no"); >> + >> if (do_show_format_tags) >> ret = show_tags(tfc, fmt_ctx->metadata, >> SECTION_ID_FORMAT_TAGS); > > Hi Gyan, > > the problem that I see here is that it's not machine-readable and would require non-trivial parsing to translate back to the actual information behind it. > I think that either a separate sub-section or at least three separate values would be better. I can add a delimiter like | e.g. yes|time(pts),frame-index|demuxer,packet-scan|fast All of the phrases for an attribute are unique, and for that, they just need to grep, not parse the string. Most CLI users will only care about two things: yes/no and forward-only. > Another note: When you skim through the ffprobe code, you can see that ffprobe rarely does its own "numbers-to-string" translations (only for cases of absence, like 'none', 'unknown', etc.). Normally, those translations are included in the libs where they are defined. The information is stored as bitflags in an int. How would the lib do it? > Oh, and I believe you also need to add new output fields to the xml schema file (ffprobe.xsd). Will do. Regards, Gyan > > Still like it! 😊 > > Thanks, > sw > > > > > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2025-04-14 4:39 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top 2025-04-13 11:15 [FFmpeg-devel] [PATCH 1/2] avformat: add avformat_query_seekable Gyan Doshi 2025-04-13 11:15 ` [FFmpeg-devel] [PATCH 2/2] ffprobe: show seekability details in format section Gyan Doshi 2025-04-13 16:18 ` softworkz . 2025-04-14 4:39 ` Gyan Doshi [this message] 2025-04-14 4:52 ` softworkz . 2025-04-14 4:57 ` softworkz . 2025-04-14 6:53 ` Gyan Doshi 2025-04-14 7:27 ` softworkz . 2025-04-14 10:36 ` Gyan Doshi 2025-04-14 8:34 ` Nicolas George 2025-04-13 16:09 ` [FFmpeg-devel] [PATCH 1/2] avformat: add avformat_query_seekable softworkz . 2025-04-14 4:23 ` Gyan Doshi 2025-04-14 4:40 ` softworkz . 2025-04-13 16:42 ` Zhao Zhili 2025-04-14 4:10 ` Gyan Doshi
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=ebac78d5-578b-4ff4-ba3f-797f952adfa1@gyani.pro \ --to=ffmpeg@gyani.pro \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git