Jump to content

FLV files losing metadata on upload


d-shade

Recommended Posts

Well I have been trying to get flv files working on my site.

This is what I have for my Form

<FORM ENCTYPE="multipart/form-data" METHOD="POST" ACTION="upload_video_handler.php">
<TABLE width="100%" border="0" cellpadding="2" cellspacing="0">
<TR>
<TD width="62" align="left">Title:</TD>
<TD colspan="2" align="left"><INPUT TYPE="text" NAME="Name" size="75" maxlength="40"></TD>
</TR>

<TR>
<TD width="62" align="left">Author:</TD>
<TD align="left" colspan="2"><INPUT TYPE="text" NAME="creator" size="75" maxlength="40"></TD>
</TR>

<TR>
<TD align="left">File:</TD>
<TD align="left"><INPUT TYPE="file" NAME="File"></TD>
<td align="right"><INPUT TYPE="submit" VALUE="Submit"></td>
</TR>
</TABLE>
</FORM>

and this is what I am using on the PHP end

$Name = addslashes($Name);
        $creator = addslashes($creator);
	$nameoffile = $newid . basename($_FILES['File']['name']);
$uploadfile = 'videos/'.$nameoffile.'';
move_uploaded_file($_FILES['File']['tmp_name'], $uploadfile);

I didn't include any of the code for the mysql end since its a problem with the file its self.

The problem I am having is when I upload the file using the Form above the flv player will not play the flv files. If I download the file using ftp and run the flv fix(which injects the metadata) and upload the file using ftp the files work.

The files downloaded will play in zoomplayer without any problem. Is there something I am doing wrong or is there another method I should use?

I am using RivaEncoder to create the FLV file and using Buraks FLVMDI to inject the metadata.

The flash video player i am using is from http://www.jeroenwijering.com there is also a article on creating flv files on that site as well

 

Link to comment
https://forums.phpfreaks.com/topic/47789-flv-files-losing-metadata-on-upload/
Share on other sites

You may want to try using FFMpeg to convert everything and use the flvtools2 (http://osflash.org/flvtool2). I'm currently using those along with FlowPlayer and everything is working great.

 

 

<?
$queue_file_dir = "/path/to/" . $in_userid . "/";
$queue_filename = $this->escapeFileName($file);

$fileNameParts = explode( ".", $queue_filename ); // seperate the name from the ext after being escaped
$finalFile = $queue_file_dir . $fileNameParts[0] . ".flv";

$execnum1 = exec( "/path/to/ffmpeg -i /path/to/$newFileName -ar 22050 -ab 32 -r 18 -b 700kb -acodec mp3 -f flv - | flvtool2 -U stdin /path/to/$finalFile" );

$execnum2 = exec( "/path/to/ffmpeg -i /path/to/$newFileName -an -ss 00:00:00 -t 00:00:01 -r 1 -y -s 320x240 $queue_file_dir" . $fileNameParts[0] . "%d.jpg" );

unlink ($newFileName);

?>

i can't use FFMpeg on my server. which is why I have the FLV upload form. but it seems to delete the metadata on upload. So the flv wont stream.

 

If i upload the flv using ftp they work fine its just when using the form the flv doesn't work.

So I was thinking there is something wrong with the method I am uploading the file or maybe there is another way to upload the file and not lose the metadata

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.