Lazarus

Programming => Graphics and Multimedia => Audio and Video => Topic started by: metis on December 04, 2014, 04:24:27 pm

Title: NON(!)-EXE FFPlay4Laz
Post by: metis on December 04, 2014, 04:24:27 pm
@ALL, specially @Fred vS

Inspired by the Thread Component for retrieving data from video files (http://forum.lazarus.freepascal.org/index.php/topic,22038.0.html) in this Forum,
I've started to build a FFmpeg-based MediaPlayer for Lazarus, which
is NOT "only" using FFmpeg's 'ffplay.exe' (= "NON(!)-EXE").

For the FFmpeg-CommandLine-Tools (https://ffmpeg.org/about.html) (ffmpeg.exe, ffplay.exe and ffprobe.exe) there are already plenty of
Documentations, CodeSamples and Examples for how to use them, as well as FrontEnds.

But, what about those cute little FFmpeg-Libraries ?  :(

For those, who are interested in Stuff like this, the best Entrance, that I found is this:
"An ffmpeg and SDL Tutorial or How to Write a Video Player in Less Than 1000 Lines" (http://dranger.com/ffmpeg/ (http://dranger.com/ffmpeg/))
Whilst this is all C-Code, the Pascal-Counterparts can be looked up in Ultrastar (https://usdx.eu/) and grape3D (https://www.openhub.net/p/grape3D).

Current ProjectState:
- Open/Read/Decode/Close a MediaFile         : done
- Get all Infos about that MediaFile               : done (= Retrieving Data from VideoFiles (https://forum.lazarus.freepascal.org/index.php/topic,22038.msg208700.html#msg208700) = FFInfo4Laz)
- Video-Output via SDL's YUV-Overlay          : done
- Video-Output via SDL's RGB-Surface          : started, but not so important for me
- Video-Output via SDL's Textures                : done
- Video-Output via the 'LazOpenGLControl'   : done, but currently not used
  (This Part includes the FPC-Codes to X/Y-Shift, Flip horizontally/vertically, Zoom, Rotate with 'OpenGL')
- Audio-Output via SDL-Audio and PortAudio (http://www.portaudio.com) : done
- Threading, AV-Synching, Seeking, Looping : done

Note:
This Topic is NOT meant to discuss the Pros&Cons of FFmpeg-EXEs/-LIBs, or
do something like "FFmpeg-EXEs vs. FFmpeg-LIBs", because this is obvious.

The last Release with SDL v1 (= fully-featured Player, CLI + DLL + Test&Demo-GUI with Source) can be downloaded here (https://forum.lazarus.freepascal.org/index.php/topic,26666.msg337046.html#msg337046).

Releases with SDL v2 can be downloaded from here onwards (https://forum.lazarus.freepascal.org/index.php/topic,26666.msg428667.html#msg428667).

• For a Summary of my FFPlay4Laz-Project, see here (https://forum.lazarus.freepascal.org/index.php/topic,26666.msg473533.html#msg473533).

Have Fun with superior Sound  :)
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: marcov on December 04, 2014, 04:44:39 pm
(IIRC Jedi-SDL already had a ffmpeg header. It might be the origin of the ones you found)
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on December 04, 2014, 05:09:31 pm
@marcov

Do You refer to the Jedi-SDL, that comes with Ultrastrar-SourceCode ?

I'm not talking about Pascal-Headers for FFmpeg; these indeed already do exist.


@marcow

Maybe, last Time I got You wrong, and You just wanted to tell me, where to get the FFmpeg-Headers from.  :)

Well, I started the Project with the Headers, that come with Ultrastar-SourceCode (= v52.67.2):
http://ultrastardx.sourceforge.net/usdx-downloads/usdx/ (http://ultrastardx.sourceforge.net/usdx-downloads/usdx/)

Once this works, I'll intend to implement those from FFVCL:
http://www.delphiffmpeg.com/headers/ (http://www.delphiffmpeg.com/headers/)

Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on December 15, 2014, 05:26:54 pm
@Fred vS

If You are still interested in implementing FFmpeg in Your UOS, to play ANY AudioFormat with it, have a Look at this:
https://github.com/varianus/ovoplayer (https://github.com/varianus/ovoplayer)
-> 'src\audioengine_ffmpeg.pas'  ;)


Title: Re: NON(!)-EXE FFPlay4Laz
Post by: aradeonas on February 21, 2015, 02:14:06 pm
Hi,

Is you project have source any where?
I wan to take a look at it,It seems interesting.
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on February 25, 2015, 05:19:33 pm
@aradeonas

Wow, finally somebody interested in FFmpeg-DLLs.  :)

Quote
Is you project have source any where?
Only on my PC, nowhere else - Nobody asked for it yet.  %)

Quote
I wan to take a look at it
Which part are You interested in ?  :)

Current State:
Got Video(SDL, OpenGL) and Audio(SDL) running, but only with some "PseudoSynching",
as well as save VideoFrame to PPM-File.
-> Next Step: Threading & Synching with LazarusMeans only.
(FFPlay.exe, DrangerTutorial, and UltraStar use SDL-TimeBase and SDL-Threading.)

Quote
It seems interesting
Hope so - Up to now, I didn't find anything like this for Lazarus;
everybody "only" uses the FFmpeg-EXEs.
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: aradeonas on February 25, 2015, 11:05:14 pm
Quote
Wow, finally somebody interested in FFmpeg-DLLs.
Because I don't find this until now!
Quote
Nobody asked for it yet.
I'm ask if you want to share sure.
Quote
Which part are You interested in ?
All of it especially custom video play system.ffmpeg is so powerful and I'm sure we can done grate things with it.
Quote
Hope so - Up to know, I didn't find anything like this for Lazarus;
everybody "only" uses the FFmpeg-EXEs.
Yes,its been a month I am searching for ways to make a custom video player and there isn't any good source.
By the chance are you author of ovoplayer?
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on March 03, 2015, 03:31:20 pm
@aradeonas

Sorry for answering so late, but (even in 2015) I still got no internet at home.  :'(

Quote
if you want to share ... All of it ... to make a custom video player
Well, up to now my code is very "brainstormy", full with personal notes, quite early to publish.
It works - not perfectly yet - but it works, at least on my PC:
- INTEL Pentium DualCore 1,60GHz, 2 GB RAM
- WinXP 32 SP3
- Lazarus v1.2.2 + fpc v2.6.4

I started my FFPlay4Laz with DrangerTutorial and UltraStar, to get familiar with this subject first.
Thus, my present Code is quite near to them, but not equal; last but not least it's all in FPC-Mode (<-> UltraStar).

For the future, it's surely better to go on with the FFVCL-Wrappers. They match with newer FFmpeg-DLLs,
and got much more features than those from UltraStar - here's only one example:
UltraStar-Wrappers got no way to differ between FrameTypes ("I","P","B", etc.) <-> FFVCL, see:
FFVCL v5.6 -> 'libavutil.pas' -> "TAVPictureType".

So, a good entry for You to see, how to open, decode, etc. a VideoFile can be found in:
- 'FFVCL v5.6\...\examples\filtering_video.dpr' (Conversion works fine with the Lazarus-ConversionTool)
- 'mpegpas02.zip' by 'The Creative CAT' shows another, but much elder approach.

Once You got this, there should be no problem to insert the Code I wrote for Audio-/VideoOutput.

Quote
isn't any good source
Usually what's the problem ? Which parts do not work in general ? What is missing ?

Quote
we can done grate things with it.
Sounds great -> Tell me more - who's "we" ? :)


Quote
By the chance are you author of ovoplayer?
No - I only wanted to encourage Fred vS to extend the features of his (great) UOS. About a year ago,
I had a little chat with him. At that time I was especially interested in rendering mp3 and WMA, see:
"uos and uoslib version 1.0 is here"
http://forum.lazarus.freepascal.org/index.php/topic,23725.msg142114.html#msg142114 (http://forum.lazarus.freepascal.org/index.php/topic,23725.msg142114.html#msg142114)).

Meanwhile I aim to reproduce ANY Audio and ANY Video -> FFmpeg.  :D
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: aradeonas on March 03, 2015, 07:58:42 pm
@metis with no internet and WinXp I'm sure you are a bad ass developer ;)

I look at units you said,I should say they are quite hard for me,Because I haven't experience in this field before.
My problem is playing files in a row with minimum delay and for this I need buffer before play.Look at here:
http://forum.lazarus.freepascal.org/index.php/topic,27324.0.html (http://forum.lazarus.freepascal.org/index.php/topic,27324.0.html)
I think about custom video player and I need that ability as I said.
We is You,me and any one like this field like one off my friends.
I must say I like your project and if you want I sure want to test,browse and help (if can in source o r making demo or ...) and I'm don't care about messy codes ;)
Please let me know.
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: TurboRascal on March 03, 2015, 09:38:21 pm
This is VERY interesting indeed...
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on March 11, 2015, 03:53:28 pm
@aradeonas
Quote
with no internet and WinXp
Got internet at my workingplaces; that's sufficient for my needs, for I'am not a developer, only a hobbyist.
As long as You prefer writing code to staring at fancy, graphically overloaded screens, any OS does it.  ;)

Quote
I look at units you said,I should say they are quite hard for me
Hope, You didn't expect, that a bad ass developer's code would be easier to read. :)


Quote
My problem is playing files in a row with minimum delay ... want to test
In the past, I wrote several player (Fmod3 -> Fmod4 (= FmodEx) -> MPlayer -> VLC -> Portaudio), always with
the main interest to render Audio/Video with maximum performance and minimum latency, using Pascal.
Doing this, I never just used preformed Audio/Video-Components (except of the Wrappers) to put then only
another layer with the player functions upon it.
Though they all work fine, finally I always reached to a point, where with those DLLs (and/or their Wrappers)
certain features cannot be realized at all, or only with weary workarounds, see:
"Component for retrieving data from video files"
http://forum.lazarus.freepascal.org/index.php/topic,22038.0.html (http://forum.lazarus.freepascal.org/index.php/topic,22038.0.html)
-> Page #2 -> My post from Oct. 18, 2014 -> read up from "I found an initial delay..."
Obviously, You reached to the same point, now.  :P
(Now, if anybody asks me, why I do not make it simply in C -> this already exists.)

To make Your day happy, I show you how to add SDL-YUV-VideoOutput to the FilteringVideo-Example, that
comes with FFVCL v5.6 - This way you may check, if FFmpeg meets Your needs:

1. Convert 'filtering_video.dpr'
2. Replace the ProgramCode by this:
   filtering_video_plus_sdl_yuv.lpr.txt (-> the changes I've made, You'll find searching for "by moi" )
3. Add
   - The headers + FFUtils.pas from FFVCL v5.6 
   + My Unit 'uFF2sdlV_YUV' (= the minimal code for SDL-YUV, You'll need for testing the speed of FFmpeg )
   ( This unit is pure DrangerCode (-> see: Tutorial 02 - Outputting to the Screen), I only transcribed it to Pascal.)
4. Compile

Required DLLs from FFVCL v5.6 to run the console:
avcodec-55.dll, avfilter-4.dll, avformat-55.dll, avutil-52.dll, swresample-0.dll, swscale-2.dll, SDL.dll.


@TurboRascal
Quote
"The secret is to give them what they need, not what they want."
:D
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: mercury on March 11, 2015, 04:20:52 pm
amazing. mark.
please keep going.
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: aradeonas on March 11, 2015, 04:41:48 pm
Thank you very much metis.
But I don't understand :(
Unlike you I dont get video systems but for a simple project I need play from memory but after reading and researching still don't get it.
Take a look at here:
http://forum.lazarus.freepascal.org/index.php/topic,27324.0.html (http://forum.lazarus.freepascal.org/index.php/topic,27324.0.html)
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: Mike.Cornflake on March 11, 2015, 09:12:19 pm
@aradeonas

Wow, finally somebody interested in FFmpeg-DLLs.  :)

:-)  Law of diminishing returns.  Not that many people interested in playing video, and of that number most are satisfied with either mplayer, VLC or DirectShow...  By the time you get to the people interested in this project, you start hitting against the fact that we're hobbyists and are time limited.

please don't be disheartened.  In my opinion, the work you're doing is important and we appreciate it :-)

amazing. mark.
please keep going.

+1
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on March 14, 2015, 04:31:52 pm
@mercury
Quote
please keep going.
I will, whenever I got time, time, time for it.  :)
Sometimes I got all of a day for progging, but then I have to leave it for weeks or even for months.  :'(
=> Be patient. It may last, last, last, but I will always post the current state in this Forum.

@Mike.Cornflake
Thanx a lot, and welcome, back again.
Today I measured my height: I think, I grew about 1-2mm.  :D

@All
I appreciate any assistance.
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: aradeonas on March 14, 2015, 08:14:41 pm
Quote
@All
I appreciate any assistance.
Wish I could help you,I just can encourage you  :D
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on April 10, 2015, 05:54:57 pm
@ALL

First FFPlay4Laz-DemoApp available at:
https://www.dropbox.com/sh/jsv50ng9dcn9ros/AABOF7lT4JzJxmv3E8qQ78pFa?dl=0 (https://www.dropbox.com/sh/jsv50ng9dcn9ros/AABOF7lT4JzJxmv3E8qQ78pFa?dl=0)

> Compiled and tested with WinXP 32bit; not tested on any other Platform.
> Up to now, I only tried it out with MPEG- and AVI-Files.

 :D
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: aradeonas on April 10, 2015, 06:18:47 pm
Quote
Wish I could help you,I just can encourage you  :D
And test!

And I test it.Sadly it fails with most of my test files and show a access violation but for one of files it plays but flicker.
But I'm happy you made it and I will wait for continue.

Thank you very much.
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on April 13, 2015, 05:05:58 pm
@aradeonas

Thanks for testing.  :)
This way, You help me a lot, for I have not too much other Platforms to check it out.

Quote
Sadly it fails with most of my test files
I had the same Problem with some Files. :'(
Mostly this Error occured when Calculating the Times of the AUDIOStream for the AV-Streams-Info-Form,
'cause some Files had very strange Values (sometimes NEGATIVE!) encoded(!) for the AudioStream.
I fixed this -> Most of the Files I got, work now
-> Please, put the Files, that raise Errors into my DropBox, to check them out.

Quote
and show a access violation
I fixed this -> Now You should have less 'AccessViolations' and more Infos in the ConsoleWindow, why it failed.
-> Get the updated Version from my DropBox (it also includes a README-File with known Bugs&Issues), and try again.

Not to forget:
The present DemoApp still uses the FFmpeg-Headers, and -DLLs, I "borrowed" from 'Ultrastar v1.1' - those are from 2010 !
-> Newer Files may fail, simply because the Audio- and/or VideoCodec is not supported yet.

Quote
but flicker
I have no Flickering at all on my PC.
-> What PC/GraphicCard do You have ?

Title: Re: NON(!)-EXE FFPlay4Laz
Post by: aradeonas on April 13, 2015, 07:12:02 pm
Quote
Thanks for testing.  :)
Thanks for making it,Im trying to thanks with testing.

Now it raises less errors but it cant open most of the AVI files I have in my PC.
I test it with a Windows 8 64bit PC with a on board graphic card.

About DropBox your shared folder is not public for uploading.You can invite me to folder with sending invitation to aradeonas at operamail.com

Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on April 21, 2015, 04:55:37 pm
@aradeonas

Try the last Update in my DropBox, BUT KEEP YOUR OLD ONE, because:
I really don't know, what happened to this Version:
Everything works fine on MY PC, but when I put it on an other PC, [OpenGL] fails with an "AccessViolation", while [SDL-YUV] works.   :'(
-> How is this possible ? (Maybe anyone knows in this Forum)
Try it anyway; perhaps it works on Your PC.

Changes, among others:

> Log-Output to the ConsoleWindow revised.
  -> Should be easier now to see, why a VideoFile fails.

> VideoBackgroundColor-Setting added for OpenGL-Mode.
 -> Now You can play around with the VideoImage- AND VideoSCREEN-Colors: 
     Set a Zoom < 1 -> Uncheck [Keep ZoomTraces] -> Select e.g. "Inverted" -> Move the RGB-Color-Sliders;
     current Options are: Black - "ScreenGrey" - Same as the VideoImage - Inverted.
   
> Two small DemoVideos added, that work on my PC, w/o Flickering, etc.
    (Note: EOF-Handling is not done yet.)

I tried it out with some more VideoFiles:
-> Some do not show a proper VideoImage with [OpenGL], but all of those do with [SDL-YUV].
-> Some, that were encoded with "Nero" open, but they do not start playing in [Frame]-Mode,
     but all of those work in [Time]- and [Loop}-Mode.

If nothing goes at all, try it withOUT SDL-AUDIOOutput; may be the Error occured there,
because the SDL-AudioOutput is NOT completely worked out yet.
(Finally, this is the Sense of this DemoApp:
 Having several Options to render a File, it's easier to find out, where and why it fails.)

> Can I put Your e-Mail-Adress into the Contributors-File of FFPlay4Laz ?
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: aradeonas on April 22, 2015, 08:39:19 am
Yea! it works!
Now it open your demo files and all mpg files that I have and many avi files!
Problems that I have are :
- freezing sometimes when changing video or video end.
- Noise in video. for this I put an screenshot for you in dropbox.

Your doing great.Thank you metis.

About contributors thank you very much but I just test and nothing more and there is no need for that ;)
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: Brian_ch on April 29, 2015, 12:48:01 am

Not to forget:
The present DemoApp still uses the FFmpeg-Headers, and -DLLs, I "borrowed" from 'Ultrastar v1.1' - those are from 2010 !
-> Newer Files may fail, simply because the Audio- and/or VideoCodec is not supported yet.


There are updated headers in:
https://sourceforge.net/p/ultrastardx/svn/HEAD/tree/trunk/src/lib/

Including FFmpeg 2.6 that is the newest release so far (I didn't tested with 2.6.1 though, but it should work).
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on April 30, 2015, 04:29:35 pm
@aradeonas

Quote
Yea! it works!
:D

I did some Changes (Console-Output redone, Code restructured, etc.)
-> Get the last Version from my DropBox.

This Version still is not perfect, but it runs more stable and faster(!) - at least on my PC.
E.g. still I have to try sometimes twice (or more), to start the App for the first Time, but
once it runs, it runs.

But, even after having tried several Ways to do the OpenGL-VideoOutput, one basic Problem has stayed:
If I put the compiled EXE-File on any other PC (Win98, Win7), the OpenGL-VideoOutput fails with
TApplication.HandleExceptions, etc., and does not work at all, whilst SDL-Video does.
=> Does the OpenGL-VideoOutput really work on Your PC ?
=> Did You only try it out on PC's, where the Lazarus-IDE is installed ?
-> I'll start a Thread in the OpenGL-ChildBoard of this Forum to get this Problem solved.

Quote
Now it open ... and many avi files! ... Freezing ... Noise
> Please, put some of those Videos, that do not open into my DropBox.
   I don't need the whole File to check out, why it fails; the first 1-2 Minutes are sufficient.
> Freezing is a known Issue; EOF-Handling is not done yet -> It's all on my (very long) ToDo-List.
   -> If an ErrorMessage appears, give it to me.
> I saw the Noise in Your PNG-File, but when I run the VideoClip on my PC, I got no Noise, neither
  on the VideoScreen, nor in the PPM-Files for the VideoFrames.


@Brian_ch

Thanks a lot for that Link. Updating the Headers is projected, of course.
But first I will improve performance and add more features to FFPlay4Laz.
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: aradeonas on May 01, 2015, 06:00:48 pm
metis we have problem again!

I changed my PC and now player cant play both demo file.(It better to put demo files in drop box demo folder so there will no need to upload them every time.)
I put screen shot from log for you.
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on May 06, 2015, 04:46:25 pm
@aradeonas

This is exactly what I get, when I put FFPlay4Laz on any other PC than the one where I'm writing it,
whilst SDL-YUV works.
> see my former Thread "one basic Problem has stayed...the OpenGL-VideoOutput fails":
Whatever I do, Open-GL works perfectly on my PC, but fails on other PCs, obviously where Lazarus is not installed. :'(
-> What is missing there to open OpenGL; what's the difference ? - I have no solution yet, but I'm on it.  %)

BTW: The "noise" You mentioned last Time: I also got it, but only on the SDL-VideoScreen; the OpenGL-Image is perfect.
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: aradeonas on May 07, 2015, 08:09:28 am
OK.You did a good job until now and Im sure if you continue,it will be a real good option.
Keep doing this good work and Im following you.

Thank you.
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on May 21, 2015, 04:57:33 pm
@aradeonas

Finally I found the Error, why FFPLay4Laz works on my PC, and fails on other, see:  :D
http://forum.lazarus.freepascal.org/index.php/topic,28402.0.html (http://forum.lazarus.freepascal.org/index.php/topic,28402.0.html)


Title: Re: NON(!)-EXE FFPlay4Laz
Post by: aradeonas on May 22, 2015, 11:27:38 am
Very good.Im waiting for new version.
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on May 27, 2015, 05:21:18 pm
@aradeonas

Get the latest Version from my DropBox -> here only the most important Changes:

> Messages in the Console are colored and with more Infos
> Newer SDL-DLL-Version added (Both DLL-Versions should work with the App)
> Now You can open a VideoFile in [Loop]-Mode directly.
   (= without opening it in one of the other Modes before)

> And last, but not least:
   On PCs, that do not support NON-PowerOfTwo-VideoTextures (= NPOT),
   the App will switch to PowerOfTwo-Mode (= POT):
-> In NPOT-Mode, You should see the VideoImage as before.
-> In POT-Mode, You'll see a VideoImage, that is not scaled yet.
    (Before writing new Code I'd like to check first if the App is working this Way.)
If this fails, the App does (should) not crash any more, and an ErrorMessage is shown in the Console.

I put the Files, that have changed into the Dir 'FFPlay4Laz_NEW - 27.05.2015'.
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: aradeonas on May 27, 2015, 07:40:34 pm
Now it's stable,No error!  ;)

I checked it with your sample files and other avi files,noise is still there like previous screen shot and video screen will be lock when playing but its not important for now.
Also I check some mp4 files and some time it have lag while playing specially for big files.
Metis its going to be exciting ;) keep going.
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on June 02, 2015, 05:29:47 pm
Quote
Now it's stable,No error!
:D  :D  :D

"Noise" should be only in [SDL-YUV]-Mode.

What do You get in [OpenGL]-Mode, when PowerOfTwo-Mode (= POT) is enabled for old/weak GraphicCards,
that do not support NON-PowerOfTwo-Textures (= NPOT) ?
A VideoImage, "something strange" (= not scaled), or only a white VideoScreen ?

Quote
some time it have lag while playing specially for big files.
This Version of FFPlay4Laz is not synchronized yet.
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: aradeonas on June 02, 2015, 08:24:08 pm
Hi metis,

I checked it again at I think it's not scaled and one time it just locked.I attached screen shot for you.

Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on June 04, 2015, 04:55:55 pm
@aradeonas

This is exactly, what You should get on a PC, whose GraphicCard does not support NON-PowerOf2-Textures (= NPOT).

What happened, is:

The App first tries to set up a Texture, that has the same Size as the VideoFrame (here: 640x480).
This is the easiest Case, and all the Rest of my Code runs perfectly (and fast!), including Shift-Zoom-Flip-Rotate the VideoImage.  :)

If this had failed, the App sets up on the second Try a Texture with the nearest PowerOf2-Dimensions (= POT) (here: 1024x512).
-> Problem: Texture-Dimensions <> VideoFrame-Dimensions, and You'll see the VideoImage, You got.

If this had failed again, the Error is caught, and Loading the VideoFile is interrupted.


Well, I already tried out some Ways to scale the VideoFrame to POT-Dimensions.
-> Problem #1:
Or with FFmpeg or with OpenGL, rescaling slows down the App (of course).
-> Problem #2:
Each Time, I rescale the VideoFrame to something or something near to the POT-Texture, I get
a VideoImage, but it's similar to the one You got.
Each Time, I rescale the VideoFrame exactly to the POT-Texture, I only get a white Screen.  :'(


=> Question:
Does it nowadays make Sense at all to write Code for GraphicCards, that do not support NON-PowerOf2-Textures,
or are those Cards still commonly in Use ?
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: aradeonas on June 04, 2015, 06:57:42 pm
Dear metis I dont know exactly about technical stuff about NPOT but I know my PC have on board graphical card and its not old (just around 2012) so library should support these devices and yes devices like this are many!

continue your good work and be sure Im waiting for testing ;)
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on June 04, 2015, 07:58:29 pm
O.K.  ;)
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on June 11, 2015, 02:00:32 pm
@aradeonas

One stupid Bug and some smaller Changes later...

Get the latest Version from my DropBox:

Now, You should get a proper VideoImage in [OpenGL]-Mode with any GraphicCard.

If the App runs in PowerOfTwo-Mode, "POT", Yellow on Magenta is shown.
(BTW: Thus You can check, if the currently used GraphicCard only supports POT-Textures.)

I've put the new EXE-File into the Dir 'FFPlay4Laz_NEW - 11.06.2015'.

Have Fun, and play around with it.
Check out, which VideoFiles are not supported with this FFmpeg-Version.
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: aradeonas on June 12, 2015, 10:01:37 am
OK I checked it and now we have better log but lag in the audio and video,so we have pause times in the middle of dog voice or music.

Continue your good work.
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on June 16, 2015, 05:08:15 pm
Quote
but lag in the audio and video,so we have pause times
This Version is not synchronized, nor threaded yet.
Until this is not done, the App will always behave that Way. ;)

-> For the Moment, You should only pay Attention to:
    - How the App and Files open->run->close; should be (very) fast and without failure (Error, Freeze, Crash).
    - How is the ImageQuality, and -Speed in OpenGL-Mode
    - Which Audio-/VideoCodecs are not supported  8-)
 
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: aradeonas on June 16, 2015, 11:50:39 pm
Quote
How the App and Files open->run->close; should be (very) fast and without failure (Error, Freeze, Crash).
No its better that before and behave good for files that I checked.
Quote
How is the ImageQuality, and -Speed in OpenGL-Mode
Bad,its like a slow motion ;) but its going better,two or three version ago its been better in speed.
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: aradeonas on July 31, 2015, 09:52:16 pm
Any news metis?
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on August 06, 2015, 04:34:33 pm
No, nothing special - just a litte SummerBreak from Progging:
I had to fix my PC, and in Summer I always do all the MaintenanceStuff my House, my Cars, etc. need.

BTW: Do You know an OpenSource-Project to read/write/clear Data from the Car's central Memory,
like e.g. VAG-COM (-> https://en.wikipedia.org/wiki/VAG-COM (https://en.wikipedia.org/wiki/VAG-COM)) does.

In the Meantime I enjoy my App playing my MusicClips with it:
-> The Clips open really fast one after another (faster than SMPlayer, or VLC)
-> The Sound is quite good with SDL -> Let's see, what Portaudio&ASIO will bring
-> The PreSync works better than I thought

=> Be patient, the next Release of FFPlay4Laz will be about in late Autumn...
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: aradeonas on August 06, 2015, 04:47:02 pm
Very good.
No unfortunately I dont know.
Have a good summer ;)
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on October 02, 2015, 04:26:54 pm
After a little SummerPause...

Hi to all, specially to aradeonas

Get the latest Version from my DropBox - added:

- AudioFiles-Support
  -> Now, You can play as well all AudioFile-Formats, that are supported by this FFmpeg-Version.
     => FFPlay4Laz has turned from a VideoPlayer to a MediaPlayer.

- Portaudio-AudioOutput
  - Currently this is done with the Portaudio-CallbackFunction; doing it with a Loop will be implemented later.
  - In this Version, You can't select the SoundCard/SoundDevice, so the Standard-Settings are used.
    (But I can do it by Code -> beautiful ASIO-Sound.)  :)

NOTE: Both are not fully worked out yet.
- Portaudio works best in [Loop]-Mode; sometimes a [Pause}->[Unpause] is required to make the Sound work properly.
- When changing between Audio- and VideoFiles, "Quickload" does not work always well. In this Case, You have to
  press [Stop]->[Close] before loading the next MediaFile.
- and, and, and, ... -> Long ToDo-List
But, hey, it's all under heavy Development.
For the Moment, I only need to know, if and how the App's Components run on other PCs.


@Brian_ch
The Day for updating the FFmpeg-Version is coming nearer.
Meanwhile I've downloaded newer FFmpeg-Wrappers from the Link You gave to me: ;) 
https://sourceforge.net/p/ultrastardx/svn/HEAD/tree/trunk/src/lib/ (https://sourceforge.net/p/ultrastardx/svn/HEAD/tree/trunk/src/lib/)

-> Question:
What do You think, with which Wrappers better to go on, e.g. for Future-CopyrightStuff:
With those from 'UltraStar', or with those from 'FFVCL':
http://www.delphiffmpeg.com/headers/ (http://www.delphiffmpeg.com/headers/)
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: aradeonas on October 03, 2015, 06:24:20 pm
Hi dear metis,

Happy to see a new version.
I tested it and it is much better,no weird error or crashing in avi file,just mp4.
very good at playing mp3 audio,good job.
Also no flicker in video playback!
2 problem:
1)crash on mp4 file.
2)too much lag in portaudio mode in audio and few lag in SDL.
Please let me change screen size so I can see output better.

As I always Im waiting for another update ;)

By the way, good readme, thank you!
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on November 11, 2015, 03:28:09 pm
@aradeonas

Quote
Please let me change screen size so I can see output better.
see below, but
not to forget: This is the SDL-YUV-Output = Low VideoQuality, but Speed. ;)


FFPlay4Laz - ConsoleVersion released  :D

-> see my Dropbox: 'FFPlay4Laz\FFPlay4Laz_11.11.15 - 12.00\FFPlay4Laz_Console.exe'

The current ConsoleVersion of FFPlay4Laz is a direct Port of the tutorial08.c-File from
Dranger Tutorial (http://dranger.com/ffmpeg/) to FPC.
"Direct" means, that it's translated as close as possible to the original C-Code.

It has all Elements of the original C-File, including AV-Synchronization.

> Only Differences:
- the SDL-Screen is resizable -> ToDo: Resize the VideoImage accordingly.
  (= "Please let me change screen size so I can see output better.")
- the AudioSync-Code is replaced by a very simplified one, because the original One
  (or at least my translation of it) produces Clicks -> ToDo: Find the Reason.
- the Seek is not implemented yet -> Coming soon !
- Key- and MouseFunctions added; currently only <Esc> is used to close the App.

> Known Bug: Sometimes the App shuts down by itself after a While. :(

Note: This Version does not play AudioOnly-Files (<-> GUI-Version) yet, but it will.


Try it out !
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: aradeonas on November 12, 2015, 09:30:49 am
Very good metis.

I like the console version,it play without any lag or problem and video and audio quality is good but GUI version is not good in compare of console version,it has lag and audio problem.
It is becoming a good player ;)
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on November 17, 2015, 06:32:47 pm
Quote
I like the console version
Me, too - Finally my Intention is:
To have a cute, little AV-Player, that opens and seeks really FAST, faster than MPlayer or VLC,
with real good Sound (-> Portaudio), and the ability to reproduce anything (-> av4all).

Quote
but GUI version is not good in compare of console version,it has lag and audio problem
Of course not. This is, because the GUI-Version still has NO real AV-Synchronization; it only got "some Kind of Sync",
that served to work out and check out several Ways, how to do the Audio&Video-Output.
Since I've started the Console-Version, there was no further development done on the GUI-Version.

For the Moment I go on with the ConsoleVersion...

Get the last Release of FFPlay4Laz - ConsoleVersion
-> see my Dropbox: 'FFPlay4Laz\FFPlay4Laz_17.11.15 - 15.28\FFPlay4Laz_Console.exe'

Changes:

> Some smaller corrections and improvements on the Code.
  -> Now, the ConsoleApp should open faster and run more stable (but sometimes it still may shut down by itself when playing).

> 2 Bugs in my Translation of the Audio-C-Code fixed.
  -> Now, the ConsoleApp runs with the original tutorial08.c-AudioCode, ported to FPC (of course).
  NOTE: Some say, this AudioSync is buggy and does not always work correctly.
             -> Let's try it out anyway; anything may be improved in the Future.

> SEEK implemented.
  -> Press <Left>/<Right> to seek -10.0/+10.0 Secs. or <Up>/<Dn> to seek +60.0/-60.0 Secs.
       (This is just, what the original Dranger-Code does.)
  -> Press <PageUp>/<PageDn> to seek +180.0/-180.0 Secs.
       (This is additionally implemented.)
  NOTE: - Currently the Seek is very buggy and does NOT work properly with all MediaFile-Formats;
          specially Seeking repeatedly or Seeking BACKwards tend to fail, and the App shuts down.
        - Currently there is no Code implemented to limit the Seek -> when Seeking beyond BOF/EOF, the App shuts down.

> Implementation of Portaudio-Audio-Output started.
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: aradeonas on November 18, 2015, 08:48:10 am
Quote
Me, too - Finally my Intention is:
To have a cute, little AV-Player, that opens and seeks really FAST, faster than MPlayer or VLC,
with real good Sound (-> Portaudio), and the ability to reproduce anything (-> av4all).
I like it!
Then I will help you for a very cute UI ;)
http://forum.lazarus.freepascal.org/index.php?topic=29038.0 (http://forum.lazarus.freepascal.org/index.php?topic=29038.0)
About seek its good and fast,CPU usage is low and good too but this version will crash suddenly much more but these are bugs and you will easily kill them.
Continue!
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on November 20, 2015, 03:34:44 pm
@aradeonas

Quote
Then I will help you for a very cute UI
Thank You - I'll check that.  :)
 
Get the last Release of FFPlay4Laz - ConsoleVersion from my DropBox
-> 'FFPlay4Laz\FFPlay4Laz_20.11.15 - 14.15\FFPlay4Laz_Console.exe'

Changes:
> Readme-File for the ConsoleVersion added = 'README_Console.txt'
> Seek works better - at least FOREwards; when Seeking BACKwards, the AV-Synchronization gets lost.  %)
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: aradeonas on November 21, 2015, 07:08:54 am
OK.
I test this version and it is good but it will crash in the middle of playback of many of files.
Waiting for next ;)
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: mercury on November 24, 2015, 04:39:07 pm
@metis
I am making something like this (using the whole day) :
Code: Pascal  [Select][+][-]
  1. unit Unit1;
  2.  
  3. {$MODE Delphi}
  4.  
  5. interface
  6.  
  7. uses
  8.   Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, LCLProc,
  9.  
  10.   {$IFDEF MSWINDOWS} Windows, {$ENDIF}
  11.   BGRABitmap, BGRABitmapTypes,
  12.   FFUtils,
  13.   libavcodec, libavcodec_avfft, libavdevice,
  14.   libavfilter, libavfilter_avcodec, libavfilter_buffersink, libavfilter_buffersrc, libavfilter_formats,
  15.   libavformat, libavformat_avio, libavformat_url,
  16.   libavutil, libavutil_audio_fifo, libavutil_avstring, libavutil_bprint, libavutil_buffer,
  17.   libavutil_channel_layout, libavutil_common, libavutil_cpu, libavutil_dict, libavutil_error,
  18.   libavutil_eval, libavutil_fifo, libavutil_file, libavutil_frame, libavutil_imgutils,
  19.   libavutil_log, libavutil_mathematics, libavutil_md5, libavutil_mem, libavutil_opt,
  20.   libavutil_parseutils, libavutil_pixdesc, libavutil_pixfmt, libavutil_rational,
  21.   libavutil_samplefmt, libavutil_time, libavutil_timestamp, libswresample, libswscale;
  22.  
  23. type
  24.  
  25.   { TForm1 }
  26.  
  27.   TForm1 = class(TForm)
  28.     Button1: TButton;
  29.     procedure Button1Click(Sender: TObject);
  30.   private
  31.     { private declarations }
  32.   public
  33.     { public declarations }
  34.   end;
  35.  
  36. var
  37.   Form1: TForm1;
  38.  
  39. implementation
  40.  
  41. {$R *.lfm}
  42.  
  43. function main(filename: string): integer;
  44. var
  45.  
  46.   pFormatCtx: PAVFormatContext;
  47.   pCodecCtx: PAVCodecContext;
  48.  
  49.   filter_graph: PAVFilterGraph;
  50.   video_stream_index: integer = -1;
  51.   last_pts: int64; // = AV_NOPTS_VALUE;
  52.  
  53.   ret, got_picture: integer;
  54.   pCodec: PAVCodec;
  55.  
  56.   packet: TAVPacket;
  57.   pFrame: PAVFrame;
  58.   pFrameYUV: PAVFrame;
  59.   pFrameFilt: PAVFrame;
  60.  
  61.   out_buffer: array of char;
  62.  
  63.   img_convert_ctx: PSwsContext;
  64.  
  65.   p0, p1, p2, pp0, pp1, pp2: PByte;
  66.   x, y: integer;
  67.   pBGRApixel0: PBGRApixel;
  68.   HSLAPixel0: THSLAPixel;
  69.   Bitmap0: TBGRABitmap;
  70.   Rect0: TRect;
  71. label
  72.   TheEnd;
  73. begin
  74.   pFrame := av_frame_alloc();
  75.   pFrameYUV := av_frame_alloc();
  76.   pFrameFilt := av_frame_alloc();
  77.   pFormatCtx := avformat_alloc_context();
  78.  
  79.   if not Assigned(pFrame)
  80.     or not Assigned(pFrameFilt)
  81.     or not Assigned(pFormatCtx) then begin
  82.     Writeln(ErrOutput, 'Could not allocate frame');
  83.     Result := 1;
  84.     Exit;
  85.   end;
  86.  
  87.   last_pts := AV_NOPTS_VALUE;
  88.   av_register_all();
  89.   avfilter_register_all();
  90.  
  91.   // open file
  92.   if avformat_open_input(@pFormatCtx, PAnsiChar(ansistring(filename)), nil, nil) < 0 then begin
  93.     av_log(nil, AV_LOG_ERROR, 'Cannot open input file\n');
  94.     Result := -1;
  95.     Exit;
  96.   end;
  97.   if avformat_find_stream_info(pFormatCtx, nil) < 0 then begin
  98.     av_log(nil, AV_LOG_ERROR, 'Cannot find stream information\n');
  99.     Result := -1;
  100.     Exit;
  101.   end;
  102.   // select the video stream
  103.   video_stream_index := av_find_best_stream(pFormatCtx, AVMEDIA_TYPE_VIDEO, -1, -1, @pCodec, 0);
  104.   if video_stream_index < 0 then begin
  105.     av_log(nil, AV_LOG_ERROR, 'Cannot find a video stream in the input file\n');
  106.     Result := -1;
  107.     Exit;
  108.   end;
  109.   pCodecCtx := PPtrIdx(pFormatCtx.streams, video_stream_index).codec;
  110.   av_opt_set_int(pCodecCtx, 'refcounted_frames', 1, 0);
  111.   // init the video decoder
  112.   if avcodec_open2(pCodecCtx, pCodec, nil) < 0 then begin
  113.     av_log(nil, AV_LOG_ERROR, 'Cannot open video decoder\n');
  114.     Result := -1;
  115.     Exit;
  116.   end;
  117.  
  118.  
  119.   SetLength(out_buffer, avpicture_get_size(AV_PIX_FMT_RGB24, pCodecCtx.Width, pCodecCtx.Height));
  120.   avpicture_fill(PAVPicture(pFrameYUV), @out_buffer, AV_PIX_FMT_RGB24, pCodecCtx.Width, pCodecCtx.Height);
  121.   av_new_packet(@packet, pCodecCtx.Width * pCodecCtx.Height);
  122.  
  123.   DebugLn('File Information---------------------------------');
  124.   av_dump_format(pFormatCtx, 0, PAnsiChar(ansistring(filename)), 0);
  125.   DebugLn('-------------------------------------------------------------------------------');
  126.  
  127.   img_convert_ctx := sws_getContext(pCodecCtx.Width, pCodecCtx.Height, pCodecCtx.pix_fmt,
  128.     pCodecCtx.Width, pCodecCtx.Height, AV_PIX_FMT_RGB24, SWS_BICUBIC, nil, nil, nil);
  129.  
  130.   Bitmap0 := TBGRABitmap.Create(pCodecCtx.Width, pCodecCtx.Height);
  131.   //Rect0 := Rect(0, 0, pCodecCtx.Width, pCodecCtx.Height);
  132.   Rect0.Top := 0;
  133.   Rect0.Left := 0;
  134.   Rect0.Right := pCodecCtx.Width;
  135.   Rect0.Bottom := pCodecCtx.Height;
  136.   X := 0;
  137.  
  138.   while av_read_frame(pFormatCtx, @packet) >= 0 do begin
  139.     if packet.stream_index = video_stream_index then begin
  140.       ret := avcodec_decode_video2(pCodecCtx, pFrame, @got_picture, @packet);
  141.       if ret < 0 then begin
  142.         DebugLn('Decode Error.');
  143.         Exit;
  144.       end;
  145.       if got_picture <> 0 then begin
  146.         // sws_scale(img_convert_ctx, pFrame.Data, pFrame.linesize, 0,
  147.         //   pCodecCtx.Height, pFrameYUV.Data, pFrameYUV.linesize);
  148.         // pFrameYUV.data;
  149.         // CopyMemory(Bitmap0.Bitmap.RawImage.Data, pFrame.Data[0], pCodecCtx.Width * pCodecCtx.Height);
  150.         p0 := pFrame.Data[0];
  151.         p1 := pFrame.Data[1];
  152.         p2 := pFrame.Data[2];
  153.  
  154.         pBGRApixel0 := Bitmap0.Data + Bitmap0.NbPixels - 1;
  155.         for y := 0 to pFrame.Height - 1 do begin
  156.           Inc(p0, pFrame.linesize[0]);
  157.           Inc(p1, pFrame.linesize[0]);
  158.           Inc(p2, pFrame.linesize[0]);
  159.           for x := 0 to pFrame.Width - 1 do begin
  160.             //HSLAPixel0 := BGRAToHSLA(pBGRApixel0^);
  161.             //HSLAPixel0 := HSLA(p0^, p1^, p2^);
  162.  
  163.             pBGRApixel0^ := BGRA(p0^, p1^, p2^, 0);
  164.             //HSLAToBGRA(HSLAPixel0);
  165.             Dec(pBGRApixel0);
  166.             Dec(p0);
  167.             Dec(p1);
  168.             Dec(p2);
  169.           end;
  170.           Inc(p0, pFrame.linesize[0]);
  171.           Inc(p1, pFrame.linesize[0]);
  172.           Inc(p2, pFrame.linesize[0]);
  173.         end;
  174.  
  175.         Form1.Canvas.CopyRect(Rect0, Bitmap0.Canvas, Rect0);
  176.  
  177.         X += 1;
  178.         //Form1.Caption := IntToStr(X) + ' - ' + IntToStr(av_rescale_q(pFrame.pts, AV_TIME_BASE_Q, AV_TIME_BASE_Q));
  179.         Form1.Caption := IntToStr(X) + ' - ' + IntToStr(pFrame.pts);
  180.         Application.ProcessMessages;
  181.         Sleep(10);
  182.       end;
  183.     end;
  184.     av_free_packet(@packet);
  185.   end;
  186.   Bitmap0.Free;
  187.  
  188.  
  189.   TheEnd: ;
  190.   avfilter_graph_free(@filter_graph);
  191.   avcodec_close(pCodecCtx);
  192.   avformat_close_input(@pFormatCtx);
  193.   av_frame_free(@pFrame);
  194.   av_frame_free(@pFrameYUV);
  195.   av_frame_free(@pFrameFilt);
  196.  
  197.   if (ret < 0) and (ret <> AVERROR_EOF) then begin
  198.     Writeln(ErrOutput, Format('Error occurred: %s', [av_err2str(ret)]));
  199.     Result := 1;
  200.     Exit;
  201.   end;
  202.  
  203.   Result := 0;
  204. end;
  205.  
  206. { TForm1 }
  207.  
  208. procedure TForm1.Button1Click(Sender: TObject);
  209. begin
  210.   try
  211.     ExitCode := main(ParamStr(1));
  212.   except
  213.     on E: Exception do
  214.       Writeln(ErrOutput, 'Error: ' + E.ClassName + ': ' + E.Message);
  215.   end;
  216. end;
  217.  
  218. end.
  219.  
But ‘sws_scale’ seems doesn’t work.
I don’t want YUV format. I want BGR or RGB and do something else with TBGRABitmap.
And is there any way to copy frame data to Bitmap0 by use ‘CopyMemory’.
I think to ‘for’ statement is too slow.
Also I want control the FPS and the audio work.
Could you please improve my code.


I use :
ffmpeg-delphi-pascal-headers-2.5.4
ffmpeg-2.5.4
MinGW-MSYS Bundle(mingw-msys-core-4.7.2-x86)
yasm-1.2.0-win32
lazarus-1.4.2-fpc-2.6.4-win32

Title: Re: NON(!)-EXE FFPlay4Laz
Post by: Brian_ch on November 25, 2015, 01:04:05 am
@Brian_ch
The Day for updating the FFmpeg-Version is coming nearer.
Meanwhile I've downloaded newer FFmpeg-Wrappers from the Link You gave to me: ;) 
https://sourceforge.net/p/ultrastardx/svn/HEAD/tree/trunk/src/lib/ (https://sourceforge.net/p/ultrastardx/svn/HEAD/tree/trunk/src/lib/)

-> Question:
What do You think, with which Wrappers better to go on, e.g. for Future-CopyrightStuff:
With those from 'UltraStar', or with those from 'FFVCL':
http://www.delphiffmpeg.com/headers/ (http://www.delphiffmpeg.com/headers/)

Hi, I'm really sorry for the very very long delay....

As noted in the source files, the usdx headers are LGPL (like ffmpeg), and the license of the delphiffmpeg headers look like a copy of the two clause BSD license (https://opensource.org/licenses/BSD-2-Clause), I don't think one would have problems with that, the greater worry would be the license of FFmpeg itself, the legal info in their site is an interesting read:
http://ffmpeg.org/legal.html

But I'm not a lawyer and in my country the laws aren't very strict about this, so don't blame me if you get arrested ! :D

I never used the delphiffmpeg headers you linked, so I can't compare the two from experience. The Usdx headers are being tested in Linux, Windows and Mac OSX (instead of just Win 32), and are more up-to-date, but I don't know anyone who has tested they with Delphi like the delphiffmpeg one (but I doubt there would be problems with this).

One bad thing is that I don't know about other projects that use the usdx headers (other than your FFPlay4Laz), although I also don't know if there are much people using the delphiffmpeg headers either.
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on November 25, 2015, 06:19:31 pm
@aradeonas

Quote
will crash in the middle of playback
This is a known Issue, and will be fixed later; for the Moment I do Outputs and the Seek.

Quote
Waiting for next
Here it is :D -> Check my Dropbox, added:
FFPlay4Laz-ConsoleVersion, compiled with Portaudio-AudioOutput = FFPlay4Laz_Console_Pa.exe
Notes: - In this Version, Portaudio will always use the STANDARD-AudioDriver, that You've selected on Your Platform.
            - The Portaudio-Wrapper used, is the one from'UOS' by Fred vS.
               (BTW: All the Rest is not UOS, because I use the Pa-Audio-CallbackFunction.)
            - Still struggling around with the Seek.  %)


@Brian_ch

Thanks a lot for Your Info - I'll check Your Links.

Quote
really sorry for the very very long delay...
Where I live, everything is very, very delayed; this is no Problem at all for me, because:
'FFPlay4Laz' is NOT a commercial Project; I do it for Fun, and
it's for those, who are interested in getting deeper into the World of FFmpeg.

Quote
so don't blame me if...
For sure, not.  8)

Quote
I never used the delphiffmpeg headers you linked
The FFVCL-Wrapper, I only used once, when I did a Variation of the 'filtering_video'-Example from FFVCL,
to demonstrate the Usage of FFmpeg quickly (see my Post of this Thread from March 11, 2015).
Both Versions of 'FFPlay4Laz', the Console and the GUI, still use the Headers from 'USDX'.

Quote
that I don't know about other projects that use the usdx headers
Me neither; therefore I started to write my own AV-Player.

Quote
The Usdx headers are being tested in Linux, Windows and Mac OSX...and are more up-to-date
So we already got two important criterias.  ;)


@mercury
Quote
using the whole day
Better not to tell, how many "whole days" I already spent on it.

Your Code is basically, what comes with the FFVCL-Examples.
-> For FPS-Calculation, have a Look at Dranger-Code (I like this Code better than the one from 'USDX').
-> For BGR/RGB, see USDX -> SDL-RGB-Surface.
-> For "copy frame data to Bitmap0", see grape3D.
-> For 'sws_scale' see the three above.
-> For Audio, see Dranger + USDX + OvoPlayer
(BTW: My GUI does not use 'TBGRABitmap'; for Comfort I use the 'LazOpenGLControl'.)


@all

Meanwhile the Dranger-Tutorial has been updated, see:
http://dranger.com/ffmpeg/ (http://dranger.com/ffmpeg/) -> "up to date as of February 2015"

I had a quick Look at it:
The ProgramStructure, the Strategie, did not change: It's the same as in the previous Tutorial, BUT:
it shows and explains(!) the use of NEWER FFmpeg-Functions.
The Pascal-Counterparts of the updated Version can be easily found in the FFVCL-Examples, see:
http://www.delphiffmpeg.com/headers/ (http://www.delphiffmpeg.com/headers/), e.g. in 'filtering_video'.

Note: Former 'tutorial08.c' is now 'tutorial07.c'.

Title: Re: NON(!)-EXE FFPlay4Laz
Post by: mercury on November 26, 2015, 06:52:56 am
@ metis
Could you just give me a demo of playing video with sound.
I don’t want waste too much time on it. Actually I think ffmpeg is really hard to study.
BTW you program have a very bad sound synchronism. Almost every file I tested, the sound always discontinuous. Which sound library did you use?
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: aradeonas on November 26, 2015, 01:27:25 pm
Very hood metis.
I tested it and now I have a good play functionality for video and audio.
As you mentioned it has problem with seek and also resizing the windows cause problem.

Waiting for next ;)
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on November 27, 2015, 05:34:22 pm
@mercury
Quote
Could you just give me a demo of playing video with sound.
The Demos are in my DropBox
-> 'FFPlay4Laz_Console.exe', 'FFPlay4Laz_Console_Pa.exe' and 'FFPlay4LazWin32+Console.exe'.

Quote
I don’t want waste too much time on it.
This was exactly my first Impression, when I saw Your Code.  ;D

Quote
Actually I think ffmpeg is really hard to study.
But finally, this is the basic Idea of this Thread.
I'll explain, and show You, whatever You want, when Your Questions get (much) more specific.

Quote
BTW you program have a very bad sound synchronism...
For sure, You only tried the GUI-Version. As already mentioned several Times in this Thread:
The current GUI-Version has NO real AV-Synchronization; it does only "some Kind of Sync", that
helped to work out(!) the Audio/Video-Outputs, because:
As long as I can't hear and see anything, I cannot start writing any Sync-Code (at least I cannot). 

Quote
Which sound library did you use?
SDL + Portaudio.
> for the DLL-Files, see my DropBox.
> for the Wrapper, see my updated 'README_Console.txt' -> "It uses the following OpenSource-Libraries and -PascalWrapper"


@aradeonas

Quote
Very hood metis.
This I don't understand :( - Should be something good.

Quote
also resizing the windows cause problem.
The SDL-VideoScreen is NOT resizeable yet; what Problem do You mean ?

Quote
As you mentioned it has problem with seek + Waiting for next
Here it is = Released 27.11.15 - 15.16, Changes:
> Seek works much better now, BACKwards too -> Check it: This is, what I call a FAST Seek.
> 'README_Console.txt' updated, some Copyright-Infos added.

Notes:
- Still the App shuts down after Playing a While, and does NOT work well with some MediaFile.
- Seek works very fast, but on some Files it fails totally.  :'(
-> ToDo.  :)
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: aradeonas on November 28, 2015, 06:37:29 am
Quote
This I don't understand :( - Should be something good.
Yes,Good  :D

Metis this is a folder in DropBox and you should make a share link and send them to mercury or who you want to see the work.
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on December 01, 2015, 02:46:29 pm
@aradeonas + mercury

Quote
you should make a share link and send them
Oh, sorry, sorry, sorry, especially to mercury.  %)
I really thought, my DropBox was already set up that Way, that anyone can download from it.  ::)
(I like to mistreat my PC at Home, but I'm not that familiar with the latest Internet-Stuff.)

Afaik, to make the "share link" to mercury (or to anyone else), I need HIS e-Mail-Adress.

Here is the next Release: see FFPlay4Laz_01.12.15 - 12.48, Changes:
> Sound should be better; maybe, it runs less stable, now -> ToDo.
> Pause/UnPause started
  -> Works, but Pause still is too delayed; Unpause has some AudioSync-Problems -> ToDo.
> 'README_Console.txt' modified; 'credits.txt' and 'contributors.txt' added.
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: aradeonas on December 01, 2015, 05:53:31 pm
Hi!
I checked it and I cant feel any changes and it still has suddenly close problem.

PS. I send you a personal message with link and stuff.
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on December 04, 2015, 04:46:08 pm
@aradeonas

Quote
I checked it and I cant feel any changes
Differences in Sound, like SDL/Portaudio, ASIO/not ASIO, fine Clicks, etc. may be only audible with
according Equipment - with PC-Speakers or low Quality AudioAmps for sure not.
For not spending too much Money for a HiEnd-PA-Amp+LoudSpeakers (and not killing my Neighbours), I use: 
SoundCard: SoundBlaster Audigy 24bit -> Headphone-Amp -> AKG-Headphone (-> good Ears).
-> THEN You really get Differences in Sound ! :o It's like looking through a dirty/clean Window.

Quote
it still has suddenly close problem
= Known Issue - I'm on it. The current File ran max. 2,5h on my PC with MPG.
My Impression is, that it plays Movies longer than MusicClips (don't ask me why). %)   
The Seek as well seems to work better with Movies than with MusicClips.
I got Files, where the Seek works perfectly, whilst it fails totally with others. %)

Thanks for Your Mail. I really appreciate, that You try to help an Internet-Dinosaur, like me. :)
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: aradeonas on December 05, 2015, 09:25:38 am
Quote
= Known Issue - I'm on it. The current File ran max. 2,5h on my PC with MPG.
My Impression is, that it plays Movies longer than MusicClips (don't ask me why). %)   
The Seek as well seems to work better with Movies than with MusicClips.
I got Files, where the Seek works perfectly, whilst it fails totally with others. %)
It just randomly crash in small or large files and Im sure you will solve it soon.
Quote
Thanks for Your Mail. I really appreciate, that You try to help an Internet-Dinosaur, like me.
My pleasure to help  :D
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on December 07, 2015, 03:53:27 pm
@aradeonas

Here is the next Release: see FFPlay4Laz_07.12.15 - 12.16, Changes:
- Some CodeCleaning and -Restructuring done
   -> Now, it should run stable (went all through a 13GB MPG-File, 3h45Min., until EOF). :)
- VideoImage pauses a bit faster.
- EOF-Handling started.
> Known Bugs: - AV-Sync gets lost, after Seeking to EOF.
                         - Seek is still weak: with some Files it works, with others it's erroneous. :-X
                         - Slight Clicks when Seeking, and when UnPausing.
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: aradeonas on December 07, 2015, 04:01:26 pm
Yes you are right it now play very good and easy.Well done.
If you add a key down seeking it can be very good so when you push key down and keep it in that way it forward fastly .

Looking forward for the next version ;)
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on December 21, 2015, 12:46:16 pm
@aradeonas

Quote
when you push key down and keep it
Putting a 'SDL_EnableKeyRepeat()' would be the easiest Way to achieve this, but
without additional Code, ALL KeyDowns (e.g. <Space> to Pause/Unpause) are affected, as well.

At the Moment, I try to work out a GENERAL FFmpeg-Core, or -Engine for FPC;
Stuff like 'KeyRepeat' is better done outside of it.

In the Meantime, I've ported the updated C-File from DrangerTutorial (= 'tutorial07.c') to FPC.
It opens even faster, runs more stable, and first of all: it works with much more recent FFmpeg-DDLs.
I still got some minor Problems to be solved, but X-Mas is coming, so be patient with the first Release. :)


Speaking of X-Mas: Here is my X-Mas-Present for aradeonas & mercury:

In the Attachement You'll find my Port of the Dranger-C-File 'tutorial08.c' (= BEFORE being "up to date as of February 2015").
-> Any Suggestion, Correction, Improvement, BugNotice, etc. on this Code is appreciated.
But, keep in Mind:
it's NOT a complete AV-Player;
it's only the MINIMUM of Code You need to open, sync and output the Video-, and AudioStream (and to do a Seek), and
it's kept "as near as possible" to the original C-File, so that everyone can easily compare the two Languages.

-> Everyone may feel free to build up his own FFmpeg-MediaPlayer out of it.


Merry X-Mas to all.  O:-)
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: aradeonas on December 22, 2015, 01:47:57 pm
@metis thank you and very good.
Have a good XMas.
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on December 29, 2015, 04:58:54 pm
@aradeonas

see my Dropbox -> 'FFPlay4Laz\FFPlay4Laz_01_29.12.15 - 15.42'
to get the next Release of my FFPlay4Laz-ConsoleVersion #1
-> No big Differences; only some minor Changes done.

AND:

see my Dropbox -> 'FFPlay4Laz\FFPlay4Laz_02_29.12.15 - 15.44'
to get the FIRST Release of my FFPlay4Laz-ConsoleVersion #2 with UPDATED FFmpeg-DLLs,

Note: ALL Files and DLLs have changed (except of the the PortAudio-DLL),
      therefore You'll only find a ZIP-File in the Directory to get started with the new Version.

ConsoleVersion #2 of FFPlay4Laz is based(!) on the tutorial07.c-File from Dranger Tutorial
(http://dranger.com/ffmpeg/ (http://dranger.com/ffmpeg/)). It's using up to Date FFmpeg-Functions, like
'avformat_open_input()', 'avcodec_decode_video2()' and 'avcodec_decode_audio4()';
the FFmpeg-Wrapper are taken from 'FFVLC' (http://www.delphiffmpeg.com/headers/ (http://www.delphiffmpeg.com/headers/)).

@Brian_ch
Finally I took the FFmpeg-Wrapper from 'FFVLC' to get started with updated FFmpegs, because
one FFmpeg-Funktion, that is essential for this Kind of Player, is missing in the newer
'USDX'-Wrapper (or, I didn't find it): 'av_gettime()'.

ConsoleVersion #2 should do quite the same like the first one, only with much more Codecs.

One tiny, but grave Problem left:
AudioDecoding does not always work well yet; in this Case, You'll get a nice Video with some noisy Sound.

-> ToDo in 2016.  :D
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: aradeonas on January 02, 2016, 09:58:43 am
Hi metis and happy new year.
I checked the new version and : Oh a lot of noise! noisssse :D
But no crash or problem in video just as before.
I hope in this year we make a good Player.
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on January 21, 2016, 03:41:36 pm
@aradeonas

Quote
I hope in this year we make a good Player.
First Step done: FFmpeg-AudioResampler added -> 'avcodec_decode_audio4()' works !  :D
-> Check my DropBox: FFPlay4Laz_02_21.01.16 - 14.22

Have a Look at the current State of the UltraStar-Project
https://github.com/skerit/ultrastardx/ (https://github.com/skerit/ultrastardx/), and go to:
'src\media\UAudioDecoder_FFmpeg.pas' -> 'TFFmpegDecodeStream.DecodeFrame()'
  -> "{$IF LIBAVCODEC_VERSION >= 53025000}" ...
You'll see, that You'll see nothing: No 'avcodec_decode_audio4()' implemented yet.  :D :D :D

Notes:
- 'FFPlay4Laz_Console_01' is depreciated; use 'FFPlay4Laz_Console_02' instead.
- Pausing for a longer Time still causes AV-Sync-Problems.
- The Seek is faster and more stable with PortAudio (= 'FFPlay4Laz_Console_02_Pa.exe').
- All README-Files revised, and moved to 'FFPlay4Laz - DOCS'.
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: aradeonas on January 26, 2016, 03:44:53 pm
@metis!
Excellent.
 Sound is very good and I got no problem in my tests. Still problem in forwading and moving in video but changes you amde for audio make it very good.

Waiting for next one ;)
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on January 28, 2016, 05:34:57 pm
@aradeonas

Quote
Still problem in forwading and moving in video
Please, describe this "problem" more detailed.
In my Tests, the Version with SDL-AudioOutput crashes quite often on the FIRST Seek after Opening; once it got over this, it works. The Version with Pa-AudioOutput opens&seeks fine.
-> I'm on it, to get this fixed, but finally I'm more interested in Portaudio.

Quote
changes you amde for audio make it very good
These Changes have to be done, when using 'avcodec_decode_audio4()'.
(BTW: Decoding AudioFrames was much more simple with 'avcodec_decode_audio2()'.)

The AudioResampler still needs some more WorkOut, but obviously it already runs quite well.
For those, who are interested in, how it's done, have a Look here:
https://github.com/FFmpeg/FFmpeg/blob/release/0.10/ffplay.c (https://github.com/FFmpeg/FFmpeg/blob/release/0.10/ffplay.c)
-> go to "static int audio_decode_frame(VideoState *is, double *pts_ptr)"
    -> What's still to be worked out, is: "swr_set_compensation(".
This is (mainly), what I translated to FPC, to make 'avcodec_decode_audio4()' work.

Quote
Waiting for next one
Coming soon.  :)
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: aradeonas on January 28, 2016, 08:11:05 pm
Quote
Please, describe this "problem" more detailed.
It doesnt support fast forward so I can keep key down and it goes fast, it actually write logs and reach to the end of the file and keep saying its the end of the file ;)
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: Frank on January 30, 2016, 10:46:05 pm
@metis
  Hi ! It appears we have been working on similar projects. Currently I have been working at implementing MP4/AAC for uos for my own Delphi converted to Lazarus projects. I also have projects (Delphi Win32) that use ffmpeg.exe that I want to convert to Lazarus/Fpc3.0. If it would be possible to assist/build on your efforts, I would be glad to assist. My goal is code for both Win/Linux. It makes more sense to work on unified result than several going in different directions...
  Let me know if I can help...
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on February 15, 2016, 03:21:58 pm
Sorry for answering so late, but last Week my really hard working HDD deceased (-> R.I.P.). O:-)
Before going on with this Project, I have to recover, restore and reinstall my entire System. :'(
One and only Benefit: I took the Opportunity to update to Lazarus v1.4.4. :D

Anyway, get the last Version before my Disk failed from my DropBox: FFPlay4Laz_02_15.02.16 - 13.51:
> Seek revised
  -> Now, the Seek is stable with SDL-Audio, too; Audio is slightly muted, when Seeking.

@aradeonas
Quote
It doesnt support fast forward so I can keep key down and it goes fast
I see, You really insist on the KeyRepeat-Feature. Though it is not projected at the Moment, I'll implement it for You - or maybe, Frank does...


@Frank
Quote
I have been working at implementing MP4/AAC for uos for my own Delphi converted to Lazarus
Initially, I intended to do the same, but then I decided to do something different.

Quote
I also have projects (Delphi Win32) that use ffmpeg.exe
For PascalCode to Transcode & Play via FFmpeg-EXEs, see e.g. 'WinFF':
http://www.winff.org (http://www.winff.org)

Quote
If it would be possible to assist/build on your efforts + Let me know if I can help...
Any Assistance is appreciated -> Take the Code, I published in the Attachment of my Thread, Dec. 21, 2015.
Though the current 'FFPlay4Laz' suffered some "slight Modifications" by me, the basic Structure, specially the Way, how the AV-Synchronization is done, did not change - Here some Ideas for You:
- Add KeyRepeat
- Add Pause/Unpause
  I already did (or better started) that, but up to now, it's not really satisfying, because:
  when Unpausing after a longer Period, the Audio-Sync gets lost - may be, You'll find a better Solution.
- Write a FFmpeg-Wrapper for 'FFPlay4Laz', like 'OvoPlayer' did for Audio only, see:
  https://github.com/varianus/ovoplayer/tree/master/src/import-engines (https://github.com/varianus/ovoplayer/tree/master/src/import-engines), and
  open 'src\import-engines\ffmpeg.pas'.

And last, but not least:
'FFPlay4Laz' works quite fine, but in Order to turn it to a real "FFPlay for Lazarus",
the SDL-Threads, -Timers, and -Events could/should be replaced by Lazarus-Components.

Looking forward to Your Reply.

Title: Re: NON(!)-EXE FFPlay4Laz
Post by: Frank on February 16, 2016, 07:53:42 pm
@metis  Thank you for your reply.

I used "DrangerTutorial08.c2FPC.lpr.zip" and with header files from "ultrastardx-1.1-src.tar.gz" the program compiled.
It, however, required the use of your version 1 dll's (avcodec-52.dll, etc).
I took a look at your source & found it interesting (I always enjoy studying/learning from others).
I would be glad to assist (as soon as I'm finished with Uos).

  1/ I agree, that Dynamic Lib Header files are needed,
  2/ then "FFPlay4Laz" becoming a thread(/file) to be used in program with,
  3/ the ability to pass THandle of window to thread, & video being displayed on that window.
  4/ "Pause/UnPause", I''ll attempt to make it just part of my learning curve  ;)

  If you are in agreement, I could start the above modifications, albeit after my work with Uos.

Title: Re: NON(!)-EXE FFPlay4Laz
Post by: aradeonas on February 18, 2016, 07:41:37 am
Quote
I see, You really insist on the KeyRepeat-Feature. Though it is not projected at the Moment, I'll implement it for You - or maybe, Frank does...
Quote
'FFPlay4Laz' works quite fine
Yes but we need this features to even work with it in real situtaions. Playing video is the master part but not all it need.

As always Im waiting for next version.
Good job dear Metis.
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on March 11, 2016, 02:18:31 pm
@aradeonas

"fast forward" - Here it is, see my DropBox -> 'FFPlay4Laz_02_11.03.16 - 11.57:  :)

> Added:
  - 'FastSeek': Press <b> for 'fast BACKward'; press <f> for 'fast FORward'
                        (if the Stream is paused, it goes much faster, but w/o Sound).
  - 'RepeatedSeek': Keep one of the SeekKeys pressed - after 500ms the Seek starts going repetitiv.


@Frank

Quote
1. It, however, required the use of your version 1 dll's
2. I took a look at your source...I always enjoy studying/learning from others
3. the ability to pass THandle of window to thread, & video being displayed
4. I could start the above modifications, albeit after my work with Uos

ad 1. You find them in my DropBox -> 'FFPlay4Laz\FFPlay4Laz_01 - RELEASED_29.12.15 - 15.42 (DEPRECIATED)'.

ad 2. Me, as well - In this Case, most You studied/learned is from Dranger; I only translated it to FPC.

ad 3. No Need for it; in 'FFPlay4Laz - GUI-Version', the VideoDATA itself is passed to SDL and the LazOpenGLControl.

ad 4. Waiting...
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: aradeonas on March 12, 2016, 11:02:32 am
I like it @metis. Very good.
Waiting for the next one ;)
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on April 26, 2016, 02:21:18 pm
@aradeonas

Quote
Waiting for the next one

Here it is, see my DropBox -> 'FFPlay4Laz_02_26.04.16 - 13.01:

Changes:
> Lazarus-IDE updated to v1.6.0 + FPC v3.0.0
> 'README_Console.txt' updated:

> Added: 2 Seek-Keys:
  - Press <Home> to go to the Stream's Begin (= BOF)
  - Press <End> to go to the Stream's End (= EOF)
    'Note: - EOF-Detection is quite inaccurate yet; for the Moment it's only seeking "quite near to EOF".
               - EOF means "EndOfFILE", so the Stream keeps playing, until the PacketQueues are empty.

> Added: 3 Info-Keys:
  - Press <c> to get Infos about all Chapters (Starttime, Endtime, Metadata)
  - Press <i> to get Infos about all Streams (Codec, Duration, Bitrate, fps tbr tbn tbc, Metadata, etc.)
    'Note: - The Bitrate may return Zero with Streams having a VARIABLE Bitrate.
               - The 'tbr' is not always detected correctly (don't know, why);
                 'tbr, corr.' shows the Result of a Workaround of mine, that tries to get the 'tbr' better.
  - Press <m> to get the AV-Stream's Metadata (= Tags).

> Added: 3 Tools to read out StreamInfos only
  (For continuity reasons I call them FFInfo4Laz):
  - 'FFInfo4Laz_StreamChapter.exe'  = same as "press <c>"
  - 'FFInfo4Laz_StreamInfo.exe'         = same as "press <i>"
  - 'FFInfo4Laz_StreamMetadata.exe' = same as "press <m>"

Parts of the Code to read out StreamInfos via FFmpeg-DLLs, I posted here:
http://forum.lazarus.freepascal.org/index.php/topic,22038.15.html (http://forum.lazarus.freepascal.org/index.php/topic,22038.15.html)
-> see the Attachment of my Post from April 22, 2016.

Have Fun with it  :)
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: aradeonas on April 30, 2016, 07:47:19 am
Hi metis, how are you?
I see you made changes after a while. I checked them and they are very good.
But two request :
1- Can we have a fast forward while we keep key down? like popular players? this version just keep jumping on 30s intervel but I mean for example julmbing on 1s interval but much more occurrences.
2- Can we have a progress?
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on May 05, 2016, 06:45:05 pm
@aradeonas

Quote
made changes after a while
Actually, I implemented the entire Code to read out Stream-Metadata, -Data, and -Chapters via FFmpeg-DLLs.
This indeed did last a While (Progging is my Hobby, not my Profession ;) ).

Quote
fast forward while we keep key down...just keep jumping on 30s intervel
'FastSeek' and 'RepeatedSeek' are already executed as long as the corresponding Key is pressed.
In the last Version, the 'FastSeek' is nothing else than a "modified 'RepeatedSeek' with SeekTarget = +/- 1 Sec." .
Doing it this Way, does not really work satisfying and is quite slow, simply because all the AV-Stuff has to
pass the Packet-, and PictureQueue and get synchronized, before You hear & see it.

Quote
much more occurrences...Can we have a progress
If I get You right, You want to know, wether 'FastSeek' can be speeded up ?
- Immediate Solution: Apply 'FastSeek' on a PAUSED Stream.
- Projected Solution: Pass the AV-Packets DIRECTLY to the Audio-/VideoOutput.

But, just tell me, why Seeking fast is so important for You.
I regard it as a ToDo with low Priority; there are lots(!) of other pending Things to be done first.
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: aradeonas on May 05, 2016, 11:58:30 pm
Code: Pascal  [Select][+][-]
  1. - Immediate Solution: Apply 'FastSeek' on a PAUSED Stream.
It seems good but not a real solution.
But, just tell me, why Seeking fast is so important for You. (http://But, just tell me, why Seeking fast is so important for You.)
Simply it feels good :D
I regard it as a ToDo with low Priority; there are lots(!) of other pending Things to be done first. (http://I regard it as a ToDo with low Priority; there are lots(!) of other pending Things to be done first.)
OK, so I let you working on them and I will not nag about this for a while ;)
Progging is my Hobby, not my Profession ;)  (http://Progging is my Hobby, not my Profession ;))
And you are pretty good at it  ;)
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on May 09, 2016, 01:52:00 pm
 :D
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on June 13, 2016, 04:36:35 pm
@aradeonas

Here's the next Release, see my DropBox -> 'FFPlay4Laz_02_13.06.16 - 15.12.

Changes...

> Updated: 'README_Console.txt'
> Added  : 'README_Console_KeysAndOptions.txt'

> Added: Cueing:
  Press <Enter>     to set a CUE-Position.
  Press <Backspace> to get back to the CUE-Position.
 ('Note: If no CUE-Position is set, the MRL-StartPosition is used.)

> Added: Looping:
  Press <l>, to set Loop-Params: see 'README_Console_KeysAndOptions.txt' in the Attachment.

> Added: INI-File 'App.ini' to set diverse AppOptions:
  - [VideoOptions]:
    'SdlScreen1': Set SDL-ScreenParams 'X/Y-Position, Width&Height, HasFrame'.
    -> Now, You may set any Position&Size for the SDL-Screen - Finally an old Wish of You came true.
    If You open the SDL-Screen 'framed', You'll see the SDL-Screen's Handle in the TitleBar.
    This Handle is the only Thing You need, to pass the SDL-VideoImage to any other Surface.
  - [AudioOptions]:
    'AudioOutput': Set SDL-Audio or Portaudio.
   ('Note: 'FFPlay4Laz_Console_02_Pa.exe' is not needed any more, and was deleted.)
  - [StartOptions]: Start-MRL, MRL-StartPosition, Start Playing/PAUSED, Open LAST MRL at LAST Position.
  - [EOF-Options] : StopOnEOF, RepeatALL, RepeatFromCUEPosition, ExitOnEOF.
  - [ExitOptions] : see 'README_Console_KeysAndOptions.txt' in the Attachment.

Note: AV-Sync still gets lost when UnPausing - This is the next Thing I gonna fix, promised.
             (I saw, how it's done by FFmpeg's 'FFPlay', but I'd like to do it some other Way.)

BTW: Did You ever try to open several Instances of 'FFPlay4Laz' ?
You may open as much Instances as Your Processor can bear; they keep on playing simultaneously.
With SDL-Audio, You'll hear only the one, whose SDL-Screen got the Focus, whilst
with Pa-Audio, You'll hear an AudioMix of all of them.
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on June 23, 2016, 01:51:34 pm
@aradeonas

Here's the next Release, see my DropBox -> 'FFPlay4Laz_02_23.06.16 - 12.48.

> Some FineTuning and BugFixes.
  -> 'Seek to CUE-Position' more precise, 'AudioSync' more accurate, (mostly) less AudioClicks, when Seeking.

> Solved: The eternally pending "UnPause-Problem".  :D
  -> Now, 'Pause/Resume' should work; check it out.

-> 'README_Console_KeysAndOptions.txt' updated, see the Attachment.
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on July 08, 2016, 05:51:25 pm
@aradeonas

Here's the next Release:

Updated to the latest FFmpeg-PascalHeaders from 'FFVCL' (= v2.6.4, for FFmpeg v2.8.6):
-> Better Performance.
-> From now on, You can download the DLL-Files directly from the Delphi-FFmpeg-DownloadSite.
    (My DropBox is not needed any more, and won't be updated any longer.)

How to install 'FFPlay4Laz' and 'FFInfo4Laz':

> Step 1: Get the FFPlay4Laz-Files:
   1.1 Download 'FFPlay4Laz.7z' from the Attachment. 
   1.2 Extract the Files. (I use '7-Zip': http://www.7-zip.org/ (http://www.7-zip.org/))
   1.3 Put the FFPlay4Laz-Folder, wherever You want on Your PC - 'FFPlay4Laz' runs from any Drive or Folder.

> Step 2: Download the matching FFmpeg-DLLs from the Delphi-FFmpeg-DownloadSite:
   http://www.delphiffmpeg.com/downloads/ (http://www.delphiffmpeg.com/downloads/)
   2.1 GoTo: "FFmpeg DLLs for FFVCL Player 6.1/6.1a (LGPL, Player/Decoder only, smaller filesize)".
   2.2 Download 'ffmpeg-dlls-2.8.6-win32-lgpl-player.exe' (= 7.7 MB for Windows 32-bit).
   2.3 Extract the Files.
   2.4 Open Folder 'LibAV', and copy all Files into the FFPlay4Laz-Folder.
   (Note: 'FFPlay4Laz' does not require 'Soundtouch' -> You may delete 'SoundTouch.dll'.)

> Step 3: Read the FFPlay4Laz-ReadMe-Files:
   - 'docs\ReadMe_Console.txt'
   - 'docs\ReadMe_Console_KeysAndOptions.txt'

> Step 4: Enjoy.  :)

Note:
According to the FileSize-, and Attributes of the SDL-DLL, that comes with the FFVCL-DLLs,
'FFVCL' obviously changed this DLL finally to the one, that is actually recommended by FFmpeg, see:
"FFmpeg-MinGW/FFmpeg installation guide"
https://trac.ffmpeg.org/wiki/CompilationGuide/MinGW (https://trac.ffmpeg.org/wiki/CompilationGuide/MinGW)
-> GoTo: "SDL" -> "You need the 1.2 version".
=> To be sure, that You've got the right SDL-Version for FFmpeg, download it here:
http://www.libsdl.org/download-1.2.php (http://www.libsdl.org/download-1.2.php).
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: aradeonas on July 19, 2016, 10:16:08 pm
Hi dear metis, sorry for the absent :p
I like the new changes and you seems more active than before, I will check these changes more and waiting for the ones in the future :D
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on July 22, 2016, 03:03:20 pm
@aradeonas
Thought, that I've lost my only Follower  :'( - What happened ?

Notes:
- 'Pause/Resume' is done totally different to 'ffplay.c' - in my Opinion it's faster than FFmpeg's 'FFPlay'.
- 'Start Paused' from the last Release doesn't work that good.
   This is already fixed, and will come with the next Release.

The next Release may last, because I'll try to help 'mercury' with his Project, see here:
http://forum.lazarus.freepascal.org/index.php/topic,33105.0.html (http://forum.lazarus.freepascal.org/index.php/topic,33105.0.html)
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: aradeonas on July 22, 2016, 04:35:00 pm
No your not dear metis, I was just have some troubles ;)
You are doing a very good job and I like to see the results when ever you done something new.
About merging with mercury's work, are these project do the same job? will you continue to have a real good video player? please dont let it go :(
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on July 22, 2016, 06:26:45 pm
@aradeonas

Quote
are these project do the same job?
Depends on, what You want it for - They both play a MediaFile, but:

> 'LibFFPlay' is a FrontEnd-C-DLL for FFmpeg's 'FFPlay'.
Pro:      - It will do anything, that the FFmpeg-Team implemented in its(!) 'ffplay.c'.
Contra: - It won't do anything, that they did not implement.
=> If Your're happy with 'ffplay.c' "as is", take it, but if not...
E.g., try to add another AudioOutput than SDL-Audio, and get it synced with the VideoImage.

> 'FFPlay4Laz' is a MediaPlayer, that is written from scratch in FPC - why, see here:
http://forum.lazarus.freepascal.org/index.php/topic,33105.msg216137.html#msg216137
-> GoTo: "Tell You, what is mine:"
Quote
An AV-Player (don't need Subtitles), that opens/closes, pauses/resumes, and
seeks really FAST, and all of this with high AV-Synchronism, and outstanding SoundQuality.

Quote
will you continue to have a real good video player?
Of course! I use it each Day, mainly to listen to MusicClips.  ::)
Therefore, I don't need any Format to be rendered, or Subtitles, but e.g. high AudioQuality.
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: aradeonas on July 22, 2016, 06:41:24 pm
So I like your version more And I will continue to follow your works :P
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on July 29, 2016, 06:56:26 pm
@aradeonas
Quote
So I like your version more...
Me, too (of course).  :D
Finally 'LibFFPlay' is a general Solution for general Needs, whilst
'FFPlay4Laz' is a special Solution for special Needs - my Needs.  :)

I'm looking forward to compare the Performance of 'LibFFPlay' and 'FFPlay4Laz', regarding
Speed, Response/Latency, and Synchronism, and
I'm curious, which Features 'mercury' will add to the original FFPlay-Functionality.
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on May 25, 2018, 01:06:21 pm
@aradeonas (and all the others)

Here's the next Release of 'FFPlay4Laz' and 'FFInfo4Laz':
(Except of 'SDL.dll', all Files have changed -> Replace all old Files with the new ones.)

What's new...

- Written with Lazarus v1.8.2 + FPC v3.0.4.
- Updated to 'FFmpeg v3.3.5', using FFmpeg-Headers v3.3.5 from 'FFVCL v7.0'.

- Changed: VersionCounting
  From now on, the first Number indicates the required SDL-Version;
  the following 2 or 3 Numbers are the same as the required FFmpeg-Version.
  (This Way, You'll always know, which DLL-Versions are required.)
  => Current Version of 'FFPlay4Laz' and 'FFInfo4Laz' is v1.3.3.5

- Revised: Start PAUSED
  This Option determines, whether MRLs are opened paused or playing.
  (Open paused didn't work really well in the last Version of 'FFPlay4Laz' - now, it should.)

- Added: Audio-only Files supported (former Versions of 'FFPlay4Laz' only played Videos)
  -> Should play all AudioFormats, supported by FFmpeg.

- Added: AudioOutputDevice selectable (Portaudio only; not supported by SDL1)
  When the App starts, all available Pa-AudioOutputDevices are listed in the ConsoleWindow.
  The preferred Pa-AudioOutputDevice can then be set in the INI.File.
  Note: The best Sound is obtained with Portaudio + ASIO (I use 'ASIO4ALL': www.asio4all.com (http://www.asio4all.com)).

- Added: Video-SyncMode selectable
  This Option determines, how Video-MRLs are synchronized, and is set in the INI.File:
  0=NO AV-Sync          : The Audio- and VideoStream are not synced to each other
  1=SyncVideoToAudio: The AudioStream is constant; Video is synced to it
  2=SyncAudioToVideo: The VideoStream is constant; Audio is synced to it
  3=AutoSync              : The AV-SyncMode is selected automatically (recommended)
  When the App runs, the Video-SyncMode can be changed with <0>, <1>, <2>, <3>.

- Added: Toggle VideoScreen
  <Tab> toggles between two Screens, whose Settings are stored in the INI.File.
  E.g. Screen #1 = 5,5,1270,730,0       = "in the left upper Corner, big, w/o Frame nor Titlebar"
         Screen #2 = 625,245,600,450,1 = "in the right lower Corner, small, and resizable".

- Added: Toggle Resizable <-> NoFrame/NoTitlebar
  LeftDoubleClicking on the SDL-Screen toggles between 'Resizable' and 'NoFrame/NoTitlebar'.

- Added: Fullscreen
  When the SDL-Screen is maximized, LeftDoubleClicking on it switches to Fullscreen, and back.

- Added: Freeze Video with <f>.

- Added: Mute Audio with <m>.

- Added: Display Playertimes with <t> (= MRL-Position - MRL-Length - Remaining Time).
  (For the Moment, the Playertimes are only shown in the ConsoleWindow; OSD is projected.)

- Added: Seek PAUSED (experimental with Videos)
  Press <Space> to pause the MRL, then press one of the SeekKeys (= <Up>/<Dn, <Left>/<Right>, <PageUp>/<PageDn>).
  All SeekKeys are repetitive, means as long as the Key is pressed, the Seek will be repeated automatically.
  Notes: - With some Video-Formats, Seeking paused may be a bit slow, especially when Seeking backwards.
              - Sometimes the Seek's TargetPicture is not detected correctly. In this Case, the VideoImage jumps to the actual SeekTarget, when the Video is resumed.
               -> Some better Code is under Construction.

- Added: AutoPause
  <p> switches AutoPause on/off. This Feature is especially useful, if several Players are opened simultaneously:
  When AutoPause is activated, the Player, that has the Focus is resumed, the other ones are paused automatically.
  Note: You can open as much Instances of 'FFPlay4Laz' as Your CPU bears, where
            each Instance may have any Position & Size on the PC-Screen(s), see 'MultiVideoExample.jpg' in the Attachment.

- Added: Step Frame(s)
  <Less> ("<") steps one or several Frames forward; 'Step Frame(s)' is repetitive.
  Note: Mostly it's more useful to step several Frames, instead of Stepping only one Frame.
           Therefore, the Number of Frames to be stepped at once can be set in the INI.File.

How to install...

Download 'FFPlay4Laz-1.3.3.5-cli.7z' from the Attachment, extract it, and
put all required DLLs (FFmpeg, SDL, Portaudio) into the same Directory.
'FFPlay4Laz' is portable, so You may put the FFPlay4Laz-Directory wherever You want on Your PC.

Requirements... (see also 'README_ConsoleInfo.txt' -> GoTo "Requirements...")

- The FFmpeg-DLLs - There are several Ways to get them, e.g.:

  - From 'FFVCL': http://www.delphiffmpeg.com/downloads (http://www.delphiffmpeg.com/downloads)
    -> Download the FFmpeg-DLLs for Win32
        (Those for the FFVCL Player are sufficient = "LGPL, Player/Decoder only, smaller filesize").
        The FFmpeg-DLLs are in the Folder 'LibAV' - 'SDL2.dll' and 'SoundTouch.dll' are not used by 'FFPlay4Laz'.

  - From 'Zeranoe': https://ffmpeg.zeranoe.com/builds/ (https://ffmpeg.zeranoe.com/builds/)

  - From 'FFmpeg': https://www.ffmpeg.org/download.html (https://www.ffmpeg.org/download.html)
    These are the FFmpeg-SourceFiles; You have to build the DLLs by Yourself.
    I use 'MinGW v4.9.2' + 'Nasm v2.12.01' (+ 'SDL v1.2.15' for FFmpeg's 'FFPlay').

  Note:
  This Version of 'FFPlay4Laz'/'FFInfo4Laz' is written with the DLLs from FFmpeg v3.3.5.
  I tested it with the DLLs from the last v3.4 ReleaseBranch (= v3.4.2, "Cantor") -> It works with them, too.

- The SDL-DLL: https://www.libsdl.org/download-1.2.php (https://www.libsdl.org/download-1.2.php)
  -> Download 'SDL-1.2.15-win32.zip'.

- The Portaudio-DLL: https://github.com/spatialaudio/portaudio-binaries (https://github.com/spatialaudio/portaudio-binaries)
  -> Download 'libportaudio32bit.dll'.

How to use it...
see 'README_ConsoleInfo.txt', 'README_ConsoleKeys.txt' and 'README_ConsoleOptions.txt'.

Known Bugs, ToDos, Not so Nices...
- Still using SDL1 -> Update to SDL2 is projected.
- Seek paused is experimental; it may not work well with some Video-Formats (see above).
- No NetworkSupport implemented.
  If You need a Lazarus-FFmpegPlayer with NetworkSupport, somby did one, see:
  http://forum.lazarus.freepascal.org/index.php/topic,40446.0.html (http://forum.lazarus.freepascal.org/index.php/topic,40446.0.html)

Try them out, tell me Your Opinion and if there are Bugs.

 :)
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on February 21, 2019, 05:22:09 pm
Here's the next Release of 'FFPlay4Laz':
(Except of 'SDL.dll' and 'libportaudio32bit.dll', all Files have changed since the last Release.)

What's new...

- Written with Lazarus v1.8.4 + FPC v3.0.4
- Updated to 'FFmpeg v4.0.2', using FFmpeg-Headers v4.0.2 from 'FFVCL v7.1' => current Version is v1.4.0.2.

- Added: Seek with the Mousewheel (= the Preset, when a MRL is opened)
  Press <s>, then seek with the Mousewheel 1.0 Sec. Forwards/Backwards; RightClick seeks to the CUE-Position.

- Added: Adapt any MRL to any Screen
  Press one of the following Keys, then set the Value with the Mousewheel; RightClick resets to Factor 1.0:
  <a> Set AspectRatio-Factor (= continuous, so not only fix 4:3, 16:9, 16:10, etc.)
  <x> Move the VideoImage in X-Direction
  <y> Move the VideoImage in Y-Direction
  <z> Zoom the VideoImage (= continuous, so not only fix 1:2, 1:4, 2:1, etc.)
  <v> Set Volume (0-5x Amplification)
  > With these Functions wrong Encodings (e.g. incorrect AspectRatio, low Volume) can be corrected,
      while Watching a Movie, so time-consuming Transcoding of the entire Movie is not needed.

- Added: Colored Border around the VideoImage
  The BorderColor is set in the INI-File -> [VideoOptions] -> 'BorderColor' as RGB, e.g.:
  BorderColor=0,0,0 draws a black Border, 0,255,0 a green One, 219,219,219 a "ScreenGrey" -> any BorderColor can be set.
  > This Feature helps to see the Distance between the VideoScreen and the actual VideoImage.

- Added: AutoSave VideoScreen-Parameters
  In 'FFPlay4Laz' <Tab> toggles between two Settings for the SDL-Window, e.g. to switch a Movie between
  a Laptop and a TV-Set. From now on these Settings are saved automatically in the INI-File, so You don't
  have to set them manually any more.

Attached 'FFPlay4Laz-1.4.0.2-Features.7z' contains a Summary of all Options and PlayerFunctions, that
are currently implemented in 'FFPlay4Laz'.

Attached 'FFPlay4Laz-1.4.0.2-Files.jpg' shows the Files You need to run the FFPlay4Laz v1.4.0.2 Console.
The Download-Sites for FFmpeg, SDL and Portaudio are in my previous Post.

Hope, You like it - I use it every Day  :)
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on October 22, 2019, 01:00:02 pm
Here's the next Release of 'FFPlay4Laz' (first GUI-Version):

Added to Version v1.4.0.2...

Snapshots:
<F2> takes a Snapshot of the current Videoscreen and saves it in [FFPlay4Laz-DIR\Snapshots].

FFPlay4Laz-Library (FFPlay4Laz-AV-Engine):
The FFPlay4Laz-AV-Engine is something like a "Mini-VLC", reduced to and optimized for pure PlayerFunctions & Sound.
It doesn't have the plenty of Features of 'VLC', but (I think) it has all Features, that an Audio/Video-PlayerEngine should have.
( see 'README_PlayerFunctions.txt' and 'README_PlayerOptions.txt' in the attached 7z-File )
It's more responsive and provides better Sound via 'Portaudio'. Its Interface is much easier to use than
the VLC-Interface, because the entire PlayerCode is completely included in the FFPlay4Laz-Library.

together with a

LCL-Test&Demo-GUI (FFPlay4Laz-FrontEnd):
The GUI demonstrates how to use the FFPlay4Laz-API (all event-driven, no Pipes, no Timers, no 'Application.ProcessMessages', etc.).
The Videoimage is displayed optionally in- or outside of the GUI (see attached 'InternalExternalVideoscreen.jpg').
All Mouse- and Keyfunctions of the GUI-Player are the same as in the ConsoleVersion of 'FFPlay4Laz'.

The Dependencies (= required DLLs for FFmpeg, SDL, Portaudio) are the same as described in my previous Post.
All FFPlay4Laz-Files have changed since the last Release, so You have to replace them all with the new ones.
If You got all Files and after having compiled the Demo-GUI's ProjectFiles, Your FFPlay4Laz-Folder should
look as shown in 'FFPlay4Laz-Folder.jpg'.

Note:
To get started with the FFPlay4Laz-GUI, compile and open it with Terminal (-WG Switch = OFF), because:
- the Terminal shows always Infos & Instructions for the User -> No Helpfile needed
- Chapters (<c>) and MRL-Infos (<i>) are only displayed in the Terminal, for now.

Hints...
You may use this GUI as a FrontEnd-Template for any Version of the FFPlay-CLI by 'FFmpeg'.
To do so, You have to make some Modifications on the original ffplay.c-File, like:
- turn it to a Library
- get the SDL-Window's Handle
- implement and export the PlayerEvents, as described by mercury:
  http://forum.lazarus.freepascal.org/index.php/topic,33105.0.html (http://forum.lazarus.freepascal.org/index.php/topic,33105.0.html).

Or You use only Parts of the GUI (e.g. the PositionSlider with its Options) for a Custom-VLC-FrontEnd.
To do so, You have to:
- eliminate all the Code to capture/release the SDL-Window
- replace all FFPlay4Laz-Calls with the corresponding VLC-Calls.
For how to use the VLC-Libraries with Lazarus, see the
VLC-TestPlayer by Michael Van Canneyt: [Lazarus-DIR\components\vlc\test\testlcl.lpi].

Coming next: Update to SDL2.  :)

EDIT: For those, who have downloaded the 7z-File before 10/25/2019:
There was a tiny Bug, that made the HostApp crash with a 'DivByZero' Error, when it's opened without Terminal.
-> ADDED in 'FormMINIMAL.pas': Line #1049 'if (FLenSec > 0) then' to solve this Problem.
The 7z-File has been corrected and replaced - Please, download it again - Sorry.
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: Guva on December 03, 2019, 10:47:47 am
could you compile FFPlay4Laz-1.4.0.2-win32-lib.dll for linux 64 bit. it would be interesting to see your projec
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on December 04, 2019, 01:58:49 pm
@indigo80

The PlayerCore itself is entirely cross-platform, but there are some Features included in the DLL, like
Switching between two SDL-Windows (<Tab>) and save their last Position&Size, that I could only realize
with the Windows-API, because SDL1 does not have the according Functions yet (or I didn't find them).

In the current Demo-GUI, as well, the SDL-Window (= the Videoscreen) is captured and resized via the Windows-API.

That's one of the Reasons why the next Step is updating all to SDL2, like:
Windows 'SetWindowPos()' -> 'SDL_SetWindowPosition()'
Windows 'GetWindowPlacement()' -> 'SDL_GetWindowPosition()'
(This is only an example; there's much more to be done.)

Why don't You try out the current Win32-Version with Wine or Virtualbox till then ?
Would be interesting for me to know, whether it works this Way, too.  :)
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: Guva on December 07, 2019, 04:39:49 am
Quote
Why don't You try out the current Win32-Version with Wine or Virtualbox till then ?
Would be interesting for me to know, whether it works this Way, too.  :)
wine 3.20
*******************************************************************************
*                                                                             *
*  FFPlay4Laz v1.4.0.2 - Console                                              *
*                                                                             *
*  FFmpeg-PascalHeaders v4.0.2, ported from FFmpeg v4.0.2 by 'FFVCL' (v7.1)   *
*  <www.delphiffmpeg.com>                                                     *
*                                                                             *
*  Copyright (c) 2014 Robert Bakos, av4all@gmx.com                            *
*                                                                             *
*******************************************************************************

> MRL-StartTime:+00:00:00.000
> CUE-Position set to MRL-StartPosition.
> AutoPause=OFF; DoOnEOF: 1=RepeatALL.

! Opening - Wait...
0009:fixme:keyboard:X11DRV_LoadKeyboardLayout L"00000409", 0080: semi-stub! Returning default layout.
0009:fixme:keyboard:X11DRV_LoadKeyboardLayout L"00000419", 0001: semi-stub! Returning default layout.
EAccessViolation: Access violation
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on December 08, 2019, 07:38:28 pm
@indigo80

Thanks for Testing - Typical Case of what's written in my Signature.  :D

Referring to Your Post, the Error occurs right at the Moment, when SDL is initialized.
BTW, it's better to post a Screenshot of the Output -> same Info / less Space.  ;)

Referring to the Error "fixme:keyboard":
Did You read https://wiki.winehq.org/HowTo (https://wiki.winehq.org/HowTo) -> "If your application doesn't work" ?
"An application may not work because Wine doesn't yet fully implement one of the DLL files the application is trying to use.
 If you ... see a lot of "FIXME:" messages while running the application in Wine, this is likely the case."


-> Did You try with a newer Version of Wine than v3.20 ?
See https://en.wikipedia.org/wiki/Wine_%28software%29 (https://en.wikipedia.org/wiki/Wine_%28software%29) -> e.g. "... Wine 4.0 supports Direct2D ...".

If You already did and it's still not working:
I've already written a "minimalst" FFmpeg-ConsolePlayer with SDL2, based on 'ffplay.c', that I'll publish soon.
The Player's BasicStructure is the same as already posted for SDL1, here:
http://forum.lazarus.freepascal.org/index.php/topic,26666.msg196377.html#msg196377 (http://forum.lazarus.freepascal.org/index.php/topic,26666.msg196377.html#msg196377)
-> download attached 'DrangerTutorial08.c2FPC.lpr.zip'.

You may compile those SourceCodes on Your PC and check the Binaries for cross-platform Ability.  :)
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on December 12, 2019, 12:47:33 pm
@indigo80

Sorry, but I always get slightly nervous, when I'm told, that something does not work.

So, I took my old Thinkpad and put 'Linux Mint 17.2 32-bit' on a Drive, that I don't use.
With the 'Software Manager' I installed the preset Wine-Version = Wine v1.6.2.
Note: All Standard-Installation, w/o any special Settings.

Then I copied the complete FFPlay4Laz-Folder together with all required DLLs into DIR
[/home/user/.wine/drive_c], that had been created during the Wine-Installation, just the
same Way as I would do on Windows
(see Screenshot 'FFPlay4LazFolderOnLinux.jpg').

Finally, I launched both FFPlay4Laz-Executables with the 'Wine Windows Program Loader', and...
- The ConsoleVersion works.
- The GUI-Version with external Videoscreen works (see Screenshot 'FFPlay4LazOnLinux.jpg')
- The GUI-Version with internal Videoscreen works with 3 minor Problems, which are Windows-API-dependent:
   1. The SystemMenu's [X] (= Close) of the SDL-Window is not visually deactivated
   2. RightClicking on the SDL-Screen (= Reset) is not detected, when the SDL-Window is captured
   3. The captured SDL-Window is not positioned correctly within the PlayerForm, nor resized with it.
       -> Preliminary Solution: Click on CheckBox 'chkAutoResize' (= Hint: "Resize the captured SDL-Window with the internal Videoscreen").

=> 'FFPlay4Laz v1.x' works on Linux with Wine, too (at least with my Linux-Version).  :)  :)  :)
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on August 09, 2020, 06:42:57 pm
Here's the first Release of 'FFPlay4Laz2' (first with SDL v2):

It's the BasicStructure for a FFmpeg-based AV-Player with AudioResampling and InternetSupport, updated to SDL2.
The attached 'FFPlay4Laz2_MINIMALST.7z' contains the SourceFile and an Executable compiled for Win32.

The FFmpeg-Version is the same as above: v4.0.2 => current FFPlay4Laz-Version is v2.4.0.2.

This FPC-Code is based on the Dranger-Tutorial http://dranger.com/ffmpeg/ (http://dranger.com/ffmpeg/) and
'ffexample.c' by Lovesan https://gist.github.com/Lovesan/e29d815586ea20642d85875d47cefe03 (https://gist.github.com/Lovesan/e29d815586ea20642d85875d47cefe03)
Among other Modifications, I've replaced all Windows-API-Calls with SDL2-Calls to make it cross-plattform, and
I've added some Comments, that explain the Strategy of this kind of FFmpeg-Player.

@indigo80
You may take the Code to try out 'FFPlay4Laz2' on Your 64bit-Platform.
To build&compile it, You have to add the according FFmpeg- and SDL2-Headers for FPC to Your Project - I've used:
FFmpeg-Wrapper from 'FFVCL': http://www.delphiffmpeg.com/headers (http://www.delphiffmpeg.com/headers) and
SDL2-Wrapper by Tim Blume: https://github.com/ev1313/Pascal-SDL-2-Headers (https://github.com/ev1313/Pascal-SDL-2-Headers).
To run it, You need the FFmpeg- and SDL2-Libraries as shown for Win32 in
attached 'FFPlay4Laz2_MINIMALST-Dependencies.jpg'.

Note:
This is not a fully elaborated FFmpeg-MediaPlayer. It's the Minimum to render most AV-Streams, that
are supported by FFmpeg with a basic AV-Synchronisation, that should suffice for general Needs.
Everyone may feel free to modify, extend and optimize the present FPC-SourceCode.  :)
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: Fred vS on August 09, 2020, 06:59:08 pm
Well done metis, thanks for your great work.

May I ask you why you dont share your code via GitHub or GitLab or a other git server?
It would be much easier to follow your work.

Fre;D
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on August 09, 2020, 07:20:09 pm
Hi Fred
Pleased, that You like it. Why I don't put it into a Gitxxx:
1. This Way, I share it with the Lazarus-Community
2. Leading others to the Lazarus-Pages
    (This is my Way to contribute to the great Work of the Lazarus-Developers :) )
3. One never knows, who's the next Gitxxx-Owner.  ;)
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: Fred vS on August 09, 2020, 07:35:54 pm
Hi Metis!

Quote
3. One never knows, who's the next Gitxxx-Owner.

Hum, if you really want:

Quote
1. This Way, I share it with the Lazarus-Community
2. Leading others to the Lazarus-Pages

Imho, you should be the next Gitxxx-Owner.

Have a perfect day.

Fre;D

Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on August 09, 2020, 09:44:46 pm
Where can I send my application papers to ?  :D
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: Fred vS on August 10, 2020, 12:19:10 am
Where can I send my application papers to ?  :D

Git documentation:

https://git-scm.com/docs


Git servers inscription:

https://github.com/join?source=login

or

https://gitlab.com/users/sign_in
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on August 10, 2020, 03:29:10 pm
Thank You, Fred - I'll check that Option.  :)

What Do You think? Isn't this a good Occasion to start a new Topic, like
"Where should I publish & share my Codes & Projects ? (which Host to choose)"
to discuss the Pros & Cons of those Sites ?

For Example, what's Your Opinion about this ?
https://www.securitynewspaper.com/2020/05/07/microsoft-is-owner-of-github-and-its-own-github-account-hacked/#:~:text=Microsoft%20is%20owner%20of%20GitHub%20and%20its%20own,data%20stored%20in%20Microsoft%E2%80%99s%20private%20repositories%20on%20GitHub. (https://www.securitynewspaper.com/2020/05/07/microsoft-is-owner-of-github-and-its-own-github-account-hacked/#:~:text=Microsoft%20is%20owner%20of%20GitHub%20and%20its%20own,data%20stored%20in%20Microsoft%E2%80%99s%20private%20repositories%20on%20GitHub.)
-> GoTo "The threat actor offered...on a hacking forum...to use site ‘credits’ to gain access to the exposed data".   :(

Or that:
https://about.gitlab.com/terms/#gitlab_com (https://about.gitlab.com/terms/#gitlab_com)
-> GoTo "..., you are responsible for maintaining the security of your account, and
               you are fully responsible for all activities that occur under the account and
               any other actions taken in connection with the account."
.  ;D

Having taken a quick Look at the GitHub-Site, I only see Advantages for Teams of Developers.
'FFPlay4Laz' (like 'FFInfo4Laz' and 'FFGrab4Laz' with 'RunFFmpeg') is entirely made of my own.

So, why should I complicate my Life unnecessarily ?  8-)
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: Fred vS on August 10, 2020, 03:49:35 pm
Quote
What Do You think? Isn't this a good Occasion to start a new Topic, like
"Where should I publish & share my Codes & Projects ? (which Host to choose)"
to discuss the Pros & Cons of those Sites ?

Yes do it (I am already converted but it is interesting).

Quote
For Example, what's Your Opinion about this ?
...

Sorry but I am not paranoiac, honesty rules my life and all the code that I share follow that way too.
I only see the advantages that those sites give me to share my code, have push request sometime from other users, all the source in a place more safer than my only laptop that risk to die soon.

Fre;D

 
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on August 10, 2020, 04:16:56 pm
Quote
honesty rules my life
Maybe, I know too much lawyers.  %)

Quote
safer than my only laptop that risk to die soon
Get a ThinkPad. Used ones are not expensive, at all.
I rescued mine, a ThinkPad T400s, from being thrown away. Got it for free, repaired it, and
it works perfectly since many Years.
https://thinkpad-forum.de/threads/178201-T400s-Impedanz-der-int-Lautsprecher (https://thinkpad-forum.de/threads/178201-T400s-Impedanz-der-int-Lautsprecher)
https://thinkpad-forum.de/threads/178053-T400S-OHNE-interne-Tastatur-Einschalten (https://thinkpad-forum.de/threads/178053-T400S-OHNE-interne-Tastatur-Einschalten)
(Sorry all in German; it's a German ThinkPad-Forum).
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: Fred vS on August 10, 2020, 04:25:18 pm
Quote
> Get a ThinkPad. Used ones are not expensive, at all.

Huh, I have a ThinkPad X390...

Quote
> safer than my only laptop that risk to die soon

That, for example, is not honest.
Like everybody I know that a ThinkPad never die.

(You see that the "total honesty" is not easy to reach.)

Fre;D
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on August 10, 2020, 04:38:56 pm
Quote
You see that the "total honesty" is not easy to reach.
I think, I should start that Topic about Code-Hosts.  :D
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on August 10, 2020, 05:12:45 pm
Done: https://forum.lazarus.freepascal.org/index.php/topic,50973.0.html (https://forum.lazarus.freepascal.org/index.php/topic,50973.0.html).
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: Guva on August 10, 2020, 05:22:38 pm
well, I couldn't get an image. only the green screen. I used the ffmpeg 4.0.2 and 4.1.4 headers. the result is the same everywhere.
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: Guva on August 10, 2020, 05:34:37 pm
Oh no .... it's my problem with nvidia drivers. It works fine under intel...
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on August 10, 2020, 05:38:42 pm
So, You're the First, who tried 'FFPlay4Laz' on Linux.  :)
You should post the Reason for Your initial Problems, and how You fixed it.
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: Guva on August 10, 2020, 05:40:03 pm
My modify ffmpeg headers  for linux ....
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: Guva on August 10, 2020, 05:51:43 pm
You should post the Reason for Your initial Problems, and how You fixed it.
Uses AMD Video Card :D :D :D
I haven't found a solution yet. alternatively, use graphics from Intel. The problem only occurs with Optimus laptops...
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on August 10, 2020, 06:07:25 pm
Have Fun with 'FFPlay4Laz'.
What do You need it for? I use it mostly for MusicVideos (-> Portaudio), and
to watch Tutorials, that I've downloaded with the '4K Video Downloader':
https://www.4kdownload.com/products/product-videodownloader (https://www.4kdownload.com/products/product-videodownloader).
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: furious programming on August 10, 2020, 08:36:44 pm
Is it possible to use this project to create screen recording software? Recording a given fragment of the screen and sound output, using hardware acceleration, saving to an mp4 file — only the basics. Something like that would be useful to me for recording my Tetris games — a small tool that works on XP, light and effective.
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on August 10, 2020, 11:10:17 pm
@furious programming

This Topic treats 'Rendering with FFmpeg-Libraries' - for Recording-Issues, see 'FFGrab4Laz':
https://forum.lazarus.freepascal.org/index.php/topic,43411.0.html (https://forum.lazarus.freepascal.org/index.php/topic,43411.0.html).

-> GoTo: ScreenRecorder2FPC,
which is a FPC-Example for Recordings with FFmpeg-Libraries (for the Moment w/o Audio).

-> GoTo: RunFFmpeg,
which is for anything else, that 'FFmpeg' can do for You, simply by using the FFmpeg-CLIs themselves.
With the preset CommandLines, You can
record a Part of the Screen (= [Grab] -> [Stop]), and then read out Infos about the recorded File (= [Info]) and play it (= [Play]).
All done with the MKV-ContainerFormat (= Matroska, which is a free Format).

With MP4 Things are different:
Recordings must be stopped with <q> (= quit), otherwise the created VideoFile won't be valid, means not playable.
This Part is not implemented yet in 'RunFFmpeg', but You may do so in the SourceCode, which is
attached to the initial Post of 'FFGrab4Laz' (see 'FFGrab4Laz_01.7z').
Or take FFmpeg's CommandLine-Tool 'ffmpeg.exe' directly to record the Screen to MP4-Files with CommandLines, like e.g. ...

ffmpeg.exe -f gdigrab -framerate 30 -video_size 1280x768 -i desktop "grabbed.mp4"
to record the entire Screen w/o Audio.

ffmpeg.exe -f gdigrab -framerate 30 -offset_x 10 -offset_y 20 -video_size 640x480 -show_region 1 -i desktop "grabbed.mp4"
to record a Part of the Screen w/o Audio.

ffmpeg.exe -f gdigrab -framerate 30 -video_size 1920x1080 -i desktop -f dshow -i audio="Sound Blaster Audigy" -vcodec libx264 -pix_fmt yuv420p -preset ultrafast "grabbed.mp4"
to record the entire Screen with Audio, where
"Sound Blaster Audigy" is the Name of my AudioDevice, and may be different on Your System.

Note: 'gdigrab' and 'dshow' is for Windows, only (I use WinXP, too).

By Modifying the CommandLine-Arguments, You can record the Screen with any Framerate, AV-Quality, Format, etc., which
is supported by 'FFmpeg', and this is a lot.  :)
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: furious programming on August 11, 2020, 11:23:58 pm
Gosh, I didn't even know there was a second thread too — sorry for off-topic.

Unfortunately, I tried FFmpeg and had a lot of problems. Either there was no desktop recorder, or the audio capture didn't work, or I was getting a tons of errors during recording. I had the biggest problem with recording a fragment of the desktop, which is on an additional monitor, with a negative X coordinate (the monitor is to the left of the main screen) — it's just imposible. I gave up.

Then I used the VLC player, because it can record the desktop and sound (although it is not intuitive), but I still had problems with the sound. Despite reinstalling the drivers, codecs and the VLC player itself, the problems could not be fixed... Finally, I record the gameplay using VLC (video) and Audacity (audio), and then merge both source files using ShotCut. It takes a little more work, but better this than nothing.
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on August 13, 2020, 12:31:49 pm
@furious programming

Did the FFmpeg-CommandLines, that I've posted work for You ?

Quote
I tried FFmpeg and had a lot of problems.
You are not alone with this.

Quote
with a negative X coordinate...it's just imposible.
Negative X/Y-Coordinates result in an Error, which is shown in the CLI's Output.

Quote
Then I used the VLC player, ...
IMHO 'VLC' is too slow for Playing and too complicated for Recording with Sound.

Quote
Despite reinstalling ..., codecs and the VLC player itself, ...
If You use 'FFmpeg' directly, no further Installations are needed -> much easier.

Most Apps, that I've found for ScreenRecording or Converting are nothing else than
Wizards, which compose a CommandLine and pass it to ... FFmpeg, that's all.
So, if You know, how to use the FFmpeg-CommandLines, You won't need anything else.
There are lots of WebPages to show, how to do it, mostly for C-Programming, but
hey, the CommandLines are the same with FPC.

Please, put further Posts, that are not related to Streaming/Playing with 'FFmpeg' into
my FFGrab4Laz-Thread (https://forum.lazarus.freepascal.org/index.php/topic,43411.0.html). I started it, because the Code and CommandLines for
Recording/Converting are totally different from Streaming/Playing, so
it's better not to merge the two Subjects.

BTW (if not found yet): FFInfo4Laz = Read out MediaFile-Data with FFmpeg-LIBs is here:
https://forum.lazarus.freepascal.org/index.php/topic,22038.msg208700.html#msg208700 (https://forum.lazarus.freepascal.org/index.php/topic,22038.msg208700.html#msg208700)
-> Download attached 'FFStreamInfo.lpr.txt'.
Or use RunFFmpeg's [Info] resp. FFmpeg's CommandLine-Tool 'ffprobe.exe', like:
ffprobe.exe -i "input.mp4" -report -hide_banner

Now, You got all my 'FFmpeg for Lazarus/FPC' related Projects.  :)
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: BosseB on November 01, 2020, 09:24:34 pm
Excuse me, but I just stumbled on this massive thread and I would like to ask if it is appropriate reading when I want to create a video/audio capture app with Lazarus/Fpc on Windows10?

What I want to do is capture a video playing inside a FireFox or Chrome window to a complete mp4 video/audio file.
I have already written a video editing tool, which can work with video files directly but never captured anything from another window. The tool uses PasLibVlc (and therefore the VLC engine), but the video I need to work with is not a regular stream URL, but it plays on FFx and Chrome so a screen capture app is needed.

If this is not the right thread, please say so and I will search on (after removing this post from the thread).
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on November 02, 2020, 09:30:49 pm
@BosseB

Quote
...ask if it is appropriate reading when I want to create a video/audio capture app...
No, see my last Post:
"Please, put further Posts, that are not related to Streaming/Playing with 'FFmpeg' into
my FFGrab4Laz-Thread. I started it, because..."


This Thread is about a highly responsive and accurate FFmpeg-Streamer/Player with
outstanding AudioQuality, entirely written with FPC/Lazarus.

Anyway...
(I answer in General for any Kind of Audio/Video-Capture from WebSites, if other's are interested, too.)

Quote
...capture a video playing inside a FireFox or Chrome window...
Capture/Streaming Videos from a WebSite does not depend on Your WebBrowser.
You need the Video's URL and a WebSite, that permits to "use" that URL independently of it, too.

If the Site does not provide the Possibility for Downloading or even blocks Downloads via URL,
You may try Apps like the '4k Video Downloader': https://www.4kdownload.com (https://www.4kdownload.com)

If even this is blocked, the only Way to record the Video is to capture the Monitor's Screen together with
the PC's Audio-Output. Of course, this will limit the Video's Audio-/Video-Quality to the Quality of Your
Soundcard resp. the Resolution of Your Monitor.

For how to do it with FFmpeg and Lazarus, see FFGrab4Laz as mentioned above:
http://forum.lazarus.freepascal.org/index.php/topic,43411.0.html (http://forum.lazarus.freepascal.org/index.php/topic,43411.0.html)
-> GoTo: "ScreenRecorder2FPC" (= Video only via FFmpeg-LIBs) and "RunFFmpeg" (= anything via FFmpeg-CLIs).

Here is a FFmpeg-CommandLine for ScreenRecording with Audio, that You may use with 'RunFFmpeg':
https://superuser.com/questions/995021/how-to-record-whats-playing-on-the-soundcard-using-ffmpeg (https://superuser.com/questions/995021/how-to-record-whats-playing-on-the-soundcard-using-ffmpeg)
-> GoTo: "Here is a command for audio and video at the same time".
('gdigrab' and 'dshow' is for Windows; for Linux You may take 'x11grab' and 'pulse'.)

If You want to record an App's entire Window, You have to replace
-i desktop with -i title=AppWindowTitle/Caption.

If You want to record Parts of the Screen, You have to insert e.g. this into the FFmpeg-CommandLine:
... -offset_x 10 -offset_y 20 -video_size 640x480 -show_region 1 ..., which will
grab a 640x480 Region at Position X=10/Y=20, and shows the currently grabbed Region on the Screen.

FFmpeg-CommandLines in General are explained in the FFmpeg-Documentation:
http://www.ffmpeg.org/ffmpeg-all.html (http://www.ffmpeg.org/ffmpeg-all.html).

BTW: You can use 'FFmpeg' for any Kind of VideoEditing, as well.  ;)
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: BosseB on November 05, 2020, 02:28:52 pm
Thanks, I downloaded your archive (https://forum.lazarus.freepascal.org/index.php?action=dlattach;topic=43411.0;attach=29257) containing the sources and I have a few questions:

RunFFmpegDemo
1) Is it needed to use a 32 bit Lazarus/Fpc as mentioned in descriptions? Mine is 64 bit...
What are the caveats when not using 64 bit?

2) It was possible to compile/build the application using my configuration but when I ran it I got a form where the ffmpeg binaries are not found. But they are on my path:
Code: Text  [Select][+][-]
  1. >where ffmpeg.exe
  2. C:\Programs\ffmpeg\bin\ffmpeg.exe
  3. >where ffprobe.exe
  4. C:\Programs\ffmpeg\bin\ffprobe.exe
  5. >where ffplay.exe
  6. C:\Programs\ffmpeg\bin\ffplay.exe
What did I do wrong? I assume that utilites like ffmpeg will be used as found on the path, or not?

UPDATE:
I copied the files mentioned above to the FFGrab4Laz_01\bin_ffmpeg-3.4.2\win64 directory and the initial messages went away.
But when I tried the grab function by changing the desktop caption to what is actually on the test window (Chrome playing a YouTube video), I got an error about ffplay anyway...
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: BosseB on November 05, 2020, 09:06:12 pm
So I downloaded the SDL2.dll file as described and came a bit further...

I am using the default command in the top editbox but I replaced the text describing the window title where the screen data should come from and some metrics too.
In my case this title in the real case is very long so I used a Youtube video as test instead.
I wonder if there is not a possibility to define the source window using its handle instead? I can easily enumerate the windows and select the one with the correct listed title but use the handle value instead for the ffmpeg command.
Otherwise is there a flag to tell ffmpeg to use a partial match for the title?

I tested with a Youtube video playing in a FireFox window but no matter what I did the following happened:
- I used this as the "Grab" command:
Code: Text  [Select][+][-]
  1. -f gdigrab -framerate 25 -offset_x 60 -offset_y 200 -video_size 815x443 -show_region 1 -i desktop "(4) cnn - YouTube - Mozilla Firefox"
- When I clicked the Grab button a white rectangle briefly appeared in the upper left corner area of the screen (probably the area of screen that would be recorded?).
- Then it disappeared and an ffmpeg error was generated and nothing more happened.

Code: Text  [Select][+][-]
  1. *** FFProcess "ffmpeg.exe" started ***
  2. > ExitStatus CHANGED to: 259
  3. R LastLn[0000]: [gdigrab @ 0000021d1198ea00] Capturing whole desktop as 815x443x32 at (60,200)
  4. > ExitStatus CHANGED to: 1
  5. E ERROR: ExitCode=1 -> FFProcess stopped 'OnFFmpegError'.

What do I do then???

And where is the grabbed video file supposed to wind up?
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on November 05, 2020, 09:50:37 pm
@BosseB

Please, please, please,
put Questions, that are related to Recording with 'FFmpeg' into my FFGrab4Laz-Thread:  :'(
https://forum.lazarus.freepascal.org/index.php/topic,43411.0.html (https://forum.lazarus.freepascal.org/index.php/topic,43411.0.html)
(And remove Your last two Post from this Thread, of course.)

Then I will answer to all of Your Questions, e.g.:
Remove "(4) cnn - YouTube - Mozilla Firefox" and specify an OutputFile instead, like "grabbed.mkv".
I really do not want to merge Recording-Issues with Playing-Issues - they are too different !  ;D
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on November 06, 2020, 01:47:25 pm
@BosseB
You find my Answer to Your last 2 Posts at its correct Place here (https://forum.lazarus.freepascal.org/index.php/topic,43411.msg382975.html#msg382975).
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: BosseB on January 22, 2021, 11:53:25 am
Hi again @metis
I have used your info plus PasLibVlc to manage videos downloaded from streams and Youtube in order to edit out the commercials before viewing the videos.
My edit application plays the video and I can step through it in various step sizes to find and set clip points (in seconds) where the commercials start and end.
Then the application can compile a call to ffmpeg to:
1) Extract every active video section into a tmp_xx.mp4 file
2) Combine these video files into a single complete (minus the commercials) video file.

This works fine except for a minor issue I have been wondering about, so here is a question regarding this:

It turns out that if I use ffmpeg to extract  from a specific time into the video for a set duration, both in seconds, then the resulting video does not really start at the point I wanted.
It seems to always contain something before the clip start point, it can be 1-2 seconds but sometimes longer than that.
How come this happens?
Are mp4 videos quantized such that there is a video "atom" which cannot be divided and any clip will be done at "atom" borders?
I figured it should be possible to cut at frame borders (1/25 or 1/30 s) but it does not seem like this is happening.
The command I use to extract the tmp files is like this example (here the start is 1250s into the video and lasts for 600 s):
Code: Text  [Select][+][-]
  1. ffmpeg -ss 1250 -i input.mp4 -to 600 -c copy output.mp4


Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on January 24, 2021, 11:31:59 am
@BosseB

Quote
This works fine except for a minor issue ... It turns out that if I use ffmpeg...
I'm really pleased, that I could help You with Your VideoEditor-App, but
I still don't know, why You keep on Putting Your Questions at the wrong Place.  %)

This Thread is - and always will be - about Streaming/Playing with FFmpeg-Libraries and Lazarus.

Composing FFmpeg-CommandLines is totally different from Writing Code for FFmpeg-Libraries.
Therefore, their Issues and Points for Discussion are not comparable at all, and I do not want to merge them in this Thread !  ;D

All Questions related to FFmpeg-CommandLine-Tools, like 'ffmpeg.exe', are welcome in my FFGrab4Laz-Thread:
https://forum.lazarus.freepascal.org/index.php/topic,43411.0.html (https://forum.lazarus.freepascal.org/index.php/topic,43411.0.html).  ;)
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: BosseB on January 24, 2021, 01:19:37 pm
@BosseB

Quote
This works fine except for a minor issue ... It turns out that if I use ffmpeg...
I'm really pleased, that I could help You with Your VideoEditor-App, but
I still don't know, why You keep on Putting Your Questions at the wrong Place.  %)

This Thread is - and always will be - about Streaming/Playing with FFmpeg-Libraries and Lazarus.
Before posting I tried to find where I had discussed this earlier but failed....
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: sport123 on February 19, 2021, 02:32:22 pm
Are there ffmpeg components for Lazarus?  Like delphiffmpeg.com  ?
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on February 19, 2021, 02:44:51 pm
AFAIK no.
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: BosseB on February 19, 2021, 04:32:13 pm
@BosseB
This Thread is - and always will be - about Streaming/Playing with FFmpeg-Libraries and Lazarus.

Composing FFmpeg-CommandLines is totally different from Writing Code for FFmpeg-Libraries.
I must be missing something here (maybe not related to my project):
When you talk about ffmpeg-libraries, what are you referring to?
I thought that ffmpeg is a command line tool on both windows and linux the same, so the "library" would then become the command line interface, right?
Apparently not, so could you in simple terms discuss what the libraries are (plural and all)?

And I am genuinely being curious if there is some package that includes libraries that could ease the use of ffmpeg, no flame intended at all.

Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on February 20, 2021, 08:10:25 pm
@BosseB

Quote
I thought that ffmpeg is a command line tool
The FFmpeg-Project consists of several CommandLine-Tools and Libraries, see here (https://ffmpeg.org/documentation.html).

The FFmpeg-CommandLine-Tools have a CommandLine-Interface (CLI), and You can pass
Options to them (= FFmpeg-CommandLines), when they start and then communicate with them, when they are running.
Those Tools are: 'ffmpeg.exe', 'ffprobe.exe', 'ffplay.exe' (and 'ffserver.exe', which was removed on 2018-01-06).
Advantage: easy to use; Disadvantage: Slow Communication via Pipes and Strings, restricted to the available Options.

The FFmpeg-Libraries (LIBs) are Collections of FFmpeg-Code, where You can access their
exported Parts and use them in Your own Code as if they were inside of Your Code, means
as if You would have written that Code by Yourself.
Advantage: fast and flexible; Disadvantage: much more complex to use compared to the FFmpeg-CLIs.

Quote
so the "library" would then become the command line interface, right?
The FFmpeg-CommandLine-Tools and -Libraries are built and compiled from the FFmpeg-SourceFiles.
This Process depends on the Target-Platform and on diverse Switches, that determine which
Parts of the Sources to include in the TargetFiles (= CLIs and LIBs).

One of those Switches determines, whether the CLIs shall be built "static" or "shared":
Static means, that the CLIs will have all of their LIBs included, so that they run
independently as stand-alone Programs, which results in bigger FileSizes for each CLI.
Shared means, that the CLIs will have all of their LIBs separated, so that each
CLI is smaller, but they only run together with their corresponding LIBs (= Dependencies).
In this Case You have to add the SDL-DLL to run 'ffplay.exe', and
this is, what You need, if You want to use the FFmpeg-LIBs in Your own App.

Now, it's obvious, that there's no Need to rewrite already existing and perfectly running Code so long as
we're Talking about self-contained Tasks (e.g. Convert a VideoFormat to an other), and so long as you're
happy with the available Options for that Task.
You simply launch, e.g. 'ffmpeg.exe' with CommandLine-Arguments, and it will be executed until the Job is done.
This is covered by FFGrab4Laz (https://forum.lazarus.freepascal.org/index.php/topic,43411.0.html).

Things are different, if You want e.g. a fast and responsive MediaPlayer with special Features, like:
usually not implemented VideoManipulations, outstanding AudioQuality or TouchScreen-Support.
You actually have to write all by Yourself, where You may use already existing Codes inside of Libraries,
here 'FFmpeg', 'SDL' and 'Portaudio'.
This is covered by this Thread, called FFPlay4Laz.

The SourceCodes to use CLIs are totally different from the SourceCodes to use LIBs.
Therefore all related Issues and Discussions are totally different, as well.
That's why I've started two separated Threads, which I'd like to stay separated.

BTW:
You are just Writing a VideoEditor.
If You want it really fast and precice, You should use Libraries, too, but this is very complex, and
there is already a Bunch of really good VideoEditors, see e.g. in VideoHelp (https://www.videohelp.com/software/sections/video-editors-basic).

Understandable enough ?  :)

Quote
if there is some package that includes libraries that could ease the use of ffmpeg
For FreePascal: AFAIK no; for DelphiPascal, see the FFVCL-Site (http://www.delphiffmpeg.com).
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: lucamar on February 20, 2021, 11:16:04 pm
Quote
I thought that ffmpeg is a command line tool
The FFmpeg-Project consists of several CommandLine-Tools and Libraries, see here (https://ffmpeg.org/documentation.html).1om]FFVCL-Site[/url].

In fact, as with most *nix born projects, command-line tools are basically front-ends for the underlying libs, so when you install the command tools the linraries are also installed as dependencies.

The distinction comes about when a third party program wants to use the provided features, because there are basically two ways of doing it: running the tools in an extra process or binding to and using the libraries.

If want one wants to do can be done with the tools, the first option is usually the more easy to implement but if one wants something more, or different, or to have even more control then one must use the libraries, which is usually (logically enough) more complex.

Which is basically what metis already said :-[
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: cdbc on February 21, 2021, 06:34:19 pm
Hi metis
Cool!
I'd like a copy of your code, sounds great  ;)
e-mail: cdbc40<at>gmail.com
Regards Benny
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on February 21, 2021, 07:39:29 pm
@cdbc

Quote
I'd like a copy of your code
'RunFFmpeg', which uses the FFmpeg-CLIs is here (https://forum.lazarus.freepascal.org/index.php/topic,43411.0.html) (totally open-source).
-> GoTo "RunFFmpeg".

The last Release of the complete Player, which uses the FFmpeg-LIBs, 'SDL' and 'Portaudio' is here (https://forum.lazarus.freepascal.org/index.php/topic,26666.msg337046.html#msg337046) (partially open-source).
This Version is still with 'SDL1'. I'm currently updating the entire PlayerCode to 'SDL2', and adding some more Features.

The FPC-SourceFile for a minimal MediaPlayer with FFmpeg-LIBs and 'SDL2' is here (https://forum.lazarus.freepascal.org/index.php/topic,26666.msg373185.html#msg373185).

Quote
sounds great
:)
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on February 22, 2021, 02:16:46 pm
@lucamar

Quote
command-line tools are basically front-ends for the underlying libs
In Case of 'FFmpeg', the static CommandLine-Tools are stand-alone Programs; no more Files needed to run them.

Quote
so when you install the command tools the linraries are also installed as dependencies.
On Windows, there's no FFmpeg-Installation needed (on MacOS or LINUX, don't know - never tried it out).
You simply copy the FFmpeg-CommandLine-Tools and/or the FFmpeg-LIBs wherever You need them.
If You use the CommandLine-Tools as "shared", their Dependencies (= their LIBs) must be available, of course.

These are the Possibilities, where You can put FFmpeg-Files on Windows w/o Installation, because
Windows searches for Files in the following Sequence, when no Path is specified:
(This Explication is not meant for You, lucamar, but maybe interesting for those, You didn't know)
1. The Directory from which the Program loaded
2. The current Directory
3. The Windows SystemDirectories (= [C:\WINDOWS\system], [C:\WINDOWS\system32])
4. The Windows Directory (= [C:\WINDOWS])
5. The Directories, that are listed in the PATH EnvironmentVariable.
I use the first Option to keep may FFmpeg-Apps portabel.

Once I tried out the FFPlay4Laz-Player on LINUX with 'Wine' (https://forum.lazarus.freepascal.org/index.php/topic,26666.msg342546.html#msg342546), just out of Curiosity, and
it worked the same Way as if the Files were on Windows (only slower).
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on December 22, 2021, 04:18:45 pm
Here's the next Release of 'FFPlay4Laz2' (first fully-featured ConsoleVersion with SDL v2):

'FFPlay4Laz' is a portable, easy-to-use, ultrafast and highly responsive Lightestweight-Mediaplayer and -RenderingEngine
(no Installation needed, all in all only 88MB on Disk with all Codecs, runs from any Drive).
It renders all Audio- & VideoFormats supported by FFmpeg (http://ffmpeg.org/general.html (http://ffmpeg.org/general.html)), optionally with
outstanding, Low-Latency PortAudio-Sound (www.portaudio.com (http://www.portaudio.com)).

The currently used FFmpeg-Version is still v4.0.2 => current FFPlay4Laz-Version is v2.4.0.2.

'FFPlay4Laz v2' does the same as its Predecessor 'FFPlay4Laz v1' (https://forum.lazarus.freepascal.org/index.php/topic,26666.msg337046.html#msg337046), but
better & faster with some more PlayerFeatures added - in Detail...

> The entire PlayerCode has been updated to SDL2 - For Differences to SDL1, see "SDL vs. SDL2":
   https://forum.lazarus.freepascal.org/index.php/topic,42698.msg376063.html#msg376063 (https://forum.lazarus.freepascal.org/index.php/topic,42698.msg376063.html#msg376063),
   and especially the 'SDL 1.2 to 2.0 Migration Guide':
   https://wiki.libsdl.org/MigrationGuide (https://wiki.libsdl.org/MigrationGuide)
   -> GoTo "Overview of new features - These are the most important new features in SDL 2.0".

-> Briefly spoken:
    - better Fullscreen-Support
    - better VideoQuality with less CPU-Load through Hardware-accelerated, Texture-based VideoRendering
    - better SDL-AudioQuality through 32-bit Audio (int and float)
    - many PlayerFeatures are much easier to implement with a little Help of 'SDL2', e.g.
      the whole WindowManagement and Touch-Support.

-> Simply spoken: The entire Player runs better, smoother & faster.

> Tested with FFmpeg v4.0 + v4.1.5 and SDL v2.0.7 - v2.24.1 on WinXP SP3, Win7 and Win10.

> Edited:
   - Open/Close the Player and Resizing the Videoimage within the SDL-Window were optimized
   - Pause/Resume (<Space>, <p>) is even more responsive, now (as good as no Lag, at all)
   - Seeking (<s>) and in particular Seeking PAUSED, as well as
      Opening PAUSED have been speeded up.

> Added:
   - Optionally block a ScreenSaver, while the Player is running
   - Optionally StayOnTop for the ConsoleVersion, too ('FFPlay4Laz1' did it only for the GUI)
   - Internet-Support (only Play and Pause/Resume, no Seeking)
   - Videoframe-Dropping to make highly compressed Videos playable on old PCs with slow CPUs
   - AutoPause additionally pauses/resumes OnMinimize/OnRestore
   - horizontal/vertical Flip (<h>) and continuous Rotation (<r>) of the Videoimage
   - Seeking in MJPEG-Files (= Motion JPEGs), too (was not implemented in 'FFPlay4Laz1' yet)
   - All Videoimage-Manipulations (= X/Y-Shift/AspectRatio/Zoom/Flip/Rotation) are exposed in
     the Snapshots (<F2>), so that even shifted/zoomed/flipped/rotated Videoimages can be
     copied & saved to ImageFiles.
   - Touch-Support:
     Beside the system-immanent Touchscreen-Functions (= Move/Resize, Minimize/Maximize, Close), currently
     Pause/Resume (tap once) and toggle between a bordered/borderless SDL-Window (tap twice) are available
     via Fingertouch - More Touch-Functions, like Seeking, Volume, Move&Zoom the Videoimage are projected.

> Known Issues:
   See "Known Bugs..." in 'README_Known Issues (Dec. 2021).txt'.

> Projected:
   See "ToDos/Projected..." in 'README_Known Issues (Dec. 2021).txt'.

Attached 'FFPlay4Laz2_Images.pdf' shows:
- The Player's Console, Opening a mp4- and a MPEG-File, within typical OpeningTimes of about 200-300Ms
  on my old WinXP-PC (= an INTEL Pentium DualCore 1,60GHz, 2 GB RAM + INTEL-GPU + SoundBlaster Audigy).
  The mp4-File is opened Playing with PortAudio+ASIO for maximal Sound with minimal Latency.
  The MPEG-File is opened Paused with SDL-Audio, which is an AudioOutput, that should work on every PC.
- Next to it on the right, the FFPlay4Laz2-Folder with all required Files for FFmpeg, SDL2 and PortAudio.
- Below, the Player's Videoscreen with diverse BorderColors, bordered(= resizable)/borderless SDL-Windows, and
  some Videoimage-Manipulations (= continuous X/Y-Shift/AspectRatio/Zoom, horizontal/vertical Flip, Rotation).

Attached 'FFPlay4Laz2_Files.7z' contains
all Files for the FFPlay4Laz2-Win32-ConsolePlayer, without Dependencies (= the FFmpeg-, SDL2- and PortAudio-DLLs).
There are two Executables enclosed: One compiled with ConsoleWindow, the other one without.
Get started with the one with ConsoleWindow, because it always shows Infos & Instructions for the User
-> No Helpfile needed.

See the README-Files 'PlayerFunctions' and 'PlayerOptions' for all currently implemented PlayerFeatures.

Have Fun with superior Sound, and
Merry X-Mas 2021 to all Lazarus-Users !
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on December 22, 2022, 03:26:19 pm
Here's the next Release of 'FFPlay4Laz2' (first "wine-friendly" ConsoleVersion with SDL v2):

Updated to 'FFmpeg v5.2' => Current Version is v2.5.2.

Together with the WinXP32-compatible FFmpeg-Builds by Reino (https://rwijnsma.home.xs4all.nl/files/ffmpeg/?C=M),
this FFPlay4Laz-Version works from WinXP to Win10 and on Wine (https://www.winehq.org/) for Unix-like OSs.

Click here to download the required FFmpeg-DLLs. (https://rwijnsma.home.xs4all.nl/files/ffmpeg/ffmpeg-5.2-564-e4ac156-win32-shared-xpmod-sse.7z) Then copy all extracted Files into the FFPlay4Laz2-DIR.
(You won't need the FFmpeg-EXEs, nor avdevice-59.dll, avfilter-8.dll and postproc-56.dll to run FFPlay4Laz2)

Do the same with...
- the PortAudio (http://www.portaudio.com/)-DLL: libportaudio32bit.dll (old Build for WinXP (https://github.com/spatialaudio/portaudio-binaries/tree/portaudio-19.6.0) /  latest Builds for Win7-Win10 + Wine (https://github.com/spatialaudio/portaudio-binaries)) and
- the SDL2 (https://www.libsdl.org/)-DLL: SDL2-x.x.x-win32-x86.zip (https://github.com/libsdl-org/SDL/releases/) (tested until v2.26.1).
Now, Your FFPlay4Laz2-Folder got all required DLLs - Start the Player.

Remember, when You're using Wine, You can treat the Dependencies (= the DLLs) as if You were on Windows,
means You may simply place them into the same Folder where the depending Application is.

Note: This FFmpeg-Build additionally supports the open, royalty-free AV1-VideoCodec (AOMedia Video 1):
- https://aomedia.org/av1-features/ (https://aomedia.org/av1-features/) (AOMedia)
- https://github.com/videolan/dav1d (https://github.com/videolan/dav1d) (VideoLAN)

Tested on: - WinXP, Win7 and Win10
                 + Linux Mint v17.2 with Wine v1.6.2

See the README-Files 'PlayerFunctions' and 'PlayerOptions' for all currently implemented PlayerFeatures.

Have Fun with superior Sound, and
Merry X-Mas 2022 to all Lazarus-Users !  O:-)
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: Eleazar on March 05, 2023, 05:20:36 pm
Hello Metis,
I'm trying to understand your FFPlay4Laz project. Previously I have incorporated a video player in my application with PaslibVLC, but I was looking at alternatives.

I have tried to compile you minimalist version by gathering all necessary files from all kinds off different sources, but it is getting messy...

What exactly is FFPlay4Laz? I'm trying to find a working example with required files included in your posts, but I can't seem to find one (a Lazarus lpi project with all stuff). Would it be possible to send such a complete set?

Or is your project still partly closed source?

Could you build a videoplayer with it that is controlled from a GUI? As I understand you are currently working on a version that is embedded in a GUI?

Greetings

Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on March 07, 2023, 01:43:57 pm
@Eleazar
Tnx for being interested in my FFPlay4Laz-Project. :)
Though You could find all Answers to Your Questions in this Thread, here's a Sort of Summary...

Quote
Previously I have incorporated a video player in my application with PaslibVLC, but I was looking at alternatives.
Same with me:
In the Past, I wrote diverse Player-FrontEnds with Fmod/FmodEx (https://www.fmod.com/) (= Audio-only), VLC (https://www.videolan.org/vlc/) and the MPlayer (http://www.mplayerhq.hu), but none of them matched my Needs :( :
I wanted a really fast and compact MediaPlayer, that would play any Audio and Video from anywhere with exceptional Sound.

Quote
What exactly is FFPlay4Laz? + I'm trying to understand your FFPlay4Laz project.
FFPlay4Laz is a portable Audio/Video-RenderingEngine, that does not depend on any other MediaPlayer-BackEnd, like
VLC (https://prog.olsztyn.pl/paslibvlc/), MPlayer (http://www.mplayerhq.hu) / MPV (https://mpv.io/) or GStreamer (https://gstreamer.freedesktop.org/), so that their Installation is not required.
It's "lightestweight": The latest Release (see above) (https://forum.lazarus.freepascal.org/index.php/topic,26666.msg464784.html#msg464784) requires only 47MB of Diskspace with all Codecs and Files, and
works from WinXP to Win10 and on Linux&Wine (Win11, macOS not tested yet) w/o any Modifications to
play any Audio- and VideoFormat from the oldest to the latest one (http://www.ffmpeg.org/general.html#toc-Supported-File-Formats_002c-Codecs-or-Features), even on old and slow PCs.

Briefly spoken, FFPlay4Laz is...
- FFmpeg (http://www.ffmpeg.org/about.html): Demuxer, Decoder, Timebases
+ SDL (https://www.libsdl.org/)     : cross-platform Threads, Events, Keyboard-/Mouse-/Touch-Input, Audio-/Video-Output
+ PortAudio (http://www.portaudio.com): Low-Latency Realtime Audio-Output,
entirely written in FreePascal (FPC).

Thus merging...
the Power&Performance of FFmpeg with the Speed&Responsiveness of SDL, proven in many Videogames (https://itch.io/games/made-with-sdl), plus
the unique, crystal-clear Sound of PortAudio, which is used e.g. in UOS (https://github.com/fredvs/uos), Audacity (https://www.audacityteam.org/), Mixxx (https://mixxx.org/), or LMMS (https://lmms.io/), and
last but not least the Advantages of FreePascal-Programs (https://www.freepascal.org/advantage.var), like HiSpeed&Stability at LoMemUsage.
Note: All these Projects, that are using PortAudio are Audio-only, whereas FFPlay4Laz is Audio and Video.

Having been inspired...
initially by the Dranger-Tutorial (http://dranger.com/ffmpeg/) and finally by FFmpeg's TestPlayer FFplay (http://www.ffmpeg.org/ffplay.html) (source = ffplay.c (https://github.com/FFmpeg/FFmpeg/blob/master/fftools/ffplay.c)).

And having built in plenty of - partly "unusual" and unique! - PlayerFeatures, such as...
• reopen the last MRL with all previous Settings (Videoscreen-Position&Size, PlayerPosition, Audio-/VideoSettings), optionally paused
• switch back and forth between two Videoscreens or Monitors with just one Keystroke (<Tab>), e.g. for VideoPresentations or VJing (https://en.wikipedia.org/wiki/VJing)
• all VideoSettings (X/Y-Shift, AspectRatio, Zoom, Rotation) are stepless to Adapt any MRL to any Screen (https://forum.lazarus.freepascal.org/index.php/topic,26666.msg311955.html#msg311955) (i.e. not only in fixed Steps, as usual)
• optionally step multiple Audio-/VideoFrames at once (i.e. not only one Frame, as usual)
• seek/repeat/loop without Audio-/Video-Lags, nor Gaps
• several AutoPause-Options: OnMinimize/Restore, OnDeactivate/Activate (= Focus), OnLeave/Enter (= Hover)
• several EOF-Options: Wait, RepeatALL/FromCUEPosition, Stop, Exit
• ASIO- (https://en.wikipedia.org/wiki/Audio_Stream_Input/Output) / JACK (https://jackaudio.org/)-Support via PortAudio
• Touch-Support for Touchscreens.
(see the first 2 attached ReadMe-Files for all currently implemented PlayerFeatures)

You probably won't feel and hear the Difference to other MediaPlayers, as long as You are only Watching Movies on Your PC or Laptop.
But, if You take it for Music, MusicVideos (https://en.wikipedia.org/wiki/Music_video) or Video-Tutorials and -Presentations over HiQuality-SoundSystems, You will (or at least You should) !
Info: I use FFPlay4Laz on Windows with ASIO4ALL (https://www.asio4all.org/) and on Linux&Wine with PulseAudio (https://www.freedesktop.org/wiki/Software/PulseAudio/).

Quote
I have tried to compile you minimalist version by gathering all necessary files ...
To compile it, You need the Delphi/FPC-Headers for FFmpeg (http://www.delphiffmpeg.com/headers) and for SDL (https://github.com/ev1313/Pascal-SDL-2-Headers). To run the compiled Executable, You need their Libraries (see above (https://forum.lazarus.freepascal.org/index.php/topic,26666.msg464784.html#msg464784)).
The currently used FPC-Headers are always listed in the respective README_Credits-TextFile (see attached 'README_Credits (Dec. 2022).txt').
FFmpeg is under heavy Development, so You always need the corresponding FFmpeg-Headers and -LIBs. The SDL-API does not change that much.
That's why, I introduced a special Way of VersionCounting in FFPlay4Laz, here (https://forum.lazarus.freepascal.org/index.php/topic,26666.msg286945.html#msg286945) (-> GoTo "Changed: VersionCounting").
This Way, You always know, which FFmpeg- and SDL-Version to use.

Quote
I'm trying to find a working example with required files included in your posts, ...
Can't post it here, because of the 500KB-Limitation for Attachments in this Forum, and especially because of LicenceRestrictions with FFmpeg (http://www.ffmpeg.org/legal.html).
To avoid "LicenseIssues", it's better not to distribute FFmpeg directly, but to provide a Link to download it, like this one (https://rwijnsma.home.xs4all.nl/files/ffmpeg/?C=M).
It's also recommended to use the FFmpeg-LIBs (= DLLs in Windows) than to implement FFmpeg-SourceCode in a Project.

Quote
Could you build a videoplayer with it that is controlled from a GUI? As I understand you are currently working on a version that is embedded in a GUI?
Yes, via the FFPlay4Laz-Library.
For FFPlay4Laz1 (= with SDL1), this was done together with a Demo-LCL-GUI and its Lazarus-ProjectFiles, here (https://forum.lazarus.freepascal.org/index.php/topic,26666.msg337046.html#msg337046).
-> Download attached 'FFPlay4Laz-1.4.0.2_CLI+LIB+GUI.7z': The Version is 'v1.4.0.2', so You need 'SDL v1.2.15' + 'FFmpeg v4.0.2' + PortAudio.
The latest Version of FFPlay4Laz2 (= with SDL2) is posted above (https://forum.lazarus.freepascal.org/index.php/topic,26666.msg464784.html#msg464784), along with the Links to all required LIBs and a Description of how to use them.
For the Moment, it's Console only. Lib and Demo-GUI are projected.

Hope, this Summary was helpful for You  :)
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: Fred vS on March 07, 2023, 03:07:17 pm
@metis: No plan in 2023 to have NON(!)-EXE FFPlay4Laz on GitHub or GitLab or CodeBerg or other git server?
(And so in OPM too)  ;)

Fre;D
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on March 09, 2023, 07:41:29 pm
Hi Fred !
Do You mean 'OPM' like "Online Project Management" (for me) or 'OPM' like "Operating Profit Margin" (for others) ?  :D

You've already mentioned this Option some Years ago, and I've listed my Reasons, why I prefer the Lazarus-Forum (https://forum.lazarus.freepascal.org/index.php/topic,26666.msg373192.html#msg373192).
Refering to Point "3. One never knows, who's the next Gitxxx-Owner.", I think it's worth mentioning that
GitHub is headquartered in California, and has been a Subsidiary of Microsoft since 2018.

At that Time, I started a Thread (https://forum.lazarus.freepascal.org/index.php/topic,50973.0.html) to get this Point discussed. I still think, it only makes sense for Teams of Developers, but
FFPlay4Laz, FFGrab4Laz (https://forum.lazarus.freepascal.org/index.php/topic,43411.0.html) and FFInfo4Laz (https://forum.lazarus.freepascal.org/index.php/topic,22038.msg208700.html#msg208700) are private, non-commercial One-Man-Projects.
Sorry, makes me sleep better, this Way. (bloody HobbyProgrammer ::) )

Or is there any other Reason ?
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: Fred vS on March 10, 2023, 12:33:51 am
...
Or is there any other Reason ?
No, the same than before, easier for the users, better visibility, easier for patch, ...
By the way if you prefer a European non-profit organization, based in Germany, with same look as GitLab, there is CodeBerg (https://codeberg.org/).

But ok, I will try again next year...  ;)
Title: Re: NON(!)-EXE FFPlay4Laz
Post by: metis on March 12, 2023, 03:04:33 pm
Quote
..., easier for the users, better visibility, easier for patch, ...
Sorry, but I still don't see any Advantage for small Projects, like mine:
- those, who are interested, may activate [Notify] to get always informed about Updates
- the DLLs themselves must be downloaded in any Case, with or without a Gitxxx
- got all the SourceCode well-structured on my Disk. There are no Patches.

Codeberg e.V. (https://codeberg.org/) sounds most promising:
- situated in Germany, far away from American Patents, and "other ongoing Activities in Eastern Europe"
- owned by the Users
- non-profit, which means here more precisely, that as a German "e.V." (= eingetragener Verein),
   they are not allowed to be "primarily economically active" according to German Law.

BTW: They emphasize on their Website, that "Your data is not for sale", so
apparently there are some Places in this World, where it is. :D

Actually, there's only one Thing, that might be interesting for me:
To be added to the List of Applications that use PortAudio (http://www.portaudio.com/apps.html).
To do this, they need a Website, where People can read about the App and download it w/o Registration or Password.
(Could be interesting for Your 'UOS', too. ;) )

Note: 'VLC' is still listed there, though they dropped 'PortAudio' some Years ago (https://wiki.videolan.org/Documentation:Modules/portaudio/),
among others because of AudioSync-Issues.

Quote
I will try again next year...
Always Looking forward to a Chat with You. :)
TinyPortal © 2005-2018