Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > VCL

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 02-12-2017, 02:30 AM
Dman Dman is offline
Junior Member
 
Join Date: Jul 2010
Posts: 27
Smile Get the duration of an MP4 video file

I have an mp4 video file at c:\mymovie.mp4

I just want to get its VIDEO DURATION.

e.g. I just want my app to say: "This movie is 47 Minutes long!"

Thanks!
Reply With Quote
  #2  
Old 02-15-2017, 02:19 AM
lexd lexd is offline
Senior Member
 
Join Date: Feb 2015
Posts: 255
Default

http://www.file-recovery.com/mp4-signature-format.htm

The page has links to give you more details
I would load it up into a file stream move the position in the file
And copy data into a integer etc and use it.

Headers are easy to use so dive in.
Reply With Quote
  #3  
Old 02-16-2017, 05:22 AM
Dman Dman is offline
Junior Member
 
Join Date: Jul 2010
Posts: 27
Default

http://www.swissdelphicenter.com/en/...de.php?id=1746

This code seems to have what i want.

But when i run it I get:

"Cannot determine the device type from the given filename extension."

It appears that my old Delphi VCL app MediaPlayer1 component can't open this file.

Ideas?
Reply With Quote
  #4  
Old 02-16-2017, 06:13 AM
lexd lexd is offline
Senior Member
 
Join Date: Feb 2015
Posts: 255
Default

Media Player needs details about the file its about to play
speed
data structure
stereo or mono
Size/length
Bit size

as I said you must read the header data at the start of the file
and give this info to to the Media Player
Then Media Player needs to know how to use the data in the file out of the header.
.MP3 has different header structure to .ORG

example
http://mpgedit.org/mpgedit/mpeg_format/MP3Format.html
Reply With Quote
  #5  
Old 02-16-2017, 06:31 AM
Dman Dman is offline
Junior Member
 
Join Date: Jul 2010
Posts: 27
Default

oh

that link is way beyond my intelligence level

i'm just an amateur

: (

but i'd paypal someone to do it, if there is a section like that on this forum...?
Reply With Quote
  #6  
Old 02-16-2017, 09:07 AM
lexd lexd is offline
Senior Member
 
Join Date: Feb 2015
Posts: 255
Default

you are not going to be good to any one paying people
you have no plan, final goal, and know how if its possible for your project
you need to learn some know how final
Get reading
If you build something on the cheap, you got to scavenge for parts
computers you scavenge for the bits that complete the project

Google "sound header formats" and you get this
https://en.wikipedia.org/wiki/Audio_file_format
http://sox.sourceforge.net/AudioFormats-11.html
http://www.paulbourke.net/dataformats/audio/
Torrypages is helpful
embarcadero is also a good place to search for tips

Then you got to study how to use Delphi tools like file streams to access the data. Piece by piece and only with using your brain and persistence you will be able to manage sound.

but you never learn paying people especially when you end up not using it.
Reply With Quote
  #7  
Old 02-16-2017, 09:09 AM
Dman Dman is offline
Junior Member
 
Join Date: Jul 2010
Posts: 27
Default

My goal is to read c:\mymovie.mp4 and showmessage() of the video duration
Reply With Quote
  #8  
Old 02-16-2017, 06:53 PM
lexd lexd is offline
Senior Member
 
Join Date: Feb 2015
Posts: 255
Default

I've given you the know how apply it
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:09 AM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2017, vBulletin Solutions, Inc.