Recent

Author Topic: Component for retrieving data from video files?  (Read 44072 times)

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1260
Re: Component for retrieving data from video files?
« Reply #15 on: October 10, 2014, 06:02:44 pm »
I have a vision you see (one of many) :-)  One unified playback control where either the developer or enduser can decide the playback mechanism.

I try to implement something similar by improving http://wiki.lazarus.freepascal.org/ACS   It use plugable 'drivers' for audio record or playback.

Small clarification, while I know that FFmpeg (and mplayer/VLC/DirectShow/whatever) can all handle audio, my primary concern is video.  There is already in place a large collection of audio libraries for Lazarus or fpc - some of which already already handle switchable playback engines.  Whereas in the video playback world, what we've got is a collection of isolated libraries, what I want is mechanism to provide choice...

But with ffmpeg is not enough to just make bindings to library functions, there huge amount of necessary routines inside ffpmeg command-line tool, that not implemented (or documented) as library functions.

Understood :-)   This goes back to my conversation with @metis.  FFmpeg will be a huge job.  VLC/mplayer represent ready made mechanisms that work and can be used right now.   My priority would be to get the framework in place for switching VLC/VLC/mplayer/Directshow (not a typo on the double VLC) as video playback engine - then work on a direct FFMpeg implementation.  Doing in that order as I'm not kidding myself it'll be easy :-)
Lazarus Trunk/FPC Trunk on Windows [7, 10]
  Have you tried searching this forum or the wiki?:   http://wiki.lazarus.freepascal.org/Alternative_Main_Page
  BOOKS! (Free and otherwise): http://wiki.lazarus.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines

metis

  • Sr. Member
  • ****
  • Posts: 300
Re: Component for retrieving data from video files?
« Reply #16 on: October 15, 2014, 04:28:24 pm »
@All: Sorry for always answering so delayed, but I got no Internet at Home.


@Fred vS

Quote
what audio-format are you missing ?
When we had our Chat about Your 'UOS', it was specially WMA; meanwhile ACC and m4a have joined that List.
There are PascalSolutions for WMA only, but I'm looking for an UNIVERSAL AudioDecoder, to feed PortAudio
with ANY AudioFormat - Would be interesting for Your UOS as well, wouldn't it ?


@serbod
Quote
But with ffmpeg is not enough to just make bindings to library functions...
I know - Have a Look at UltraStar Deluxe - they did a lot of this work.
BTW, they also started with PortAudio, but as far as I understood the Code, they couldn't make it run - at least not in the FINAL Version from Oct.2010:
http://ultrastardx.sourceforge.net/usdx-downloads/usdx/
'UOS' does Portaudio !


@Mike.Cornflake

Quote
Obviously you're talking about accessing the FFmpeg library directly, not through the binaries
Of course, otherwise I would use them.

Quote
I have the code for those dead links
Gimme dat Ding - Please, please, please...

BTW, I'm also looking for the last Version of the "New Audio Components" (= NewAC 2.6.1).
All DownloadSites, I found, finally lead to the same WebSite in Russian:
http://www.vr-!/content/new-audio-components-1799
Apart from not knowing any Russian, I can't find anything like "NewAC" on that Site.
-> Does anyone know, where to get 'NewAC 2.6.1' from ?

Quote
as the creator has deleted the code
Well, I'm not a lawyer, but until the moment it was published it was and is(!) public.
Means, afaik(!): Only changes, developments, improvements, etc., that were done AFTER
closing the Code may turn to proprietary.

Quote
I'm optimistic that they're actually examples ported from the original FFmpeg project.
Should be - Otherwise, they should have named them "FFVCL-Headers".

Quote
VLC/mplayer represent ready made mechanisms that work and can be used right now.
All true, as long as we talk about only Reproducing or Transcoding Audio/Video-Streams.
MPlayer/MEncoder are Console -> In-/Output is very, very delayed, and Output is only String => useless for me.

Quote
... - then work on a direct FFMpeg implementation
I'll (try to) come from the other side - Let's see, where we'll meet.

Last Weekend, I started investigating the VideoPart from UltraStar Deluxe.
Up to now I got working (and ported from Delphi-Mode to FPC-Mode):
Open a VideoStream -> Get the StreamInfos -> Decode the Stream -> Read the Frames, and...
...then I watch my LogWindow, how these Frames are being processed (obviously) without Errors, but:

How to make an Image out of this ? OpenGL ? SDL ?
Would be nice to make it with 'LazOpenGLContext', to keep it "Lazarus only".

Any ideas ?
Life could be so easy, if there weren't those f*** Details.
My FFmpeg4Lazarus = FFPlay4Laz + FFGrab4Laz + FFInfo4Laz

Fred vS

  • Hero Member
  • *****
  • Posts: 3158
    • StrumPract is the musicians best friend
Re: Component for retrieving data from video files?
« Reply #17 on: October 15, 2014, 04:39:44 pm »
@ metis
Quote
Would be interesting for Your UOS as well, wouldn't it ?

OF COURSE  ;)

And you are highly welcome in uos-band, your commits will be extremely appreciated.  ;)

PS: I forgot to thank you about your tip => Athread.TTreaPriority := tpTimeCritical; => it allows uos to be multi-inputs  :-X

Fred.
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

metis

  • Sr. Member
  • ****
  • Posts: 300
Re: Component for retrieving data from video files?
« Reply #18 on: October 15, 2014, 05:37:04 pm »
@Fred vS

The FFmpeg-AUDIOPart of UltraStar Deluxe comes next.
First I'd like to terminate something like a simple FFmpeg-VideoPlayer to have the basic FFmpeg-Routines.
As mentioned above, it seems to work, but the GraphicOutput is still totally missing.

Graphics I do not know so well, because up to now I was mainly interested in pure realtime AUDIO-Sound
-> Portaudio !!!  :)
Life could be so easy, if there weren't those f*** Details.
My FFmpeg4Lazarus = FFPlay4Laz + FFGrab4Laz + FFInfo4Laz

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1260
Re: Component for retrieving data from video files?
« Reply #19 on: October 15, 2014, 06:59:46 pm »
Quote
I have the code for those dead links
Gimme dat Ding - Please, please, please...

:-)

Sounds like you've already found Ultrastar code, but here it is again
https://dl.dropboxusercontent.com/u/59503182/Lazarus/ultrastardx-1.1-full.zip

Scandroid
https://dl.dropboxusercontent.com/u/59503182/Lazarus/scandraid-code.7z

You had no internet, I'm back in Australia - land of SLOW internet.  Wait until around 30 minutes after the date of this post before downloading.  Well, that's how long dropbox is currently telling me uploading 80Mb will take...

Quote
VLC/mplayer represent ready made mechanisms that work and can be used right now.
All true, as long as we talk about only Reproducing or Transcoding Audio/Video-Streams.
MPlayer/MEncoder are Console -> In-/Output is very, very delayed, and Output is only String => useless for me.

Umm.  You sure about the very delayed bit?  I found an initial delay, but once loaded, everything was responsive.

As for the string output.  Check out TMPlayerControl
http://wiki.freepascal.org/TMPlayerControl

All of the work I did on that package was decoding the string output and presenting the data in records or through events.  I was only focused on playback, not encoding...

Quote
... - then work on a direct FFMpeg implementation
I'll (try to) come from the other side - Let's see, where we'll meet.

Well, if you've started, you're going to get there a LOT faster than I :-)

Last Weekend, I started investigating the VideoPart from UltraStar Deluxe.
Up to now I got working (and ported from Delphi-Mode to FPC-Mode):
Open a VideoStream -> Get the StreamInfos -> Decode the Stream -> Read the Frames, and...
...then I watch my LogWindow, how these Frames are being processed (obviously) without Errors, but:

How to make an Image out of this ? OpenGL ? SDL ?
Would be nice to make it with 'LazOpenGLContext', to keep it "Lazarus only".

Nice work :-) 

I forgot all that code was tightly bound to SDL.  Same with the ffPlay code when I went through that..  No ideas or recommendations I'm afraid.

Have fun, glad you're working on the project :-)

Lazarus Trunk/FPC Trunk on Windows [7, 10]
  Have you tried searching this forum or the wiki?:   http://wiki.lazarus.freepascal.org/Alternative_Main_Page
  BOOKS! (Free and otherwise): http://wiki.lazarus.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines

metis

  • Sr. Member
  • ****
  • Posts: 300
Re: Component for retrieving data from video files?
« Reply #20 on: October 18, 2014, 02:27:18 pm »
@Fred vS
Quote
you are highly welcome in uos-band, your commits will be extremely appreciated.
Thank You - I was always interested in going on with 'UOS'.
See my Posts in "United OpenLib of Sound (UOS)"
http://forum.lazarus.freepascal.org/index.php/topic,17599.0.html,
and my Thread "Some more UOS"
http://forum.lazarus.freepascal.org/index.php/topic,25020.0.html


@Mike.Cornflake

Quote
Sounds like you've already found Ultrastar code, but here it is again
That's exactly, what You get when downloading the "(Archive - zip)" from the UltraStar Deluxe Website, but this ZIP does NOT contain any SourceCode. ;D

For the SourceCode, download "Source Code (All Platforms)".
You'll find working(!) LazarusProjects (only in DelphiMode, but this is o.k.), in:
"ultrastardx-1.1-src\src\dists\lazarus\", and the "readme.txt" tells You, how to use them.
For FFmpeg-Stuff (and others, like Portaudio), see the Units in: "...\src\src\media".


Quote
Scandroid
That's definitivly SourceCode - Thanks, a lot !
You made me busy (and happy) all over the Winter. :D


Quote
Australia - land of SLOW internet
Come to Canary Islands, and You'll be happy with Your Internet-Connection. :P
BTW: "I got no Internet at Home", meant: I DO not have any Internet at Home.
-> My Answers may last some Days (MPlayer is indeed responding quicker).


Quote
Umm. You sure about the very delayed bit? I found an initial delay...
That's the Point, but this Delay is not only "initial", it's intrinsic (Pipes, not DLL).

To check Stuff like that, I write Test-Apps, before starting "something big".
(Hi Fred, I did the same with Your 'UOS'.) ;)

My Test-App for the MPlayer doesn't use any Packages or Components.
At that Time I derived it from the Delphi-VCL 'TMPlayer', porting it to FPC-Mode.

Apart from the Player itself with Load/Play/Pause-UnPause, Seek/SeekOnClick/SeekOnDrag, and some other
MPlayer-Stuff, like Setting A/V-Delay, Speed, etc. (here I stop, before You get bored),
it has a Form, I called 'MPlayer-Input/Output-Analyzer'.
There You can play around with the MPlayer, like:
- Send any Command with or without the Pausing/PausingKeep/PausingToggle-Prefixes
- Get-Set/Step any Property
(It's all easy, because it's all String-Input)
This Form then shows the Result of the entered String/StringCombination (-> works or ErrorString), and
the TIME, that has passed between PropertyRequest and PropertyResponse: Awful! - Yawn.

And I have another basic Problem with the MPlayer:
How to KEEP a paused Video really PAUSED, means:
Any 'SendCommand' lets a PAUSED Video PLAY again, even if using a Pausing/PausingKeep/PausingToggle-Prefix.
See my Thread: "How to keep the MPlayer really paused ?"
http://forum.lazarus.freepascal.org/index.php/topic,17327.msg95335.html#msg95335
-> Obviously up to today there is no Solution for this.

After that, I left the MPlayer, and wrote a Test-App for VLC, derived from 'PasLibVlc'.
-> I got two MainProblems with VLC:
- Can't use ASIO for AudioOutput (same Problem with MPlayer)
- Can't open a Stream at "00:00.000" PAUSED directly, means without working around with the TimeChanged-Event.


Quote
was decoding the string output and presenting the data in records or through events
O.k., but whatever you do, the Origin of the Output is still STRING.
E.g. to decode an AudioStream for Portaudio, this is too slow - I need the In-/Outputs as DIRECT as possible.

=> The only 2 Things I like on the MPlayer are: Easy to use and better Sound than VLC. :)
Life could be so easy, if there weren't those f*** Details.
My FFmpeg4Lazarus = FFPlay4Laz + FFGrab4Laz + FFInfo4Laz

metis

  • Sr. Member
  • ****
  • Posts: 300
Re: Component for retrieving data from video files?
« Reply #21 on: November 21, 2014, 04:11:23 pm »
After having parsed grape3D/ScanDraiD- and Ultrastar-Code:

The Base of their FFmpeg-Input resp. SDL-Audio/Video-Output can be found here:

"An ffmpeg and SDL Tutorial or How to write a VideoPlayer in less than 1000 Lines"
http://dranger.com/ffmpeg/
BTW: The "slightly out of date" only refers to some Details.

To make an OpenGL-VideoOutput this may help in Addition:
"Display ffmpeg frames on opengl texture"
http://stackoverflow.com/questions/23567503/display-ffmpeg-frames-on-opgel-texture
"ffmpeg video to opengl texture"
http://stackoverflow.com/questions/6495523/ffmpeg-video-to-opengl-texture

Whilst this is all C-Code, the Pascal-Counterparts can be found in grape3D and Ultrastar.


BTW:
Maybe we should start a new Topic, like "FFmpegPlay4Laz", because we're moving more and more away
from only talking about a "Component for retrieving data from video files".

Or is this already known or done in the Lazarus-Community ?
« Last Edit: May 23, 2016, 06:34:08 pm by metis »
Life could be so easy, if there weren't those f*** Details.
My FFmpeg4Lazarus = FFPlay4Laz + FFGrab4Laz + FFInfo4Laz

metis

  • Sr. Member
  • ****
  • Posts: 300
Re: Component for retrieving data from video files?
« Reply #22 on: November 25, 2014, 01:46:54 pm »
@Mike.Cornflake
@serbod
Video-Output via Lazarus-OpenGLControl done. :)
Next are Audio/Video-Output via SDL and the Audio/Video-Synchronization. ;)

@Fred vS
Finally I'll try to get the Audio-Output done by Portaudio. ::)
Life could be so easy, if there weren't those f*** Details.
My FFmpeg4Lazarus = FFPlay4Laz + FFGrab4Laz + FFInfo4Laz

Fred vS

  • Hero Member
  • *****
  • Posts: 3158
    • StrumPract is the musicians best friend
Re: Component for retrieving data from video files?
« Reply #23 on: November 25, 2014, 03:52:12 pm »
Quote
Finally I'll try to get the Audio-Output done by Portaudio.
=>
http://www.portaudio.com/docs/portaudio_sync_acmc2003.pdf

Fre;D
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

metis

  • Sr. Member
  • ****
  • Posts: 300
Re: Component for retrieving data from video files?
« Reply #24 on: November 25, 2014, 04:24:29 pm »
@Fred vS

Thanks, Fred - We seem to be the only ones, who are interested in NON-EXE FFmpeg-Solutions for Lazarus.  :(

Next Time I'll start a new Thread to continue with this Subject. ;)
 
-> see "NON(!)-EXE FFPlay4Laz"
http://forum.lazarus.freepascal.org/index.php/topic,26666.0.html
« Last Edit: May 23, 2016, 06:35:25 pm by metis »
Life could be so easy, if there weren't those f*** Details.
My FFmpeg4Lazarus = FFPlay4Laz + FFGrab4Laz + FFInfo4Laz

serbod

  • Full Member
  • ***
  • Posts: 142
Re: Component for retrieving data from video files?
« Reply #25 on: May 12, 2015, 08:42:18 pm »
@metis
Quote
BTW, I'm also looking for the last Version of the "New Audio Components" (= NewAC 2.6.1).

https://code.google.com/p/newac/

metis

  • Sr. Member
  • ****
  • Posts: 300
Re: Component for retrieving data from video files?
« Reply #26 on: April 22, 2016, 02:45:23 pm »
@CM630
@Mike.Cornflake

Referring back to the initial Subject, and in Addition to Mike's Post from 09/17/2013,
You'll find in the Attachment (= 'FFStreamInfo.lpr.txt' )
some more Code to read out Data from MediaFiles via FFmpeg-DLLs.

Differences to Mike's Code:
- updated FFmpeg-Functions for Use with more up to Date FFmpeg-Wrappers and -DLLs
- more Data fetched, like Metadata (= Tags), Aspect, diverse AudioParams, and so on
- stand-alone, procedural ConsoleApp

This Code is Part of my FFPlay4Laz-Project, see "NON(!)-EXE FFPlay4Laz":
http://forum.lazarus.freepascal.org/index.php/topic,26666.0.html
(It's an Extract of what is printed to the ConsoleWindow, when <i> was pressed.)

The FFmpeg-Wrappers and -DLLs You need to try it out, are here:
http://www.delphiffmpeg.com/headers/
http://www.delphiffmpeg.com/downloads/
(The present Code runs with those from 'FFVCL v5.6', but it should work with 'FFVCL v6.1' as well.)

Following FFmpeg-DLLs are required:
avcodec-55.dll, avformat-55.dll, avutil-52.dll and swresample-0.dll.

Notes:
- Reading out Chapters is done analogue.
- This Code does not only work with VideoFiles -> Try it with AudioFiles, VOB-Files (= DVD), etc.
- written with Lazarus v1.6.0 + FPC v3.0.0; tested on WinXP 32bit.

Of course, lots of more Data can be read out via FFmpeg.
For those, who are interested, see FFmpeg's 'ffprobe.c':
https://github.com/FFmpeg/FFmpeg/blob/master/ffprobe.c;
for those, who are very interested, have a Look at the 'libavformat'-SourceFile:
https://ffmpeg.org/doxygen/3.0/dump_8c_source.html#l00480.
« Last Edit: September 22, 2017, 02:51:33 pm by metis »
Life could be so easy, if there weren't those f*** Details.
My FFmpeg4Lazarus = FFPlay4Laz + FFGrab4Laz + FFInfo4Laz

DJMaster

  • New Member
  • *
  • Posts: 44
    • DJMaster on GitHub
Re: Component for retrieving data from video files?
« Reply #27 on: September 10, 2017, 10:48:38 am »
It seems that scandraid project is no more hosted on SourceForge.

Can someone please share latest sources?

Thank you in advance.

molly

  • Hero Member
  • *****
  • Posts: 2330
Re: Component for retrieving data from video files?
« Reply #28 on: September 10, 2017, 05:22:52 pm »
@DJMaster:
Are you referring to this project ?

DJMaster

  • New Member
  • *
  • Posts: 44
    • DJMaster on GitHub
Re: Component for retrieving data from video files?
« Reply #29 on: September 10, 2017, 06:13:34 pm »
No, I'm talking about the one referenced here:

http://forum.lazarus.freepascal.org/index.php/topic,22038.msg129568.html#msg129568

What I'm looking for is the following file and all the other files related to ffmpeg in pascal:

http://svn.code.sf.net/p/scandraid/code/src/trunk/gui/ffmpeg.pas


 

TinyPortal © 2005-2018