Laravel FFMpeg upload video and concat with request - php

i have problem when i upload video from (form HTML)
i use Laravel FFMpeg package
this code from my controller
$file = $request->file('video'); // take video request
FFMpeg::fromDisk('public')
->open(['vid\vid_one.mp4' , $file]) // concat video here and i think there is a problem
->export()
->concatWithoutTranscoding()
->save('contacct.mp4');

You have to store that video on that point where you are using ffmpeg open function with this function:
$request->file('video')->storeAs('folderName', $request->video->getClientOriginalName(), 'diskName');

Related

Download .mp4 from URL using Laravel

How to download .m4v video from given URL with Laravel? I have a URL for example rtmp://123456.r.cdnsun.net/_definst_/mp4:123456/h264/123456.m4v ... Can you recommend me a package for Laravel which could make the process easier?
It depends on what exactly you're trying to achieve. For example, if you want to just copy file from a remote server, you could use copy():
$remoteFile = 'rtmp://123456.r.cdnsun.net/_definst_/mp4:123456/h264/123456.m4v';
$localFile = storage_path().'movies';
copy($remoteFile, $localFile);
You can use file_put_contents to download video from URL
$video_name="video_name.mp4";
$video_path=public_path('videos').'/'.$video_name; // path where you want to store video
file_put_contents($video_path, fopen($file, 'r'));

YouTube API v3 Video Upload Path using PHP and form

Trying to upload videos using V3 API from a form. When specifying the path to the video I'm using $videoPath = file_get_contents($_FILES["file"]["name"]); I've also tried it with out the get_file_contents and it tells me it can't find the file. I must be missing something, is there a way to upload directly from a form post without having to upload it to my server, than upload it to YouTube?
You dont allow to download video files from youtube dirrectly.
At first check path for $_FILES["file"]["name"].
I recommend to use code if you need get information about video. After you may parse data and get images/video etc.
public function getParseVideo($code = null){
$key = "your code";
if(!empty($code)){
$data = file_get_contents("https://www.googleapis.com/youtube/v3/videos? key=".$key."&part=snippet&id=".$code);
echo $json = json_decode($data);
}
}

How to download and show a image from amazon s3 using zend framework?

How to download and show a image from amazon s3using zend framework?
I have the data of the image
$s3 = new Zend_Service_Amazon_S3();
$data = $s3->getObject($objectname);
How to show the image in a page imn my site ?
By documentation: http://framework.zend.com/manual/1.12/de/zend.service.amazon.s3.html I understand that you have different information on $data. right?
in that format will return it to the picture?
you could paste a debug print object $data?

How do I directly upload a file stream to Flickr using a CURL POST?

I'm writing a web app that at one point allows a user to upload a photo to a flickr account (mine). I want to do this without saving the intermediate image on the server my web app is on.
What I've got so far is a page which implements phpFlickr and accepts a POST from a simple html form. I use $_FILES['file']['tmp_name'] as the path for phpFlickr to use. Here's the code:
<?php
require_once("phpFlickr.php");
$f = new phpFlickr("apikey", "secret", true);
$_SESSION['phpFlickr_auth_redirect'] = "post_upload.php";
$myPerms = $f->auth("write");
$token = $f->auth_checkToken();
$phid = $f->sync_upload($_FILES['file']['tmp_name']);
echo "Uploading Photo..." . $phid;
?>
I'm guessing that the tmp file is being lost because of the redirect that happens when $f->auth("write") is called, but I don't know. Is there a way to preserve it? Is there any way to do this without saving the file to the server?
Answer: There is No way to directly upload a file to Flickr without saving it as an intermediate file.
I've moved on to using move_uploaded_file() followed by a flickr API call, and its working perfectly.
I've also managed to get it to play nice with the excellent Jquery Uploadify, which lets me send multiple files to it in one go.

Downloading images from a server iPhone SDK

I have created a program which allows me to upload images to my server. They are given a random file name when uploaded. I want to be able to download all the images from a folder on the server so I can display them in my application. The only example I have seen requires that I know the file name of the images which I don't. How could I download all the images in a given directory (and store the downloads in an NSArray)? If there is no native way to do it does anyone know a way that it could be done via calling a PHP script? (I use a PHP script which the iPhone calls to upload the images).
Thanks.
To list all images in a directory using PHP and return a JSON encoded string:
$path = '/full/path/to/images/';
// find all files with extension jpg, jpeg, png
// note: will not descend into sub directorates
$files = glob("{$path}/{*.jpg,*.jpeg,*.png}", GLOB_BRACE);
// output to json
echo json_encode($files);
you can call a php script that will return the url for all of your images.
something like
yoursite.com/image123.jpg;yoursite.com/image213.jpg;yoursite.com/imageabc.jpg
then you parse the result, split by ";" and get the array of urls which you need to download.

Categories