PDA

View Full Version : Video streaming



somnathbanik
3rd November 2010, 05:46
Hi,
I have made an app that can play video from local and remote server(Streaming)
I tested the code on Linux (Ubuntu) and its working perfect.
But its not playing on Windows. I can only hear the audio can not see the video.
Here is the code below is used
Video from local drive

void HelloMeego::on_pushButton_4_clicked()
{
//video

// display video in same window
Phonon::MediaObject *mediaObject = new Phonon::MediaObject(this);

// Phonon::VideoPlayer *myPlayer= new Phonon::VideoPlayer(Phonon::VideoCategory, this);
Phonon::VideoWidget *videoWidget = new Phonon::VideoWidget(this);
Phonon::createPath(mediaObject, videoWidget);
ui->verticalLayout->addWidget(videoWidget);

Phonon::AudioOutput *audioOutput =
new Phonon::AudioOutput(Phonon::VideoCategory, this);
Phonon::createPath(mediaObject, audioOutput);
QString urlVideo ="TV.mp4";
Phonon::MediaSource source = Phonon::MediaSource(urlVideo);
mediaObject->setCurrentSource(source);

Phonon::SeekSlider *slider = new Phonon::SeekSlider;
slider->setMediaObject(mediaObject);
ui->horizontalLayout_2->addWidget(slider);
slider->show();

mediaObject->play();
}
Video from sever (streaming)


void HelloMeego::on_pushButton_8_clicked()
{
//download video

// display video in same window
Phonon::MediaObject *mediaObject = new Phonon::MediaObject(this);

// Phonon::VideoPlayer *myPlayer= new Phonon::VideoPlayer(Phonon::VideoCategory, this);
Phonon::VideoWidget *videoWidget = new Phonon::VideoWidget(this);
Phonon::createPath(mediaObject, videoWidget);
ui->verticalLayout_2->addWidget(videoWidget);

Phonon::AudioOutput *audioOutput =
new Phonon::AudioOutput(Phonon::VideoCategory, this);
Phonon::createPath(mediaObject, audioOutput);
// QString urlVideo ="big-buck-bunny.ogv";
QString urlVideo ="http://videos.myserver.com/SpecialFeatures/low/FitIsHitWithChandanRoySanyal.flv";
Phonon::MediaSource source = Phonon::MediaSource(urlVideo);
mediaObject->setCurrentSource(source);

// Phonon::SeekSlider *slider = new Phonon::SeekSlider;
// slider->setMediaObject(mediaObject);
// ui->horizontalLayout_4->addWidget(slider);
// slider->show();

mediaObject->play();

}
I have tested both flv & mp4 files.
I have also followed this link http://www.qtcentre.org/threads/34911-can-t-see-a-video-play-but-only-music-in-Qt?highlight=video+streaming and installed ffdshow. But this time the audio even doesn't play.


Please suggest me.


Please suggest me.

somnathbanik
3rd November 2010, 10:07
Is there any one who can help me please, I am facing this issue for a long time.

wysota
3rd November 2010, 10:44
Does the client system have proper codecs to display the video? Can you play the file directly with e.g. Windows Media Player?

somnathbanik
3rd November 2010, 10:47
Does the client system have proper codecs to display the video? Can you play the file directly with e.g. Windows Media Player?

Yes I can play the flv and mp4 file in my default Windows Media Player after I install k-Lite code, but the same files are not playing in my app.
I checked and found that phonon supports the following media file format in windows

("application/vnd.ms-wpl", "application/x-mplayer2", "application/x-ms-wmd", "application/x-ms-wmz", "audio/aiff", "audio/basic", "audio/mid", "audio/midi", "audio/mp3", "audio/mpeg", "audio/mpegurl", "audio/mpg", "audio/wav", "audio/x-aiff", "audio/x-mid", "audio/x-midi", "audio/x-mp3", "audio/x-mpeg", "audio/x-mpegurl", "audio/x-mpg", "audio/x-ms-wax", "audio/x-ms-wma", "audio/x-wav", "midi/mid", "unknown", "video/avi", "video/mpeg", "video/mpg", "video/msvideo", "video/x-mpeg", "video/x-mpeg2a", "video/x-ms-asf", "video/x-ms-asf-plugin", "video/x-ms-wm", "video/x-ms-wmv", "video/x-ms-wmx", "video/x-ms-wvx", "video/x-msvideo")

Is there any possibility that I could add flv and mp4 file format in Phonon?

wysota
3rd November 2010, 10:53
Phonon supports everything your backend (Direct Show used also by WMP in case of Windows) supports. If WMP can play the file, Phonon should play it as well unless your codec pack somehow prevents it from it (maybe you need to enable the applications that can use the codecs in the codec pack configuration?).

somnathbanik
3rd November 2010, 11:25
I tried to play mpg from my local drive, but the app hangs. Is there any issue in my code. Please help me.


Phonon supports everything your backend (Direct Show used also by WMP in case of Windows) supports. If WMP can play the file, Phonon should play it as well unless your codec pack somehow prevents it from it (maybe you need to enable the applications that can use the codecs in the codec pack configuration?).

How do I enable the app in the codec pack configuration. Do I instal k_lite or FFdshow?

Added after 25 minutes:


Phonon supports everything your backend (Direct Show used also by WMP in case of Windows) supports. If WMP can play the file, Phonon should play it as well unless your codec pack somehow prevents it from it (maybe you need to enable the applications that can use the codecs in the codec pack configuration?).

I have reinstalled the k-Lite again , and can play the flv and mp4 files on MPC and WMP. when I play the files through my app the audio comes out not the video. where do I configure to play the video?
I believe there is some issue, i tried to play the files through qmediaplayer example from Nokia Qt SDK, but its not playing.

wysota
3rd November 2010, 12:56
Do I instal k_lite or FFdshow?
How should I know?


I believe there is some issue, i tried to play the files through qmediaplayer example from Nokia Qt SDK, but its not playing.
It probably uses the same backend so the issue is exactly the same - you are missing a codec or you have a misconfiguration issue on your system.

somnathbanik
4th November 2010, 07:30
How should I know?


It probably uses the same backend so the issue is exactly the same - you are missing a codec or you have a misconfiguration issue on your system.

Could you please check my above code once so that I can make sure that its not my coding issue and will try to find a codec only.

wysota
4th November 2010, 08:27
If it works on Linux then the code is fine provided the file can be found by the player. Since you are getting audio then it is found and is being played.

somnathbanik
4th November 2010, 10:38
If it works on Linux then the code is fine provided the file can be found by the player. Since you are getting audio then it is found and is being played.

Yes you are right, thank you. Let me see what I can do wtih the codec.