473,395 Members | 1,677 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,395 software developers and data experts.

Page always asking for downloading after executing the ffmpeg using exec() function

Nert
64
hi,

I have made a simple website that allows users to upload videos. The videos are automatically converted into flv using the ffmpeg. I'm executing the ffmpeg using the PHP function exec(). My problem is after everything is done, i mean after uploading and converting the video to flv my "upload.php" page always asking for downloading which i don't what to do. Anyone could help me?

Any suggestions from you guys would be greatly appreciated.

Thanks in advance..(^_^)


.: Nert :.
Aug 15 '07 #1
7 1863
Nert
64
Hello,

Here i am again asking for help.., i'm still encountering the same problem after searching for some tips on the web.., does anyone had encountered this same problem as mine? help please (^_^)



.: Nert :. ;P
Aug 16 '07 #2
code green
1,726 Expert 1GB
Can we see some code?
Aug 16 '07 #3
Nert
64
Can we see some code?
Yes of course,

Here is my code for the conversion of media files to flv file.
upload.php

[PHP]$config['ffmpeg'] = 'The path of my ffmpeg';
function uploadfile($origin, $dest, $tmp_name){
$origin = strtolower(basename($origin));
$fulldest = $dest.$origin;
$filename = $origin;
for($i=1; file_exists($fulldest); $i++){
$fileext = (strpos($origin,'.')===false?'':'.'.substr(strrchr ($origin, "."), 1));
$filename = substr($origin, 0, strlen($origin)-strlen($fileext)).'['.$i.']'.$fileext;
$fulldest = $dest.$filename;
}
if (move_uploaded_file($tmp_name, $fulldest))
return $filename;
return false;
}

if(isset($_FILES['file']['tmp_name']) && is_uploaded_file($_FILES['file']['tmp_name'])){
if($vid = uploadfile($_FILES['file']['name'], 'v/', $_FILES['file']['tmp_name'])){
$vidDIR = 'v/'.$vid;
$fileext = (strpos($vid,'.')===false?'':'.'.substr(strrchr($v id, "."), 1));
$new = substr($vid, 0, strlen($vid)-strlen($fileext));
$filename = $new.'.flv';
for($i=1; file_exists('v/'.$filename); $i++){
$ext = (strpos($new.'.flv','.')===false?'':'.'.substr(str rchr($new.'.flv', "."), 1));
$filename = substr($new.'.flv', 0, strlen($new.'.flv')-strlen($ext)).'['.$i.']'.$ext;
}
$newVidName = $filename;
exec("$config[ffmpeg] -i $vidDIR -acodec mp3 -ar 22050 -ab 32 -f flv v/".$newVidName);
}
}
[/PHP]

after that series of code has been executed my upload.php page will ask for downloading is anyone can explain why is that happening? Any suggestions?

Thanks in advance..,(^_^)


.: Nert :.
Aug 17 '07 #4
code green
1,726 Expert 1GB
after that series of code has been executed my upload.php page will ask for downloading
Sorry, can't see where this request is made in your script.
But you are executing what looks like the same loop within the script and also inside the function
[PHP]for($i=1; file_exists($fulldest); $i++){[/PHP] Duplicate code is always a concern. You could be looping through the same files twice
Aug 17 '07 #5
Nert
64
Sorry, can't see where this request is made in your script.
But you are executing what looks like the same loop within the script and also inside the function
[PHP]for($i=1; file_exists($fulldest); $i++){[/PHP] Duplicate code is always a concern. You could be looping through the same files twice
Sorry for bothering code green, ahmmn don't mind about the looping it doesn't do anything that cause my upload.php page request for downloading.

And, it's not a duplicate code, they do different thing. And the second loop will not be executed unless the function uploadfile() is done and returning the filename of the uploaded file.

Anyway, i think it's about the exec() function. After executing the ffmpeg command in the console a popup window will appear asking to download the upload.php page.

thank you for being patient code green (^_^) i'm looking forward for your help. best regards.


.: Nert :.
Aug 18 '07 #6
jx2
228 100+
if you dont know what cos problem but you suspect exec coment it and see if problem disappear...
let us know
Aug 18 '07 #7
Nert
64
if you dont know what cos problem but you suspect exec coment it and see if problem disappear...
let us know
I already done that jx2, I commented the exec() and the popup window disappear. Thanks for the suggestion, but i should use the exec so that i can run the ffmpeg to convert media files to flv on fly. If you have any other idea on how to run the ffmpeg in much better way than I do please post me some snippets. Thanks (^_^)




.: Nert :.
Aug 18 '07 #8

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

Similar topics

1
by: bennett | last post by:
At http://www.brainjammer.com/testing/validator_test.aspx I have a text field where you can enter text, and a button where if you click the button, it sets the value of a label below it, to...
3
by: Alex | last post by:
Hello. First, with AJAX I will get a remote web page into a string. Thus, a string will contain HTML tags and such. I will need to extract text from one <span> for which I know the ID the inner...
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: chets | last post by:
Hi All, I am facing problem in executing one dynamic query in PRO *C program on linux. I want to update table mytable by data MADURAI for a column mycolumn1 where primary key is myPK.I want to...
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...
4
by: jcor | last post by:
Hi, I have a script that convert a file, "$novo" in this case, to a 3gp file: this is part of the script: print "qual é o título da peça? (< 36 caracteres)\n"; my $titul=<STDIN>;...
0
by: Gordon Fraser | last post by:
Hi, I'm trying to parse Python code to an AST, apply some changes to the AST and then compile and run the AST, but I'm running into problems when trying to evaluate/execute the resulting code...
0
by: Orestis Markou | last post by:
Have you tried passing in empty dicts for globals and locals? I think that the defaults will be the *current* globals and locals, and then of course your namespace is broken... On Tue, Oct 7,...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.