I have been playing around with DSPack, it can play avi and wmv files, but it is not playing mp4 files. i have installed ffdshow codec but still it wont play any other format. I read somewhere that i need to use ffdshow filter, but there is very limited documentation on how to do so... Can someone help me out here?
Edit
Thats the error i get when playing any other format
raised exception class EDirectShowException with message 'C ($80040265).'. Process stopped. Use Step or Run to continue.
and thats the function which pops the exception
function CheckDSError(HR: HRESULT): HRESULT;
var Excep: EDirectShowException;
begin
Result := HR;
if Failed(HR) then
begin
Excep := EDirectShowException.Create(format(GetErrorString(HR)+' ($%x).',[HR]));
Excep.ErrorCode := HR;
raise Excep;
end;
end;
Edit
I installed the haali demultiplexer, it was a self installer after installation i still get the same error. and the gdcl demultiplexer, those are two dll files, any suggestions on how to use them?
PS: I have never worked with codecs and/or this kind of stuff, so sorry for being so thick, And i am using Windows 7 x64
I can successfully play *.mp4 files with the "DSVideoWinDowEx\PlayWin" demo application that ships with DSPack. Windows 7 includes the mp4 codec, so this should not be an issue. Make sure that you're not running your application in debug mode, because many codecs refuse to work if a debugger is active.
The Haalie Media Splitter is not used for my test *.mp4 files. But it uses the AC3Filter. So your problem could also be a missing audio codec.
If that doesn't fix the issue then the question might be: "Why does it not work on your PC?"
In order to further narrow down the issue try playing the video with GraphEdit or GraphStudio and see if that works. These tools will also show the filter graph that is used. You can also show the FilterGraph that is used in your DSPack application.
If you install a DirectShow filter (codec) on your system, it will be used automatically by DirectShow/DSPack. You could register a filter in the system manually by calling regsvr32 "path_to_codec.ax", but this is usually done by the installer. It is possible to manually use a filter in DirectShow, but most of the time this is not needed.
lavfilters provide everything you will need with source splitters and decoders. It's open source, actively developed and based on ffmpeg. If you can't playback the mp4 after installing lavfilters then I would say there is a problem with the mp4 itself. In this case use something like ffprobe to inspect the file or post a link to the file.
Related
I want to play a video in Delphi.
This is the code that I've got:
if OpenDialog1.Execute then
begin
MediaPlayer1.FileName:=OpenDialog1.FileName;
MediaPlayer1.Open;
MediaPlayer1.Display:=pnlVideo;
MediaPlayer1.Play;
end;
But I get an error message:'The specified file cannot be played on the specified MCI device.The file may be corrupt, not in the correct format or no available file handler available for this format.'
The format of the video that I use is avi.
All help is appreciated.
There is a compatibility issue with the media player component in Delphi on our "modern" computers. I'm not tech savvy on what exactly the problem is :P. It is best to make your own component in Delphi to play media.
This link can help you make a Windows Media Player component, or you can adjust it to make another active X media player component - such as VLC.
https://chapmanworld.com/windows-media-player-in-delphi/
I hope this will help. :D
I'm working with libffmpeg in an iOS app. My goal is to connect to an RTSP source and write the media out to a file that can later be used with the iOS media player. Ideally I'd like to do this without transcoding the incoming data. I also want to be able to later re-encode the media with AVAssetExportSession if the user chooses to do so.
Because I want to create a file that is compatible with iOS, I'm limited (I believe) to mpeg, mp4 or quicktime (mov) formats.
Whenever I try to use one of these formats, I see the following warnings during my call to avformat_write_header:
[mov # 0x16401c00] Codec for stream 0 does not use global headers but container format requires global headers
[mov # 0x16401c00] Codec for stream 1 does not use global headers but container format requires global headers
My understanding is that the header wants to know the ultimate file size, which I do not know (the RTSP server is live streaming a camera, and the user stops the recording whenever they want). I guess that makes sense, but I know that others have successfully done this using the ffmpeg command line, so I'm confused as to what else I need to do here.
If I ignore the warning, I can still proceed with writing the file. If I choose mpeg or mp4 formats, my app crashes when I call av_write_trailer. If I use mov, I can successfully close the file, and the file does play back, but usually fails when I try to hand it to the AVAssetExportSession.
I would appreciate any insight into this. Thanks.
Frank
I found what appears to be a solution -- at least, it eliminates the warning. I had to set the CODEC_FLAG_GLOBAL_HEADER on both the audio and video codecs, before calling avcodec_open2.
I'm trying to load a YouTube video into a TWebBrowser in Delphi XE7 and I'm getting an error that says this:
Adobe Flash Player or an HTML5 supported browser is required for video playback.Get the latest Flash Player
Learn more about upgrading to an HTML5 browser
I can load normal HTML just fine.
The examples I've found posted here earlier are for much older versions of Delphi, so I'm wondering if this is an issue with newer versions, or TWebBrowser, or something in my environment (VMWare 7 with Windows 7).
EDIT: My objective is simply to be able to load and play a video from a URL, like a YouTube video. Solutions other than TWebBrowser are fine, especially if they can run cross-platform.
You are wondering whether your problems relate to Delphi version. Well the WebBrowser control is a system control. Delphi version is not relevant because the service is provided by the underlying system. If anything has changed it is likely to be the way You Tube delivers videos.
If you are crafting the HTML that embeds the remote video then you should follow the latest documentation from You Tube as to how it should be done. Don't use years old Delphi specific articles as your guide. Use modern articles specific to the latest technology used by You Tube.
I do have a feeling, although you don't state so in the question, that you are using an old and possibly deprecated method to embed a You Tube video. Use an iframe as described here: http://www.w3schools.com/html/html_youtube.asp
Adobe Flash Player or an HTML5 supported browser is required for video playback.
Your WebBrowser control will, in the absence of you taking specific steps otherwise, be using a legacy IE browser engine. So it won't have HTML5 support. And perhaps not even Flash support, that is if You Tube is still prepared to serve videos as Flash. Nowadays HTML5 is preferred. Not least because modern browser support it out of the box and there is no need for third party Flash plugin installation.
One way to opt in to using a modern HTML5 browser with the WebBrowser control is to make explicit registry settings (browser feature emulation), and perhaps specify a DOCTYPE. More details here: How to have Delphi TWebbrowser component running in IE9 mode? Although that question specifically asks about IE9, the documentation links in the answer provide details for other IE versions.
If you don't have control over the HTML document then you will need to use the above method.
On the other hand, if you do control the content of the HTML document then there is another way. You can place this
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
as the first item in your page's <head>. The meaning of edge is the latest version of IE. If you wish to target a specific version, e.g. IE9 then you would use:
<meta http-equiv="X-UA-Compatible" content="IE=9" />
More info on this here:
https://msdn.microsoft.com/en-us/library/ms533876.aspx
https://www.modern.ie/en-gb/performance/how-to-use-x-ua-compatible
How to put the WebBrowser control into IE9 into standards?
Older versions of IE do not support this header and if you need to cater for them then you are back to browser feature emulation in the registry. Thanks to #whosrdaddy and #TLama in the comments, it seems that IE8 introduced support for X-UA-Compatible.
As stated before I belive using TWebBrowser is the wrong way arround, because you have to little control about you video. Because then you have control over the video playback you self.
*** NOTE ****
DIRECT streaming of YouTube videos breaks the terms of service
*** NOTE ****
As i prommised you I've made an example here of howto play a youtube video on a Wincontrol ex. TPanel.
Since the example includes code for parsing the youtube URL and code for parsing the sourcecode of the youtube page where the video is embedded I can not post the complete source code here. And you have to get it from this link here
I'll here go trough the main idea of my exampel.
first a screenshot of the final result:
The first thins to is are to import the WindowsMediaPlayer system component (not to be confused with the one ships with Delphi) and save WMPLib_TLB.pas alon with the project source.
Next step is do declare a private instance of the class:
WindowsMediaPlayer: TWindowsMediaPlayer;
And in formCreate, create an instance af set it up:
procedure TMainform.FormCreate(Sender: TObject);
begin
WindowsMediaPlayer := TWindowsMediaPlayer.Create(Panel2);
WindowsMediaPlayer.Parent := Panel2;
WindowsMediaPlayer.Align := TAlign.alClient;
WindowsMediaPlayer.Visible := True;
WindowsMediaPlayer.Settings.AutoStart := True;
WindowsMediaPlayer.uiMode := 'none';
with TYoutubeThread.Create('https://www.youtube.com/watch?v=7vkYiCdn834') do
OnTerminate := YoutubeThreadTerminate;
end;
Next step is to create an TYoutubeThread. TYoutubeThread is a thread that will get the HTML sourcocode of the requested youtubepage and parse it in order to get the information about the embedded video. The sourcecode for this thread are to be found in the complete example.
When the thread terminates we need to setup the GUI :
procedure TMainform.YoutubeThreadTerminate(Sender: TObject);
var
YoutubeThread: TYoutubeThread;
begin
YoutubeThread := Sender as TYoutubeThread;
if YoutubeThread = nil then
exit;
//The information list are sorted my number of pixels in the video
FInformation := YoutubeThread.Youtube.Informations.Last;
Caption := Format('%s %s (%dx%d)', [YoutubeThread.Youtube.Title, FInformation.Quality, FInformation.Size.cx, FInformation.Size.cy]);
Panel1.Visible := True;
Width := FInformation.Size.cx + 50;
Height := FInformation.Size.cy + Panel1.Height + 50;
WindowsMediaPlayer.URL := FInformation.VideoLink;
TrackBar1.Max := 0;
end;
Ive omitted two units, they can be downloded here http://pastebin.com/TqCUV9tg
and here http://pastebin.com/WFGctwrf. And you'll lso need a copy of SuperObject
Or you could download the complete working example here
I'm developing some Video Editing Apps on Android.
the objective of the app is "Editing Videos on Android".
and...
I'm just completed making video file using some images.
but.. I can't attach audio into the video.
my method is same as follows.
1.VideoStream, audio stream creation using AVFormatContext
2.Movie encoding in video stream was successful
3.Encode codec open in audio stream was successful
4.Set sample format to AV_SAMPLE_FMT_FLTP
5.Sample rate and channel was set same as source audio
6.Choose appropriate Decoder and read packet
7.Convert packets using swr_converter, setting same as sample format
8.Encode converted data
9.memory deallocation
10.END!
Problem is here:
Video of finally created video file was normally played. but the Audio wasn't.
It heared like weird. It have many noises and plays slowly.
I've googled with many keywords but they only say about "FFmpeg command line usage".
I wanna make with FFMpeg API. not a Command line tool.
Please help.
Your question is vague without some kind of code to go along with it, as trust me there are a lot of things that can go wrong when using ffmpeg's libraries directly (and on Windows there is no debuging). Unfortunately ffmpeg's libraries are not well documented so it is generally best to read the source code for ffmpeg in order to use its libraries. Find the equivalent command line options to perform what you want and track that through ffmpeg's source to see the library calls.
I'm using the Clootie DirectShow9 headers with Delphi 2007. I created a wrapper component that plays audio and video. All is good until I get an MP3 that has album art encoded in it. The mp3 files like this just will not play. I do not get an error message from my code when I call pMediaControl.Run;. pMediaControl is IMediaControl. They just do not start playing. I many other MP3 files that are not encoded with album art and they play fine. There must be something I'm missing but I cannot figure it out.
These art encoded mp3 files play OK in WMP and Winamp on the same PC.
Can someone shed some light on this for me?
Thanks
I have also hit that one (or was it VFW_E_UNSUPPORTED_STREAM).
It's because the metadata is currupted, or when the image-size is very big.
(editing the Tag in Winamp sometimes helps)
I read a little about Media Foundation and it and look like it is available only on Vista and up. I need Windows XP support for now.
I'm going to use the bass.dll and the delphi wrapper unit. I've done some testing already and all my problem mp3 files play with bass.
I wanted to stay away from using a third party component / dll but my time to finish this project is getting slim.
http://www.un4seen.com
The download includes many Delphi samples. So far the library has worked great.