Like Tree1Likes
  • 1 Post By anduril462

Get the time of a Video Player?

This is a discussion on Get the time of a Video Player? within the C Programming forums, part of the General Programming Boards category; Hi guys, it's been a long time (some years) since I've programmed for the last time (and I've never been ...

  1. #1
    Registered User
    Join Date
    Nov 2011
    Posts
    1

    Get the time of a Video Player?

    Hi guys, it's been a long time (some years) since I've programmed for the last time (and I've never been quite good at it). But I've just come up with an idea for a program. What I want to do is get the time of a video player, I mean, get the time of a video that is being play by a video player. The goal of this all is to translate videos. This way I can write the subtitles for a video that I'm watching while the program gets the time of the video being play and prints it into the text so I don't have to. (As you can probably see, English is not my native language)

    I don't want you guys to write the code for me of course. What I need is some ideas of how can I accomplish this and maybe something to read that helps me get it done.
    I'm really sorry for not asking something specific, but as I said, I's been years since I wrote my last program and I'm kinda lost.
    Any help will be well received

    If you don't understand something because of my awful English, let me know.
    Thanks in advance.

  2. #2
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,427
    It's going to depend on which video player you want this software to work with. You'll have to pick a player, and find out if they have an API you can use to interface with it, then you have to dig through the documentation looking for functions that might help you.

  3. #3
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Start by looking up the file format for .SRT files... Most players expect a certain format in these files and you would do well to follow it.

  4. #4
    Registered User manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    Kolkata@India
    Posts
    2,498
    Why get the time from the video player?
    Take the system time from the initial position and you current text position.
    Make the srt file with the difference of those two times and your current text in the same line according to the syntax.
    Manasij Mukherjee | gcc-4.8.2 @Arch Linux
    Slow and Steady wins the race... if and only if :
    1.None of the other participants are fast and steady.
    2.The fast and unsteady suddenly falls asleep while running !



  5. #5
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,427
    Quote Originally Posted by manasij7479 View Post
    Why get the time from the video player?
    Take the system time from the initial position and you current text position.
    That doesn't account for any fast forwarding, rewinding, pausing, etc. You need to know how many minutes/seconds into the video you are, which has to be obtained from the player.
    manasij7479 likes this.

  6. #6
    Registered User manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    Kolkata@India
    Posts
    2,498
    Quote Originally Posted by anduril462 View Post
    That doesn't account for any fast forwarding, rewinding, pausing, etc
    Oh...didn't think of that.
    Manasij Mukherjee | gcc-4.8.2 @Arch Linux
    Slow and Steady wins the race... if and only if :
    1.None of the other participants are fast and steady.
    2.The fast and unsteady suddenly falls asleep while running !



  7. #7
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by anduril462 View Post
    That doesn't account for any fast forwarding, rewinding, pausing, etc. You need to know how many minutes/seconds into the video you are, which has to be obtained from the player.
    And since most players don't have external hooks for that kind of thing, it's very unlikely you are going to succeed.

    About the only way is to prepare the translation text as a one "subtitle" per line text file.

    From there you arrange your software so that when watching the movie, you press Enter when the movie starts, setting offset time to 0 and starting an elapsed time counter. Then as the movie progresses, you press space or enter each time you want a line of text displayed, recording the elapsed time. A press of a different key removes the text again recording the elapsed time from the start of the movie. And so on until you get to the end of the movie...

    You would then write this to a .srt formatted file... which can be test loaded by most video players so you can watch again and check your timing. Fast forward and rewind issues will be handled by the player, not the text file.

    The .srt file format is explained HERE

  8. #8
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,427
    Two of the biggies, Winamp and VLC, both have open APIs that can be used to determine the time:

    SDK Contents - Winamp Developer Wiki (look at the GetOutputTime function)
    VLC: LibVLC media player

  9. #9
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Even with a player that delivers time information, he's still going to have to use a very similar process to what I described to put the text into a subscripting file.

    It's the same way we used to add Karaoki lyrics to midi files...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C++ Video Game Player Program
    By zonen in forum C++ Programming
    Replies: 33
    Last Post: 10-01-2011, 06:12 PM
  2. Video player API etc.
    By g4j31a5 in forum C++ Programming
    Replies: 7
    Last Post: 09-19-2008, 11:53 AM
  3. Is it a watch? Is it an MP3 player? Is it a video player?
    By twomers in forum A Brief History of Cprogramming.com
    Replies: 10
    Last Post: 08-15-2006, 10:54 PM
  4. making a video player in C++
    By LogicError in forum Windows Programming
    Replies: 4
    Last Post: 03-31-2005, 10:39 AM
  5. linux video player
    By colmd in forum Linux Programming
    Replies: 2
    Last Post: 06-28-2004, 04:27 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21