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 7930069
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T20:17:55+00:00 2026-06-03T20:17:55+00:00

I noticed that with some video files the PTS timestamps returned inside the AVPacket

  • 0

I noticed that with some video files the PTS timestamps returned inside the AVPacket structure do not start at 0, but some time later. E.g. at 3.128 or something. 99% of the video files I tested has PTS timestamps starting at 0 but very few files have some strange timestamps that start at 3.128 or 1.2 or something. How am I supposed to handle these cases? Should I just record the PTS timestamp of the very first packet and then subtract this PTS from all following timestamp values to get a 0-based PTS value? Or what should I do with these non-0-based timestamps? Thanks for your help!

  • 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-06-03T20:17:57+00:00Added an answer on June 3, 2026 at 8:17 pm

    Libavcodec/avformat is just giving you the data that’s in the file. Unfortunately (or perhaps fortunately, depending on your perspective), many file formats do not require timestamps to start at 0. In fact it can be important to have them start at other values if several files each make up part of a longer stream and you want to be able to non-destructively put them back together.

    If you want 0-based timestamps, then like you said, you’ll need to save the lowest/first timestamp and subtract that value from all timestamps. Note however that for some really ugly formats (like DVD video) it’s common for timestamps to reset in the middle of the content, and this could even result in getting negative timestamps with your approach. If you expect you might be dealing with such content, you’ll need to detect discontinuities and patch them up. Last I worked with avcodec/avformat, they didn’t have a feature to do this for you automatically, but they might now. I’d look into it if you think you might need that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've noticed that some mobile phones are not able to play some video files.
I have noticed that some values in settings.bundle (Root.plist) do not allow you to
I noticed that some enumerations have None as a enumeration member. For example what
I noticed that some stylesheets have something like this: body { font-size: 62.5%/1.2em; }
While reading cocoa tutorials i've noticed that some of the tutorials use AppDelegate and
I have 100 web servers and noticed that some of them have request filtering
Reading the Eigen library documentation, I noticed that some objects cannot be passed by
I've noticed that on some websites (including SO) the link to the CSS will
I've playing around with linux and noticed that for some mysterious reason commands like
In my WPF application using MVVM I noticed that in some cases the CanExecute

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.