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" in this Forum
http://forum.lazarus.freepascal.org/index.php/topic,22038.0.html (http://forum.lazarus.freepascal.org/index.php/topic,22038.0.html),
I started to build up a FFmpeg-Player for Lazarus, that is NOT "only" using the FFmpeg-EXEs.

For FFmpeg-EXEs there is already plenty of Documentation, CodeSamples and Examples for
how to use them, as well as FrontEnds.

But, what's about the cute, little FFmpeg-DLLs ?

For anyone, who's interested in Stuff like this, the best Entrance 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 found in Ultrastar and grape3D.

=> Current ProjectState:
- Open/Read/Decode/Close MediaFile            : done
- Get Infos about the MediaFile                     : done (= "Retrieving Data from VideoFiles" )
- Video-Output via SDL's YUV-Overlay          : done
- Video-Output via SDL's RGB-Surface          : started, but not so important for me
- Video-Output using the 'LazOpenGLControl': done
  (This Part includes Code to X/Y-Shift, Flip horizontally/vertically, Zoom, Rotate)
- Audio-Output via SDL-Audio                      : done
- Audio-Output via Portaudio                        : done
- Threading, AV-Synching                            : done
- Seeking, Looping                                      : done

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

The latest major Release of 'FFPlay4Laz' (first GUI-Version) can be downloaded here:
https://forum.lazarus.freepascal.org/index.php/topic,26666.msg337046.html#msg337046 (https://forum.lazarus.freepascal.org/index.php/topic,26666.msg337046.html#msg337046)

Have Fun  :D
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: indigo80 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: indigo80 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 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).  :)  :)  :)