Recent

Author Topic: NON(!)-EXE FFPlay4Laz  (Read 100217 times)

metis

  • Sr. Member
  • ****
  • Posts: 300
NON(!)-EXE FFPlay4Laz
« 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,
I've started to build a FFmpeg-based MediaPlayer for Lazarus, which
is NOT "only" using FFmpeg's 'ffplay.exe' (= "NON(!)-EXE").

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

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

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

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

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

The last Release with SDL v1 (= fully-featured Player, CLI + DLL + Test&Demo-GUI with Source) can be downloaded here.

Releases with SDL v2 can be downloaded from here onwards.

• For a Summary of my FFPlay4Laz-Project, see here.

Have Fun with superior Sound  :)
« Last Edit: March 27, 2023, 05:31:09 pm by metis »
Life could be so easy, if there weren't those f*** Details.
My FFmpeg4Lazarus = FFPlay4Laz + FFGrab4Laz + FFInfo4Laz

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11943
  • FPC developer.
Re: NON(!)-EXE FFPlay4Laz
« Reply #1 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)

metis

  • Sr. Member
  • ****
  • Posts: 300
Re: NON(!)-EXE FFPlay4Laz
« Reply #2 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/

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

« Last Edit: December 09, 2014, 02:12:19 pm by metis »
Life could be so easy, if there weren't those f*** Details.
My FFmpeg4Lazarus = FFPlay4Laz + FFGrab4Laz + FFInfo4Laz

metis

  • Sr. Member
  • ****
  • Posts: 300
Re: NON(!)-EXE FFPlay4Laz
« Reply #3 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
-> 'src\audioengine_ffmpeg.pas'  ;)


« Last Edit: February 28, 2015, 01:34:57 pm by metis »
Life could be so easy, if there weren't those f*** Details.
My FFmpeg4Lazarus = FFPlay4Laz + FFGrab4Laz + FFInfo4Laz

aradeonas

  • Hero Member
  • *****
  • Posts: 824
Re: NON(!)-EXE FFPlay4Laz
« Reply #4 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.

metis

  • Sr. Member
  • ****
  • Posts: 300
Re: NON(!)-EXE FFPlay4Laz
« Reply #5 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.
« Last Edit: August 19, 2016, 06:32:32 pm by metis »
Life could be so easy, if there weren't those f*** Details.
My FFmpeg4Lazarus = FFPlay4Laz + FFGrab4Laz + FFInfo4Laz

aradeonas

  • Hero Member
  • *****
  • Posts: 824
Re: NON(!)-EXE FFPlay4Laz
« Reply #6 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?

metis

  • Sr. Member
  • ****
  • Posts: 300
Re: NON(!)-EXE FFPlay4Laz
« Reply #7 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).

Meanwhile I aim to reproduce ANY Audio and ANY Video -> FFmpeg.  :D
Life could be so easy, if there weren't those f*** Details.
My FFmpeg4Lazarus = FFPlay4Laz + FFGrab4Laz + FFInfo4Laz

aradeonas

  • Hero Member
  • *****
  • Posts: 824
Re: NON(!)-EXE FFPlay4Laz
« Reply #8 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
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.

TurboRascal

  • Hero Member
  • *****
  • Posts: 672
  • "Good sysadmin. Bad programmer."™
Re: NON(!)-EXE FFPlay4Laz
« Reply #9 on: March 03, 2015, 09:38:21 pm »
This is VERY interesting indeed...
Regards, ArNy the Turbo Rascal
-
"The secret is to give them what they need, not what they want." - Scotty, STTNG:Relics

metis

  • Sr. Member
  • ****
  • Posts: 300
Re: NON(!)-EXE FFPlay4Laz
« Reply #10 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
-> 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
« Last Edit: March 14, 2015, 04:54:49 pm by metis »
Life could be so easy, if there weren't those f*** Details.
My FFmpeg4Lazarus = FFPlay4Laz + FFGrab4Laz + FFInfo4Laz

mercury

  • Full Member
  • ***
  • Posts: 154
Re: NON(!)-EXE FFPlay4Laz
« Reply #11 on: March 11, 2015, 04:20:52 pm »
amazing. mark.
please keep going.

aradeonas

  • Hero Member
  • *****
  • Posts: 824
Re: NON(!)-EXE FFPlay4Laz
« Reply #12 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

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1263
Re: NON(!)-EXE FFPlay4Laz
« Reply #13 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
« Last Edit: March 11, 2015, 09:14:43 pm by Mike.Cornflake »
Lazarus Trunk/FPC Trunk on Windows [7, 10]
  Have you tried searching this forum or the wiki?:   http://wiki.lazarus.freepascal.org/Alternative_Main_Page
  BOOKS! (Free and otherwise): http://wiki.lazarus.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines

metis

  • Sr. Member
  • ****
  • Posts: 300
Re: NON(!)-EXE FFPlay4Laz
« Reply #14 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.
« Last Edit: March 14, 2015, 04:57:05 pm by metis »
Life could be so easy, if there weren't those f*** Details.
My FFmpeg4Lazarus = FFPlay4Laz + FFGrab4Laz + FFInfo4Laz

 

TinyPortal © 2005-2018