Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3990532
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T06:30:24+00:00 2026-05-20T06:30:24+00:00

I try and try again with Regex, I just don’t get it . I’m

  • 0

I try and try again with Regex, I just don’t get it. I’m trying to traverse a log file for FFMPEG and get the FPS.

Basically, on a variable line (seems to be around 16/17) of the log file this line appears:-

Stream #0.1[0x1e0]: Video: mpeg1video, yuv420p, 640x480 [PAR 1:1 DAR 4:3], 104857 kb/s, 25 fps, 25 tbr, 90k tbn, 25 tbc

I’d like to traverse line by line, which I think I can do exploding by /n and then for loop through, but I’d prefer to just get the line that line, and then get the FPS value.

Any pointers gratefully received.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T06:30:25+00:00Added an answer on May 20, 2026 at 6:30 am

    You could try this:

    if (preg_match('/^Stream #0.*?(\b\d+(?:\.\d+)?\s*fps\b).*/m', $subject, $regs)) {
        $full_line = $regs[0];
        $result = $regs[1];
    } else {
        // no match...
    }
    

    Explanation:

    ^     # start of line (/m modifier makes sure that this works)
    Stream #0  # match Stream #0 literally
    .*?   # match any number of characters, as few as possible
    (     # then capture the following
     \b   # starting at a "word" boundary
     \d+  # one or more digits
     (?:  # try to match the following:
      \.  # a dot
      \d+ # followed by one or more digits
     )?   # but make that optional
     \s*  # optional whitespace
     fps  # literal fps
     \b   # end at a word boundary
    )     # end of capturing group
    .*    # match the rest of the line
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i use below code - Just try again. - to prevent deadlock. it seems
Try loading this normal .jpg file in Internet Explorer 6.0. I get an error
Try as I might, I can't get a JNLP file to run locally (via
Trying to get the correct regex for this - only letters, spaces, hypens, and
I hope I can explain this well, if I don't I'll try again. I
Try as I might I cannot get my head around what the IteratorIterator class
I guess my description is not clear enough. So I'll try again: Imagine there
I am trying to build a program that uses libusb and I get a
I want to execute the code in the try block again after an exception
ill try again :/ im setting up a blog page, i want it to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.