Hi, I need some help on this.i made a simple upload video but the problem is i cannot display the video that i uploaded.I have no idea on this on how to display the video that I uploaded and play on it....million thanks in advance.

Recommended Answers

All 15 Replies

Member Avatar for diafol

You may get more help by providing more info. What format is the video? Do you need an third party player like jwPlayer, flowplayer. What about html5 / video.js: http://videojs.com/

Hi,

First, can you please let us know the format of these videos? Depending on the format, requires different player.. e.g. flash for flv and mp4/h264, divx player for divx and avi, and the list goes on...

Did you upload the videos to a database, or in a folder?

Hi,

The format of the video is WMV...i have no idea in using an third party like diafol said.I never tried to play or to display the video.I uploaded the video in folder and the name of my video is in the database..i just followed the w3schools.

Member Avatar for diafol

Easiest way to do it is to upload your video to YouTube (you'll need an account) and copy the 'iframe' embed code into your page. That way you're running off Youtube's server.

Hi.Diafol thank you for this idea...can i ask about the one that you suggested to me the videojs,is it okay to use that in localhost and no internet connection?

Member Avatar for diafol

Should be - as long as your browser supports html5 and js is switched on

Edit

Wmv files! Not sure if this is supported.

@jemz,

html5 players does not support wmv, because it is a browser based player. So, the most commonly supported video formats or extensions are mp4/h264, ogv or ogg, webm.

If you are wondering which format is the most useful, without the burden of having too many duplicates of the same video encoded in different formats? My choice would be the mp4/h264.

Why mp4/h264 ? Because it is supported in html5 and apple gadgets.
Will all the browsers wil be able to render mp4/h264 video? the answer is yes and NO. Yes, because it supports many mobile browser. No, because firefox and apple only supports it. However, you can always write a fallback player codes, so that whenever a browser is not supporting mp4/h24 video, we can fallback to regular flash player like flowmotion or jwplayer. That should make everyone happy. The most important about using mp4/h264 encoded video is that it can be encoded in the very minimum bitrate and still the quality is far superior than any other video formats.

Downside of mp4/h264? The downside is that you cannot pseudostream this type of video, because the moov atom of this video is located at the tip of the video file. Ok..ok. yes, we can pseudo stream mp4/h264 video by using php script written by some video afficionados like myself. I will not be providing the script for it, because I am relying on it heavily to pay for my coffeee.

How do you encode mp4/h264 videos? I can show you how to do it windows using the commandline, or just download a readily available for free at cnet. The only thing I cannot show you is how to encode this in php, because the encoder class I wrote for the mp4/h264 + mp4box moov relocator class is considered as propriety script. Thats the one paying for my starbucks coffee card every week. Not a lot, but I am getting my coffee everyday and it is pretty generous.. ( I think :)).

Just for the fun of encoding video from windows command line, here is a simple instruction of doing it. I strongly suggest using at least a multicore cpu. Else, this process is going to be slow as snail.

  1. Download ffmpeg here. WARNING! DO NOT GO TO **For fresh FFmpeg builds for Windows go to ** link. I know this guy, but his build has been buggy lately.
  2. Select your operating system flavor. If you are running a multi-core cpu, download the win64 static or whatever fits to your system, but make sure it is the STATIC distro.

  3. Unzip the zip file.. open the unzipped directory. Copy all of the files.

  4. Direct your file browser to your c drive. In C drive create a new directory called ffmpeg. Paste the copied files from step 3.
  5. Create video directory inside the ffmpeg directory. Open video directory, and create input and output directories.

  6. Move your video to the input directory.

  7. Open your regular notepad, copy, paste command line code below. Codes below has been adjusted to work with the ffmpeg version provided above.

    c:\ffmpeg\bin\ffmpeg.exe -i c:\ffmpeg\video\input\yourVideo.wmv -f mp4 -r 30 -vcodec libx264 -s 704x384 -b 600kb -flags +loop -cmp +chroma -bufsize 4M -bt 256k -refs 1 -bf 3 -coder 1 -me_method umh -me_range 16 -subq 7 -partitions +parti4x4+parti8x8+partp8x8+partb8x8 -g 250 -keyint_min 25 -level 30 -qmin 10 -qmax 51 -qcomp 0.6 -trellis 2 -sc_threshold 40 -i_qfactor 0.71 -acodec aac -strict experimental -ab 112000 -ar 48000 -ac 2 c:\ffmpeg\video\output\video.mp4

  8. Change the value for yourVideo.wmv and video.mp4 above to your own video. Once you are done editing the values. Copy the entire code.

  9. Open the windows command prompt, and paste the edited codes above.
  10. ffmpeg should start encoding and high quality mp4/h264 encoded video can be viewed in the output directory.

  11. After the video has been encoded, move the encoded video from the output directory and move it to your xampp server.

  12. Use the html5 player as suggested by Diafol (ardav).

I apologize and I hope people will understand the reasons why I would not provide a php script for video encoders. It is not that it cannot be done. I just decided to make this as my coffee cow. I have been doing this for a long time, and some other developers would pay a lot of money to decrypt my encoder class, but no one even came close .

@veedeoo,

Thank you for the reply,wow you are great...thank you for explaining me and giving some tips.okay i will try above and i will let you know...

@Diafol.Thank you for the reply and Thank you for explaining me also.

@veedeoo,i tried the steps above but i got error...i tried to use a coverter video converter from xilisoft.
i convert my video.wmv to mp4/h.264...and then i tried Diafol videojs but unfortunately i was not able to display or play the video...please help me on this.

@diafol and @veedeoo,do you have some video that is formated in mp4/h264 just a sample of me.i want to try to play the video in my page,in localhost...can i play this with no internet connection?.

@Diafol,thank you for this,how can i play this in my webpage in localhost.usin videojs?please guide me.

@Diafol,i have done converting the video,how can i use this in videojs?...

@Diafol(Ardav),@veedeoo. It's working now thank you so much for your helping me.I can now play the video

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.