473,405 Members | 2,379 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Can anyone help me understand the ffmpeg thing? I'm lost !

67
Hi guys

I was trying to understand how the ffmpeg works, but even after a lot of googling, couldn't advance a bit.

Ok, in case of normal file uploading, we have something like -

[PHP]$movie=$_FILES['movie'];[/PHP] and then we use something like [PHP]ftp_put($conn_id, 'public_html/folder/'.basename($movie['name']), $movie['tmp_name'], FTP_BINARY);[/PHP] to do the uploading in our server.

In ffmpeg, I am getting codes like [PHP]ffmpeg -i ellas_first_year.avi -ar 22050 -ab 32 -f flv -s 320x240 ellas_first_year.flv[/PHP] which apparently do the job, but I am unable to understand how to relate the [PHP]$movie=$_FILES['movie'];[/PHP] with the above piece of code.

I would greatly appreciate if someone can throw any light on this. Thanks friends.
Oct 11 '07 #1
7 3498
Motoma
3,237 Expert 2GB
Hi guys

I was trying to understand how the ffmpeg works, but even after a lot of googling, couldn't advance a bit.

Ok, in case of normal file uploading, we have something like -

[PHP]$movie=$_FILES['movie'];[/PHP] and then we use something like [PHP]ftp_put($conn_id, 'public_html/folder/'.basename($movie['name']), $movie['tmp_name'], FTP_BINARY);[/PHP] to do the uploading in our server.

In ffmpeg, I am getting codes like [PHP]ffmpeg -i ellas_first_year.avi -ar 22050 -ab 32 -f flv -s 320x240 ellas_first_year.flv[/PHP] which apparently do the job, but I am unable to understand how to relate the [PHP]$movie=$_FILES['movie'];[/PHP] with the above piece of code.

I would greatly appreciate if someone can throw any light on this. Thanks friends.
After assigning to $movie, $movie will be an array containing some specific information about your uploaded file. Run a print_r() on $movie in order to see exactly what information is being stored.

What you will likely want to do is place either $movie['tmp_name'] in a command line call to ffmpeg to begin your video conversion.
Oct 11 '07 #2
kigoobe
67
Hi Motoma

Thanks a lot for your reply. Yes, I did, I am having both tmp_name and name as array elements. Later, using $movie['name'], I am having this piece of code -

[PHP]$upl="/usr/local/bin/ffmpeg -i dc3.avi -ar 22050 -ab 32 -f flv -s 320x240 /home/user/public_html/movie/1192136241.flv";
exec($upl);[/PHP] where I got dc3.avi from $movie['name'], result, I am having an empty page on submission (I'm doing exit; just after calling the exec() function.)

And nothing is getting uploaded in the folder. The folder is set to 777, and I am uploading images and other docs (words, excel) successfully there using ftp_put().

Changing $movie['name'] to $movie['tmp_name'] where dc3.avi becomes something like /tmp/phpUysX1B doesn't help neither.

Do you see anything else that can cause a problem?
Thanks a lot man, I appreciate this.
Oct 11 '07 #3
Motoma
3,237 Expert 2GB
Hi Motoma

Thanks a lot for your reply. Yes, I did, I am having both tmp_name and name as array elements. Later, using $movie['name'], I am having this piece of code -

[PHP]$upl="/usr/local/bin/ffmpeg -i dc3.avi -ar 22050 -ab 32 -f flv -s 320x240 /home/user/public_html/movie/1192136241.flv";
exec($upl);[/PHP] where I got dc3.avi from $movie['name'], result, I am having an empty page on submission (I'm doing exit; just after calling the exec() function.)

And nothing is getting uploaded in the folder. The folder is set to 777, and I am uploading images and other docs (words, excel) successfully there using ftp_put().

Changing $movie['name'] to $movie['tmp_name'] where dc3.avi becomes something like /tmp/phpUysX1B doesn't help neither.

Do you see anything else that can cause a problem?
Thanks a lot man, I appreciate this.
Hey kigoobe,

You are going to want to take a look at the move_uploaded_file() function. You will perform this on the $movie['tmp_name'] typically place it in $upload_dir.$movie['name']. Then you will want to use $upload_dir.$movie['name'] and give that to ffmpeg. You will also need to make sure that you specify an full pathname to your output file.

The reason why ffmpeg would not work on the temporary file is because it uses the filename to glean what format the original video is in, if you do not tell it explicitly.

Hope this help,
Motoma
Oct 11 '07 #4
kigoobe
67
Hi Motoma

Thanks a lot for your reply. Yes, things are getting clear to me now slowly. I was using ftp_put() earlier, so I went with that for uploading the original movie ... However, there're still some issues. Here is my full code.

[php]
$uploadfile=$_FILES['multimedia']['tmp_name'];
$uploadname=$_FILES['multimedia']['name'];
$pos = strrpos($uploadname, '.');
$extension = substr($uploadname, $pos);
$newName = $_SERVER['REMOTE_ADDR'].'_'.time();
$movieName=$newName.$extension;
$flvName=$newName.'.flv';
$directory='public_html/movies/';
$destination_movie=$directory.'movies-original/'.basename($movieName);
$destination_flv=$directory.'movies-flv/'.basename($flvName);
if(ftp_put($conn_id, $destination_movie, $uploadfile, FTP_BINARY)) {
$upl = "ffmpeg -i ".$destination_movie." -ar 22050 -ab 32 -f flv -s 320x240 ".$destination_flv;
exec($upl);
}
[/php]
Result, I am getting the original file uploaded in the proper directory, but there's no trace of the flv file. :(:(:(

Thanks again for your time Motoma.
Oct 12 '07 #5
kigoobe
67
Just for an update ... don't know what the problem is, yet, but as I see, when I tried to work from SSH, I got an error telling
Expand|Select|Wrap|Line Numbers
  1. myMovieName.avi: Unknown format
Strange, as .avi is not an unknown format for ffmpeg.

Is it possible that the ffmpeg installation was not done properly, and is there a way to check if the installation was properly done?

Thanks again.
Oct 12 '07 #6
Motoma
3,237 Expert 2GB
Just for an update ... don't know what the problem is, yet, but as I see, when I tried to work from SSH, I got an error telling
Expand|Select|Wrap|Line Numbers
  1. myMovieName.avi: Unknown format
Strange, as .avi is not an unknown format for ffmpeg.

Is it possible that the ffmpeg installation was not done properly, and is there a way to check if the installation was properly done?

Thanks again.
From the documentation:
Expand|Select|Wrap|Line Numbers
  1. ffmpeg -formats
Oct 12 '07 #7
kigoobe
67



Hi Motoma, you are right. I don't see .avi in the list, following the command that you advised. Strange, I thought that avi was one of the allowed formats ... or may be my hosts didn't install some common codecs, or something like that ...
Oct 12 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

34
by: yensao | last post by:
Hi, I have a hard time to understand difference and similarities between Relational database model and the Object-Oriented model. Can somebody help me with this? Thank you in advance. ...
33
by: O-('' Q) | last post by:
....to translate the following to C#.NET style? var i: Integer; begin txtMyIP.Lines.Clear; sHTML := HTTP.Get('http://www.network-tools.com/'); if sHTML = '' then Exit; sIpAddr := 'IP...
6
by: m.arfini | last post by:
Hi All, i trying to compile ffmpeg v 0.4.9. with minGW compiler with make instruction, but at the end of the process none dlls have been created, only the exe file (in c:\program files\ffmpeg...
6
by: m.arfini | last post by:
Hi All, i trying to compile ffmpeg v 0.4.9. with minGW compiler with make instruction, but at the end of the process none dlls have been created, only the exe file (in c:\program files\ffmpeg...
2
by: itsjaferi | last post by:
I have installed ffmpeg and working very well.. grabbing images.. video conversion.. but i am stopped while combining two flvs... any one have command to combine two flv.
6
by: jcor | last post by:
Hi, i installed ffmpeg but seems to be a old version. With the command "ffmpeg -v" I get the this output: I tried to upgrade it with: but didn't work. Can someone tell me out to upgrade...
2
by: jcor | last post by:
Hi, I'm trying to use the module FFmpeg::Command to convert some files from .mpg to .wmv when I use ffmpeg in command line the command is just like this: "ffmpeg -i input.mpg output.wmv" When I...
0
by: =?Utf-8?B?U2hhbQ==?= | last post by:
Hai all, In my application i am using the code below i mentioned. But it couldn't converted into flv format and its not saved into specified path .Can any one help me to do this using c#. ...
1
by: creative1 | last post by:
hi, I have a video file in .wmv format and size is 263MB. I want to convert it in flash format to display it on my site. I want ti use ffmpeg for this purpose. I got link to binaries for windows....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.