Reputation: 5433
i have lots of videos in my server and i use the following code to get the duration of the video and it works fine..
ob_start();
passthru("ffmpeg -i ".$srcfile." 2>&1");
$duration = ob_get_contents();
ob_end_clean();
But i could not get the duration for the files which has a space or any special characters like ( ' # % etc...
I cant rename the files as it is stored already and the names of those files are also stored in db and it would take a toll to change all in a live site..
So is there any method for accessing/reading the files with special characters?
Upvotes: 1
Views: 1733
Reputation: 75619
Quote the filename between single quotes:
passthru("ffmpeg -i '".$srcfile."' 2>&1");
Upvotes: 0
Reputation: 117517
Incidentally, you should always use this for any shell arguments, less you want to make your application open to shell injection-attacks, which could be very dangerous.
Upvotes: 3