is there any way, how to play movie or get some file (ex. jpg, pdf) from distance FTP server?
I've got an app on my PHP server and really lot of bigsized files, so I store it on FTP. I need to play (videos are the biggest problem) these videos via that app...
I've found ftp_get() function, but it seems to work like - "copy this file to my php server and than play",... it's not acceptable for long time.
Any ideas/solutions?
PS: excuse me my english and maybe not so detailed description.
FTP is a file transfer protocol so it's not the right tool.
Few ways to do it:
PHP HTML5 Video Streaming Tutorial (PHP stream)
Pseudo Streaming MP4’s with PHP
Streaming a large file using PHP
Related
I am using WAMP server 2.4. I am streaming MP4 videos. Whenever i request video to stream it took around 3-4 mins to start streaming and once streaming is started it works fine.
I am unable to figure out why it takes to much time to start streaming.
I have tried following link as well but it didn't solve my issue.
Load mod_h264_streaming.dll in Windows Apache2
Please help
Are you using Flash or HTML5 or else to playback the video?
It sounds like the browser/client is trying to get the full length file before playing it back. It could be due to the fact that your MP4 file is not properly formatted for the web (MOOV ATOM is at the end of the file and playback cannot begin without it). You can read there for more info.
I would suggest two things:
try with a short 10 sec file and see if it plays rapidly
try a software like handbrake (or MP4Box or ffmpeg if you are more advanced on file transcoding) to transcode your MP4 with the "web optimized" (aka "fast start") check box active.
Let us know if it works.
I basically need to record a video of the flash stage, and save it as a video file on the webserver. I don't have FMS or the luxury of Java based servers like Red5 to stream to, so I am pretty much stuck with HTTP post to a php script. Now I can grab invidual snapshots (bitmapDatas) Just fine, but how can I convert them to a video file? Any help is appreciated.
PS: This is not an AIR app, so I am using flash runtime. And the video would be couple seconds long so there shouldn't be much of a performance concern at this point.
Flex provide a JPEG encoder. You can use that to compress the bitmap images and send them to the server, where you can that stitch them together using ffmpeg.
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/graphics/codec/JPEGEncoder.html
We've currently developed an ExpressionEngine site (php), and are using a paid JWPlayer to display video uploaded by the client.
At present we're running into a number of issues, as the client is:
Uploading video at the wrong size
Uploading video randomly in both flv or mp4 format
And the player is chugging along terribly with multiple pauses throughout the video - sometimes buffering the entire clip before it is played.
I know FFMPEG can be installed serverside, but I'm not sure of the way in which to go about this, and how it might interact between ExpressionEngine and JWPlayer. I'm also not sure about the formatting - the ability for this automated encoding process to also crop/resize the video to suit the player dimensions on the site.
We would really like to have the videos playable on all browsers & iOS devices.
A HQ option would also be great where applicable, but it's just a nice to have - as we're struggling with the formatting / encoding issues first and foremost.
Any help figuring out the best process, and what tools I might need would be greatly appreciated.
I'd reccomend using a service like zencoder
I've used them in the past and no matter what video format I've thrown at them it works great. (PS. I'm not affiliated with them at all)
There is a PHP API with a whole lot of resizing, quality and format options. After you've uploaded your video you can send it to zencoder and they'll send you a response some time later with success or fail.
They can put the processed video on Amazon S3 or FTP it to a server.
You'll need a HTML5 player for iOS devices though, unless JWPlayer has come a long way since I used it last.
You could get zencoder to output in mp4. and then you still only need mp4 for JWPlayer/flash and the HTML5 version for iOS, as long as your happy to use flash for all desktop browsers there's no problem.
As far as the buffering issues you are having - I have found that using a CDN version of the swf for JWPlayer (or whatever player you are using) has caused it to load the entire video file before playing. Easily fixed by hosting it yourself.
I have found many times the video conversion capabilities of different CMS to be limited, and often restricting video formats to what the developers thought was appropriate, such as FLV, which nowadays is turning obsolete for video delivery.
One of the ways you can approach it is by creating a custom script to process the videos uploaded by your client using FFmpeg, which in fact can accept almost any video format, and generate the correct output formats and dimensions, ensuring that the resulting videos will be suitable for web playback using your player.
The problem with the video buffering you are facing is because the video file is not prepared for progressive download or pseudo-streaming, so your browser needs to download the whole video before starting to play. This can be solved with programs like qt-faststart for MP4 and MOV video files, and flvtool2 for FLV files. So your script would need to also optimize the encoded videos using these tools.
Also note that if you use an HTML5 video player (browser native or recent JWPlayer), then you can enjoy from random seeking the video files without buffering them.
If starting from scratch is not an option, you can look into a commercial solution like tremendum transcoder which also uses FFmpeg and is quite simple to use, yet it does all you need in regards to dealing with different input formats and aspect ratios automatically.
I have done a few setups this way, separating the CMS part from the video processing part, and it saved me some headaches.
I have an HTML 5 website where I want to stream videos from a torrent server. I don't know which Linux torrent client to use. Can I use PHP as a torrent client?
Example:
<video src="downloder.php?file=movie.mp4"
downloader.php would then return an mp4 file from the .torrent file.
You can use #feross' fantastic library, webtorrent. This works in both Node.js and the browser.
HTML5/javascript can't do the bittorrent protocol. Java applets can, but few browsers support java applets out of the box these days. https://webtorrent.io/ is an alternate protocol that works in the browser. It can't communicate via the bittorrent protocol though, so only works with webtorrent trackers (and piers that speak webtorrent.)
I don't think it is even possible to stream from torrent. Files from torrent are separated into small chunks that are obtained unordered, when/if you will get them from other clients, when/if other clients decide to send them to you.
The torrent file doesn't contain any data to stream. Your PHP server would have to start receiving the torrent data from other peers (that is how torrents work).
MP4 is not a format that needs every byte to play - that is why QuickTime can start playing before completely downloading (hence streaming), but the bytes to play need to be at the start (or at the end, but in any case) - torrents do not 'load' in 'byte order'. As the above user says, torrents load data in chunks. You'd need at least the header.
It's just not realistic.
I would like know if it is possible to create embedding of audio message to audio files?
For example, on playing every 10 sec of an audio, it would be interrupted with an audio message "You are currently listening to an audio by XYZ band" and then the audio continues. And even if someone were to download the mp3 file, the audio message is still embedded with that downloaded file?
May I know if there are any libraries or classes that can work with php to achieve the above result? And what would be the workflow?
Thank you very much.
You definitely can't do that in pure PHP - in theory you could write a MP3 decoding and encoding engine for PHP but it's an insane idea - and you will need some server side help for the task.
ffmpeg should enable you to mix multiple MP3s together to one file, provided your host supports it.
I would use sox for everything. It can decode and chop up the audio into segments, into which you can interject your message, and then render the sequence into a new mp3 file. It should also be able to overlay the messages onto the audio, so you don't break up the music, which might sound more pleasant.
Of course, this means using PHP just for management. The signal processing would be done by sox. If you really want to do as much as possible in PHP, use an external tool to decode the mp3 into a wave file, load the PCM into an integer array in PHP, and manipulate it there. PHP is probably not very fast when it comes to number crunching like this, but it should be possible. Save the PCM to disk for final encoding.