@Mike.Cornflake
http://dranger.com/ffmpeg/
I already know that: Together with Ultrastar-SourceCode, it's with what I started my FFPlay4Laz-Project.
The Dranger-Tutorial explains, how to write a minimal FFmpeg-
Player; nothing at all about Grabbing/
Encoding, only
Decoding.
My FPC-Port of the C-Files, that came with the first Dranger-Release is attached, here:
http://forum.lazarus.freepascal.org/index.php/topic,26666.msg196377.html#msg196377This Port is kept as near as possible to the original C-Code to make it easier to compare the FCC-Code with the
corresponding C-Code in Order to alleviate
"Converting from C++ to Pascal ALWAYS breaks my head".
-> Actually, I'm Looking for
something similar to that Dranger-Tutorial for Recording/Encoding.
https://www.ffmpeg.org/doxygen/trunk/muxing_8c-example.html
I already know that: It's one of the Sample-C-Files, provided by 'FFmpeg'.
You can find a
DelphiPascal-Port of it, and all the other FFmpeg-Sample-C-Files, here:
http://www.delphiffmpeg.com/headers/The CodeSamples are in the "examples"-Directory, and can easily be converted, with the Lazarus-ConversionTool:
Laz-IDE: [Tools] -> [Delphi-Conversion] -> [Convert Delphi Project to Lazarus Project...].
Note: This does not convert to FPC; it's all left in Delphi-Mode.
here's a more complete example
Now, Things are getting new for me - I had a quick Look at it:
It only grabs VideoFrames (Camera/Desktop); no Audio implemented, but this should go the same Way.
The Parameters for the OutputFile are set in "/* set property of the video file */", quite similar to the CommandLine-Arguments for 'ffmpeg.exe'.
Obviously, this Guy wanted a simple Solution to create "animated ScreenShots", that can be uploaded to a Net.
Unfortunately, he does not mention, which FFmpeg-Version is used.
Still not convinced, why to start something similar to 'FFPlay4Laz' for Recording, because:
1. my Sparetime is limited, as well
2. I'm sufficiently occupied with the FFPlay4Laz-Player
3. it makes no Sense for me, because for Recording I use the
'PowerDirector' (Shareware, closed):
https://www.cyberlink.com/.
Apart from that the available Containers and Codecs are very limited (surely for Copyright-Reasons), it's a very powerful and
fast Tool for Audio/Video-Recording and(!) -Editing. If needed, the Result can be transcoded easily.
4. it makes no Sense in General, because...
- A Player only decodes and renders, whereas a Recorder gets disproportionately complex, if You incorporate all the
Variety of possible Options, like In-/Output(s), Container, Codecs, all/some Streams (Audio(s), Video(s), Subtitle(s)),
Resolution, Aspect, Bitrate, Samplerate, and, and, and... (endless).
'ffmpeg.exe' already does Recording/Encoding/Transcoding whatever You want correctly(!), very fast, and very elaborated(!).
- A Player should be responsive at several Points (Open, Seek, Pause/Resume, Close, etc.), whereas
a Recorder only has to respond fast, when Recording is started and stopped. All the Rest, so the Processing itself, can also be delegated to a CLI, using Pipes.
ergo: A Laz-GUI for Recording with 'ffmpeg.exe' only has to...
- hide the ConsoleWindow
- enumerate the available Inputs
- pass CommandLine-Arguments
- redirect StdErr and StdOut and communicate via Pipes
- display the currently processed VideoFrame (= the MainProblem)
'WinFF' (open) and 'dmMediaConverter' (closed) already do Transcoding. The only Thing, that is missing for Lazarus is Recording, and
the only Thing, that was missing was a Tool to check quickly(!) the In- and OutStreams = 'FFInfo4Laz' and 'FFPlay4Laz'.