Recent

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

CM630

  • Hero Member
  • *****
  • Posts: 1077
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Component for retrieving data from video files?
« on: September 16, 2013, 10:40:09 am »
Does anyone know a free component for retrieving data from video files (codec info, FPS, bit rated, etc)?
Лазар 3,0 32 bit (sometimes 64 bit); FPC3,2,2; rev: Lazarus_3_0 on Win10 64bit.

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1260
Re: Component for retrieving data from video files?
« Reply #1 on: September 16, 2013, 01:18:54 pm »
Component wise you can extract some of the info you're looking from using the DSPack on Windows.

For cross-platform work, I keep hoping someone will translate the ffmpeg headers for me ;-)  Until then, you can call ffmpeg from the command line using TProcess.  It's got a superbly comprehensive list of attributes it returns...

UPDATE:  Did I say ffmpeg?  I meant ffprobe (same library)
http://ffmpeg.org/ffprobe.html

Function to call ffprobe (shows the parameters I use)
Code: [Select]
Function ProbeFile(sFilename: String): String;
Var
  sCommand: String;
Begin
  sCommand := Format('%s\ffprobe.exe -v quiet -show_format -show_streams "%s"',
    [ffmpegPath, sFilename]);
  Result := RunEx(sCommand, True);
End;

And here's my RunEx code (shamelessly lifted from the wiki, with an added option to redirect stderr (which causes problems if you don't redirect it))

Code: [Select]
Function RunEx(sCommandLine: String; bRedirectErr: Boolean = False): String;

Const
  READ_BYTES = 2048;

Var
  oStrings: TStringList;
  oStream: TMemoryStream;
  oProcess: TProcess;
  iNumBytes: Longint;
  iBytesRead: Longint;

Begin
  // A temp Memorystream is used to buffer the output
  oStream := TMemoryStream.Create;
  iBytesRead := 0;
  Try
    oProcess := TProcess.Create(nil);
    Try
      oProcess.CommandLine := sCommandLine;

      // We cannot use poWaitOnExit here since we don't
      // know the size of the output. On Linux the size of the
      // output pipe is 2 kB; if the output data is more, we
      // need to read the data. This isn't possible since we are
      // waiting. So we get a deadlock here if we use poWaitOnExit.
      If bRedirectErr Then
        oProcess.Options := [poNoConsole, poUsePipes, poStderrToOutPut]
      Else
        oProcess.Options := [poNoConsole, poUsePipes];

      oProcess.Execute;
      While oProcess.Running Do
      Begin
        // make sure we have room
        oStream.SetSize(iBytesRead + READ_BYTES);

        // try reading it
        iNumBytes := oProcess.Output.Read((oStream.Memory + iBytesRead)^, READ_BYTES);
        If iNumBytes > 0 Then
        Begin
          Inc(iBytesRead, iNumBytes);
        End
        Else
        Begin
          // no data, wait 100 ms
          Sleep(100);
        End;
      End;

      // read last part
      Repeat
        // make sure we have room
        oStream.SetSize(iBytesRead + READ_BYTES);

        // try reading it
        iNumBytes := oProcess.Output.Read((oStream.Memory + iBytesRead)^, READ_BYTES);

        If iNumBytes > 0 Then
        Begin
          Inc(iBytesRead, iNumBytes);
        End;
      Until iNumBytes <= 0;
      oStream.SetSize(iBytesRead);

      oStrings := TStringList.Create;
      Try
        oStrings.LoadFromStream(oStream);
        Result := oStrings.Text;
      Finally
        oStrings.Free;
      End;
    Finally
      oProcess.Free;
    End;
  Finally
    oStream.Free;
  End;
End;
« Last Edit: September 16, 2013, 01:36:52 pm by Mike.Cornflake »
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

Fred vS

  • Hero Member
  • *****
  • Posts: 3158
    • StrumPract is the musicians best friend
Re: Component for retrieving data from video files?
« Reply #2 on: September 16, 2013, 11:46:45 pm »
Quote
For cross-platform work, I keep hoping someone will translate the ffmpeg headers for me ;-)

Take a look here  ;) :

http://code.ohloh.net/file?fid=wbAk1NccIHoo6AiaRh5tm7fYZvs&cid=mAe06x6ROO4&s=&browser=Default&fp=226395&mpundefined&projSelected=true#L0
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

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1260
Re: Component for retrieving data from video files?
« Reply #3 on: September 17, 2013, 04:54:55 am »
@Fred vS
Nice one :-)  Many thanks for that link.  I had a play with this library when it was part of the UltraStar project, but couldn't get my head around it then.  I've had a quick play with the 3Dgrape version, seems easier now.  The rest of this post is more a reference for me as I intend to come back to this someday... 

If anyone is interested, the link Fred vS is posted is part of the 3Dgrape project (which looks rather interesting, no updates since 2011 though):  The 3Dgrape project includes ffmpeg headers that are released under LGPL.  I'm not sure if the ffmpeg header files here are a direct copy from the UltraStar project (I deleted my copy a year or two ago), or if they have been modified/improved in any way...

(3Dgrape was known originally known as scandraid)

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

To use the above, you'll need to reference:
http://www.ffmpeg.org/documentation.html

Last time I checked there was already a pascal port as part of the ffpmeg library, but this was stale.  In fact, IIRC the UltraStar work was derived from the stale ffmpeg port.

The 3Dgrape guys have wrapped some useful functionality, creating a class that extract video data frame by frame.  It's then up the UI to render those frames.  Their work is in:
http://svn.code.sf.net/p/scandraid/code/src/trunk/gui/ffmpeg.pas  (which is the file @Fred vS referenced)

This file, however, is released under GPL (if I understand this correctly, this means you've got to release ALL your code if you use or modify this unit).  However, this unit has ties back to the rest of the 3Dgrape application.  I'm itching to use this file as a reference if I eventually produce a ffmpeg based player & probe, but due to the restrictive GPL I better stay clear...

@paskal

I'm going to have a quick play now, see if I can use the ffmpeg library here to extract the information you require...  I'll get back to you...

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

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1260
Re: Component for retrieving data from video files?
« Reply #4 on: September 17, 2013, 09:42:52 am »
@Paskal

Ug.  The ffmpeg headers are still out of date, or at least incomplete.  No avcodec_open2 or avcodec_is_open for instance.

Nevertheless.  If you swipe the ffpmeg header units from the location I referred to last, and the dlls from the lib folder (http://svn.code.sf.net/p/scandraid/code/lib/win32/ffmpeg/)

Here's a quick (and very incomplete) wrapper unit...
Code: [Select]
Unit ffmpegWrapper;

{$mode objfpc}{$H+}

Interface

Uses
  Classes, SysUtils,
  avcodec, avformat, rational;

Type

  { TffmpegFile }

  { TffmpegFileInfo }

  TffmpegFileInfo = Class
  Private
    FFormatContext: PAVFormatContext;
    FFilename: String;
    function GetFormatContext: TAVFormatContext;
    Procedure SetFilename(AValue: String);
  Public
    Constructor Create;
    Destructor Destroy; Override;

    Procedure Clear;

    Function StreamCount: Integer;
    Function Stream(AStreamIndex: Integer) : TAVStream;

    Property Filename: String read FFilename write SetFilename;
    Property FormatContext: TAVFormatContext read GetFormatContext;
  End;

Function CodecContext(AStream : TAVStream) : TAVCodecContext;
Function CodecType(ACodecContext: TAVCodecContext): TCodecType;
Function CodecTypeAsString(ACodecContext: TAVCodecContext): String;
Function CodecTypeToString(ACodecType: TCodecType): String;
Function ToDouble(ARational: TAVRational) : Double;

Function OpenCodec(ACodecContext: TAVCodecContext) : TAVCodec;
Procedure CloseCodec(ACodecContext: TAVCodecContext);

Implementation

Function CodecContext(AStream: TAVStream): TAVCodecContext;
begin
  Result := AStream.codec^
end;

Function CodecType(ACodecContext: TAVCodecContext): TCodecType;
begin
  Result := ACodecContext.codec_type
end;

Function CodecTypeAsString(ACodecContext: TAVCodecContext): String;
begin
  Result := CodecTypeToString(ACodecContext.codec_type);
end;

Function CodecTypeToString(ACodecType: TCodecType): String;
Begin
  Case ACodecType Of
    CODEC_TYPE_UNKNOWN: Result := 'CODEC_TYPE_UNKNOWN';
    CODEC_TYPE_VIDEO: Result := 'CODEC_TYPE_VIDEO';
    CODEC_TYPE_AUDIO: Result := 'CODEC_TYPE_AUDIO';
    CODEC_TYPE_DATA: Result := 'CODEC_TYPE_DATA';
    CODEC_TYPE_SUBTITLE: Result := 'CODEC_TYPE_SUBTITLE';
    CODEC_TYPE_ATTACHMENT: Result := 'CODEC_TYPE_ATTACHMENT';
    CODEC_TYPE_NB: Result := 'CODEC_TYPE_NB';
  End;
End;

Function ToDouble(ARational: TAVRational): Double;
begin
  If ARational.num<>0 Then
    Result := av_q2d(ARational)
  Else
    Result := 0.0;
end;

Function OpenCodec(ACodecContext: TAVCodecContext): TAVCodec;
begin
  Result := avcodec_find_decoder(ACodecContext.codec_id)^;

  If (avcodec_open(@ACodecContext, @Result)<0) Then
    Raise Exception.Create('avcodec_open failed');
end;

Procedure CloseCodec(ACodecContext: TAVCodecContext);
begin
  // TODO:  Find out why this AV's.  It shouldn't...
  //avcodec_close(@ACodecContext);
end;

{ TffmpegFileInfo }

Procedure TffmpegFileInfo.SetFilename(AValue: String);
Var
  errCode: longint;

Begin
  If AValue = FFilename Then
    Exit;

  Clear;

  If FileExists(AValue) Then
  Begin
    errCode := av_open_input_file(FFormatContext, PChar(AValue), nil, 0, nil);
    If (errCode = 0) Then
      FFilename := AValue
    Else
      Raise Exception.CreateFmt('Error opening %s.  Error code %d', [AValue, errCode]);

    errCode := av_find_stream_info(FFormatContext);
  End;
End;

function TffmpegFileInfo.GetFormatContext: TAVFormatContext;
begin
  Result := FFormatContext^;
end;

Constructor TffmpegFileInfo.Create;
Begin
  FFormatContext := nil;
End;

Destructor TffmpegFileInfo.Destroy;
Begin
  Clear;

  Inherited Destroy;
End;

Procedure TffmpegFileInfo.Clear;
Begin
  FFilename := '';

  If FFormatContext <> nil Then
  Begin
    av_close_input_file(FFormatContext);
    FFormatContext := Nil;
  end;
End;

Function TffmpegFileInfo.StreamCount: Integer;
Begin
  Result := FFormatContext^.nb_streams;
End;

Function TffmpegFileInfo.Stream(AStreamIndex: Integer): TAVStream;
begin
  If FFormatContext <> nil Then
    Result := FFormatContext^.streams[AStreamIndex]^;
end;

Initialization
  // For now, this is easier than just registering the specific formats and
  // protocols that we need...
  av_register_all;

End.

And here's how to use it...
Code: [Select]
procedure TForm1.btnProbeClick(Sender: TObject);
Var
  oFile : TffmpegFileInfo;
  oStream: TAVStream;
  oCodecContext : TAVCodecContext;
  oCodec : TAVCodec;
  iStream: Integer;
  i: Integer;
begin
  Memo1.Lines.Clear;
  Memo1.Lines.Add('-TffmpegFileInfo-');
  oFile := TffmpegFileInfo.Create;
  Try
    oFile.Filename := FileNameEdit1.FileName;

    Memo1.Lines.Add(Format('Stream Count = %d', [oFile.StreamCount]));
    For i := 0 To oFile.StreamCount-1 Do
    Begin
      oStream := oFile.Stream(i);
      Memo1.Lines.Add(       '  -----------------');
      Memo1.Lines.Add(Format('  Stream ID: %d', [i]));
      Memo1.Lines.Add('');

      Memo1.Lines.Add(Format('  Frame Rate (fps): %f', [ToDouble(oStream.r_frame_rate)]));
      Memo1.Lines.Add(Format('  Duration: %d', [oStream.duration]));
      Memo1.Lines.Add(Format('  Time_Base: %f', [ToDouble(oStream.time_base)]));
      Memo1.Lines.Add(Format('  Duration (sec): %f', [oStream.duration * ToDouble(oStream.time_base)]));
      Memo1.Lines.Add('');

      oCodecContext := CodecContext(oStream);
      oCodec := OpenCodec(oCodecContext);
      Memo1.Lines.Add(Format('  Codec Type: %s', [CodecTypeAsString(oCodecContext)]));
      Memo1.Lines.Add(Format('  Codec Name: %s', [oCodec.Name]));
      Memo1.Lines.Add(Format('  bit rate (bps): %d', [oCodecContext.bit_rate]));
      Memo1.Lines.Add(Format('  bit rate (KBps): %f', [(oCodecContext.bit_rate/(8*1024))]));
      Memo1.Lines.Add(Format('  Frame Size: %d x %d', [oCodecContext.width, oCodecContext.height]));
      CloseCodec(oCodecContext);

      Memo1.Lines.Add(       '  -----------------');
      Memo1.Lines.Add('');
    end;
  finally
  end;
end;

I *hate* pointers.  Just thought I'd mention that :)

Also, this leaks.  I can't find why avcodec_close crashes on me, so for now, I've commented it out...

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

CM630

  • Hero Member
  • *****
  • Posts: 1077
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: Component for retrieving data from video files?
« Reply #5 on: September 19, 2013, 08:18:55 am »
I decided to use FFPROBE, until it occurred, that the EXE is 24 MB.
The avcodec and AVformat dlls are 5 MB, but...
I get Fatal: Can not find unit avcodec used by ffmpegWrapper.
How am to tell the app where to find the apps?
I tried regsvr32 but failed.

Code: [Select]
const
    {$ifdef win32}
    avcodec = 'avcodec-51.dll';
does not help, too.
« Last Edit: September 19, 2013, 08:26:33 am by paskal »
Лазар 3,0 32 bit (sometimes 64 bit); FPC3,2,2; rev: Lazarus_3_0 on Win10 64bit.

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1260
Re: Component for retrieving data from video files?
« Reply #6 on: September 19, 2013, 09:13:54 am »
You sure ffprobe is that large? my version is only Kb in size...

No need to register the DLLs, just stick them in the same folder as your exe.

The file avcodec is in http://svn.code.sf.net/p/scandraid/code/src/trunk/external/ffmpeg/   You'll need to download them all, then add them to your project.  There was a problem with Mathematics.pas, so I just deleted it :-)

errr,

Code: [Select]
svn update http://svn.code.sf.net/p/scandraid/code/src/trunk/external/ffmpeg/ <your folder>  to download them.  I'm still new to SVN, TortoiseSVN hides the actual commands from me, so haven't learned them yet :-)
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 #7 on: October 07, 2014, 03:34:28 pm »
@mike.Cornflake:

Quote
For cross-platform work, I keep hoping someone will translate the ffmpeg headers for me

You mentioned Ultrastar, 3Dgrape, scandraid etc., but did You ever check FFVCL ?
www.DelphiFFmpeg.com

FFVCL is "only" a Delphi FFmpeg VCL Runtime-Package, but the Trial Edition
http://www.delphiffmpeg.com/downloads/
comes with all FFmpeg-DLLs, and here
http://www.delphiffmpeg.com/headers/
you get all FFmpeg-Headers for Delphi/Pascal for free, with some Demos with SourceCode for Delphi.

I tried out some of them, simply using the Lazarus-ConversionTool, and up to now they all work fine
with Lazarus as well.

metis
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 #8 on: October 07, 2014, 03:46:36 pm »
Hello.

You may use video vlc library.

fpGUI gives pascal header of vlc and a demo how to use it => /fpGUI/examples/gui/video_vlc
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

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1260
Re: Component for retrieving data from video files?
« Reply #9 on: October 07, 2014, 04:11:03 pm »
...did You ever check FFVCL ? www.DelphiFFmpeg.com

FFVCL is "only" a Delphi FFmpeg VCL Runtime-Package, but the Trial Edition
http://www.delphiffmpeg.com/downloads/
comes with all FFmpeg-DLLs, and here
http://www.delphiffmpeg.com/headers/
you get all FFmpeg-Headers for Delphi/Pascal for free, with some Demos with SourceCode for Delphi.

I tried out some of them, simply using the Lazarus-ConversionTool, and up to now they all work fine
with Lazarus as well.

Whoo haa! :-)   That's fantastic news, many thanks for this.  I did check them out, but either I missed the free headers, or they weren't available when I checked.

I've sent them an email asking for permission to reference them on our wiki.

You may use video vlc library.

fpGUI gives pascal header of vlc and a demo how to use it => /fpGUI/examples/gui/video_vlc

And thanks for this as well.  I'm already using VLC for playback, via the Lazarus package, but it's the same fpc headers.  I've contributed to the Lazarus mplayer package, and I put together http://wiki.lazarus.freepascal.org/Video_Playback_Libraries (which is now recursive, thanks to a link in there pointing back here)...

I have a vision you see (one of many) :-)  One unified playback control where either the developer or enduser can decide the playback mechanism.  My potential clients are all in locked-down corporate environments, some have VLC, some are allowed the required codecs (for DirectShow), and others nothing at all - so I need flexibility.  I've already got a rough framework set up for switching between mplayer/vlc/directshow (but not that's ready for distribution).  What I didn't have is ffmpeg direct.  Oh, and I don't have the time :-)   I got exactly as far as I needed to get, then moved onto other problems.  Stay tuned, by 2020 I may just be there :-)
« Last Edit: October 07, 2014, 04:26:07 pm by Mike.Cornflake »
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

Fred vS

  • Hero Member
  • *****
  • Posts: 3158
    • StrumPract is the musicians best friend
Re: Component for retrieving data from video files?
« Reply #10 on: October 09, 2014, 03:53:15 pm »
Quote
One unified playback control where either the developer or enduser can decide the playback mechanism.

Excellent  ;) => I will be your fan.

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 #11 on: October 10, 2014, 03:55:18 pm »
@Mike.Cornflake

Quote
but either I missed the free headers, or they weren't available when I checked
Did You get them? I can't attach the ZIP-File for You, because it's a litte bigger than 250kb.
If You want, I split it for You.

Quote
What I didn't have is ffmpeg direct
That's the point. For this reason, I even didn't mention 'libvlc' resp. 'PasLibVlc'.

In the past I wrote some Test-Apps, e.g. for FMOD, MPlayer, VLC, just for checking out these Lib's.
They work fine, but I aim a Pascal-Solution, that is:
- OpenSource => NO FMOD (= closed)
- LicenseFree => NO FMOD (= free for personal use, but not for Redistribution)
- CrossPlatform => NO DirectShow, NO DirectSound (= Win only)
- direct => NO MPlayer (= Console, only communicating via Pipes)
- without Layers, I don't need => NO VCL
- depending on a minimum of other projects or DLLs - You never know, until they are "alive"
- Realtime, that afaik can not be really achieved with any Pascal-Code as long as
  it's running in a C-Code-Environment (Tell me, if I'm wrong).

For these reasons, I currently use for Audio mpg123, libsndfile and Portaudio, inspired by 'UOS' by Fred vS.

Unfortunately mpg123 and libsndfile do not decode that much AudioFormats. Therefore, and of course for Video,
I want something, that works with any other present and future(!) Audio/Video-Codec.

Afaik up to now only FFmpeg fulfills these criterias, and finally FFmpeg is the mother of lots of
projects, like MPlayer/MEncoder, VLC, Acinerella, FFDec - see:
https://trac.ffmpeg.org/wiki/Projects


Quote
while apparently random ... Oh, and I don't have the time
Got the same problem - Therefore:

Do You know any working Pascal-Code for a Player and En-/Decoder with FFmpeg ?
Otherwise I'd have to write most of the Code on my own, as I did for the Test-Apps mentioned above.
All the Links above do not open, for being outdated or missing permission.

Thanks.

« Last Edit: May 23, 2016, 05:50:56 pm by metis »
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 #12 on: October 10, 2014, 04:11:20 pm »
Quote
Unfortunately mpg123 and libsndfile do not decode that much AudioFormats

Hello.
 
Hum, what audio-format are you missing ?

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

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1260
Re: Component for retrieving data from video files?
« Reply #13 on: October 10, 2014, 04:20:36 pm »
Quote
but either I missed the free headers, or they weren't available when I checked
Did You get them? I can't attach the ZIP-File for You, because it's a litte bigger than 250kb.
If You want, I split it for You.

Thanks for the offer, but I see they're still on the website.  I have since contacted FFVCL, obtained permission to link to the headers on our wiki, and updated the wiki accordingly :-)

Quote
What I didn't have is ffmpeg direct
That's the point. For this reason, I even didn't mention 'libvlc' resp. 'PasLibVlc'.
...

We're on the same page :-)  While I don't mind using mplayer and VLC, it's not my personal preference for a way forward...  I actually enjoyed the years I spent coding with DirectShow, and look forward to moving to cross-platform base.  But having said that, due to time constraints mplayer and VLC (either library) represent tanglible solutions that I can work with right now.  And that's important too :-)

- Realtime, that afaik can not be really achieved with any Pascal-Code as long as
  it's running in a C-Code-Environment (Tell me, if I'm wrong).

Don't see why not.  It's been done before (those outdated/dead links pointed to real projects, and FFVCL have written their own player & encoder from scratch in Delphi)

Afaik up to now only FFmpeg fulfills these criterias, and finally FFmpeg is the mother of lots of projects, like MPlayer/MEncoder, VLC, Acinerella, FFDec - see:
https://trac.ffmpeg.org/wiki/Projects

Preaching to the converted :-)   We're definitely on the same page, and I've long been a fan of FFmpeg.

Do You know any working Pascal-Code for a Player and En-/Decoder with FFmpeg ?

Obviously you're talking about accessing the FFmpeg library directly, not through the binaries.  See below, but I have the code for those dead links and FFVCL report examples in the header downloads.  Other than that, I know of no other examples.  We'll be starting from scratch :-)

All the Links above do not open, for being outdated or missing permission.

Yeah, I'm in a bit of conundrum about that.  I actually downloaded various projects while they were available, but as the creator has deleted the code, does that remove my right to have the copy?  I'm unclear.  However, licensing on at least one of the projects made me uncomfortable, so personally I'd rather start over scratch and port the FFmpeg examples.  <shakes head> And why am I saying that?  Those FFVCL headers you pointed me to included examples.  While sure, they might be examples of the FFVCL encoder and player, I'm optimistic that they're actually examples ported from the original FFmpeg project...

To be investigated.  Sometime :-)
« Last Edit: October 10, 2014, 04:32:28 pm by Mike.Cornflake »
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

serbod

  • Full Member
  • ***
  • Posts: 142
Re: Component for retrieving data from video files?
« Reply #14 on: October 10, 2014, 05:29:11 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.

Some time ago I work on some commercial project, similar to GStreamer and have some experience with ffmpeg. And want to reproduce some useful things as ACS components. 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.

 

TinyPortal © 2005-2018