I am trying to play a mp3 file from Firemonkey XE7 windows application. It should have been a simple task by putting a TMediaPlayer component, assigning it a .mp3 file, and just playing it. However, I get the following error:
Application Error
Exception EReadError in module MediaPlayerTest.exe at 00000000000012139E.
Error reading MediaPlayer1.FileName: Unsupported media file testfile.mp3.
I have also tried .wav, and it didn't work either.
(Audio codec have already been installed and the media files can successfully be played by windows media player.)
I then try compiling the very same program on another computer, and it can be compiled successfully and the mp3 plays just fine.
Does anyone know why it doesn't compile on one computer but does on another?
XE7 used DirectX for audio/video playback. Likely something is messed up with your directx installation. I noticed this problem first on a VMWare virtual machine, TMediaPlayer is unable to play anything all file types are unsupported. However same program running on my host worked fine.
Try reinstalling DirectX.
Same problem here In a VM, host machine.. tested on a few other PC's as well with the same result. Delphi 10.2.
I tracked it down to TWindowsMedia.InitVideoMixingRenderer9 in FMX.Media.Win which includes this in calculating Result:
Succeeded(FVMRFilterConfig9.SetRenderingMode(VMR9Mode_Windowless));
GetLastError returns 126,
ERROR_MOD_NOT_FOUND
126 (0x7E)
The specified module could not be found.
Changing that call to pass in VMR9Mode_Renderless works (at least for me). I didn't dig into the why/what of this. I'm also just playing audio, no video.
Just thought I'd pass along a workaround in case it's helpful.
It appears to be a limitation of Direct X when installed in a VM. I installed a different media codec (the basic k-lite codec pack) and the player worked fine after that without any code changes. Also, filed a bug report so hopefully R&D can address it
I've got some very similar errors.
And there are more than one cases:
Problem in mp3. Some Mp3 is unsopported by standard TMediaPlayer. May be it can be fixed by registering of your codec (view list item 3)
If you tried to use TMedia you can't open any media file until
you not created TMediaPlayer in any place of your code and filled
its FileName property. It's very strange, because
TMediaCodecManager.RegisterMediaCodecClass('.mp3', SVMP3Files,
TMediaType.Audio, TWindowsMediaCodec); is called if you have
FMX.Media in uses.
Problems in codecs. You can find example in FMX.Media.Win unit, how to register new codec for your app.
Hope this information will help you.
I'm not familiar with XE7, but in earlier versions the TMediaplayer used the windows mediaplayer. So the behaviour relies on the actual installed version of the windows player on the computer. This explains the different behaviour on the two computer.
You also can use an external player such as real player or other. Use shellexecute to start the external player. Third party player give more details to run mp3.
Related
I'm updating an existing GLScene app to Delphi 10.3. I've got latest GLScene installed (from https://sourceforge.net/projects/glscene/) but TGLSceneViewer component is causing an error.
Even on a new project when I drop a TGLSceneViewer on a form I get Loadlibrary failed with error 126;
Pressing 'OK' and Delphi crashes out back to Windows desktop; it kills the IDE without any dialog or error. (As you can see, already placed TGLScene component GLScene1 doesn't error.)
I've used ProcessMonitor to try to find the problem (as directed by responses to LoadLibrary 126 errors);
So the error appears to be missing 'd.DLL'. That must be an invalid dll name so is there some installation issue?
Has anyone come across this problem? Thanks!
UPDATE:
So I've dug through the GLScene source to try to find references that might be related to 'd.DLL'.
In the screenshot below ('Messages' section) there are references to constructed dll names (CUDARTDLLNAMES[I] + '.dll' and CUFFTDLLNAMES[I] + '.dll') in CUDA_Runtime.pas and CUDA.FourierTransform.pas. It is possible these could create the name 'd.DLL' except that 'DLL' is not capitalised in the code?! I'm just scratching around here for a solution.
Also interesting that file 'Imports.Newton.pas' refers to four dll files that are not included in the install externals folder;
newton32d.dll, newton32s.dll, newton64d.dll and newton64s.dll
Again, I don't know if that's relevant as far as TGLSceneViewer successfully loading in Design mode.
Thanks again for your help.
It seems you haven't install GLScene properly on your system.
Based on the fact that you seem to be missing required dynamic library I guessing you have skipped 2. step in Instalation instructions for GLSCeene
You should always read the accompanying documentation. This will be especially important when you will be distributing your application to end users since documentation has detailed information about dependencies that needs to be shipped with your application for it to function properly.
So after a lot of trying to identify what 'd.DLL' was I narrowed it down to 'PhysXwrap32.dll' because by renaming that to 'd.dll' I then got a different (access violation) error, i.e. things had moved on a bit! In fact the 'earth.exe' demo program ran to some degree (no texture) after placing d.dll in the exe folder and ignoring the access violation error on startup.
Anyway, it was clearly messed up so I tried some other GLScene installs. All the versions installed fully in Delphi 10.3 IDE with packages registered and components available but still I was getting Loadlibrary error 126 when dropping TGLSceneViewer on a form.
Eventually I found and installed 'GLScene_v1.8_for_RX_10.3_Rio.7z' and finally didn't get that 126 error! I got another error instead, Loadlibrary error 87. This is normally related to graphics driver issues. So following various posts about that I disabled the onboard Intel 630 graphics and made sure the AMD drivers were up to date.
After a restart finally I can use TGLSceneViewer!
So I've got GLScene v1.8 installed and working on Delphi 10.3. Maybe the graphics card conflict is also related to the problems with GLScene v2 but it was showing a different error (Loadlibrary 126 instead of 87). I'll try it sometime when I've nothing else to do, haha.
Thanks for your help and interest.
I've been investigating various method of exporting video from my FMX application, in particular mp4 using the h.264 codec. One method is to use FFmpeg with the FFVCL components. The down side of this is that including FFmpeg dlls with my application increases the download size. The other problem is the licensing issue of using the libx264 encoder. There is a free to use libopenh264 encoder but isn't as good as it only supports the Baseline profile.
However, Windows has video encoding built in which includes the full h.264 with High profile (mfh264enc.dll). This seems like the ideal solution for high quality video export while minimising the size of my application and avoiding licensing problems. The following page gives information on the video encoding interface in Windows.
https://learn.microsoft.com/en-us/windows/win32/medfound/overview-of-encoding-in-media-foundation
My question is how can I call this from Delphi to export video from a sequence of images stored in TBitmap? My application is FMX but initially only for Windows. Has anyone already created a Delphi interface for video encoding using the built in Windows dlls? I don't have much experience with calling dlls from Delphi. How much work would it be to create an interface myself?
I would like to determine various properties from a video file (eg MP4) such as the length of the video etc but I have no experience of working with multimedia Can anyone help
Thanks
MIke
You don't need to use DSPack for this task.
Use the dll version of the MediaInfo library (the download comes with a Pascal demo and Google/Bing/Yahoo!/whatever come for more). Plus, you don't rely on the installed codecs of a machine as MediaInfo is independent.
I have tried many webcam components for delphi XE (Tcamera, TJVAviCapture, sources codes I found...) Mostly of them work on my desktop computers, but does not work on my maptop (tested with 2 laptops).
They open this source video window, and then webcam panel.
Some of them work in DELPHI IDE but not in .exe generated by delphi !
Does someone know a reliable component (or a snippet) that simply display the webcam on any laptop or dektop without showing that video source window ?
Regards
I've been using the Mitov Video Library for several years to do this sort of thing and am very happy with it. It's run my webcam application on many hundreds laptops and desktops all over the world without any problems. Free for non-commercial use. Regularly updated. Good support. Source code available.
http://www.mitov.com/screenshots/videolab
I was in a project where I must be able to play almost audio/video files (format).
The requirements:
Video:
.dat (vcd & svcd)
.vob (dvd)
.rmvb (real media)
.mp4 (mpeg4/x264/h264)
.wmv/.asf (windows media)
.avi (xvid/divx/mpeg2,etc...)
.mkv (matroska, optional)
Audio:
.mp3 (you probably know this)
.ogg (vorbis)
.wma (windows media)
.wav (wave)
I already have all of the above codecs installed and working perfect on my system (tried it with WMP 10, Media Player Classic Home Cinema, VLC & Zoom Player).
And I have already tried the basic TMediaPlayer but can't work on other beside .avi for video, then i grab DSPack but it can't play .avi (xvid/divx) nor .mkv, i grab VLC but it's only gave me more headache because it was only ActiveX wrapper (no pure vcl component).
Can someone suggest another component? Free or open source would be preferred.
Edit:
I already solve issue with DSPack, it looks like I have to use always FDDShow for video playing using DSPack.
You can import the WMP 10 ActiveX control (Component->Import Component menu item), and then embed WMP into your application.
Since it's part of the operating system, can't get any more free than that; if you can run your Delphi app, the OS is there. :-)
DSPack was going to be my suggestion. I'm not sure what problems you had with DivX - I've used the free DivX codec with a DSPack-based program for years. FFDShow looks like a promising solution, too, although I've experienced problems with the quality of playback (tearing, low frame rates, instability when playing for a long periond, etc.) for some types of files. The video hardware and drivers are also very important, and unless you're supplying the complete hardware, software and image package, the users of your program may run into different problems in terms of the subjective acceptability (to them) of the playback. Keep that in mind - codec versions are important, driver versions are crucial, and some hardware just doesn't work right, no matter what the manufacturer says.