0

Coldfuions YouTube Clone - Super Easy

YouTube, ColdFusion

I wanted to make a posting solution for my company. Needed to have a YouTube capabilbility. Could have used YouTube, but I didn’t want a YouTube bug on stuff clients were going to view.

I could not believe how TOTALLY easy this was with ColdFusion.

You need 2 things.

  1. FFMPEG, this INCREADABLE open source project is a headless application that can accept about 32 different type of video files and can convert them to Flash .flv format
  2. FlowPlayer, this great open source project is what I use as the player for the .flv. It is cool cause it streams the .flv with out having to “compile” with Flash 8. You just pass it the .flv name and your all set.

Here is my example using the form and action page example:

This could be your form uploadVideo_dsp.cmf:
<!--- start --->
<cfset myself = viewState.getValue("myself") />
<h1>Upload Video</h1>
<form action="uploadVideo_act.cfm" method="post" enctype="multipart/form-data">
<table>
<tr valign="top">
<td align="right">Video:</td>
<td><input type="file" name="video"></td>
</tr>
<tr valign="top">
<td></td>
<td><input type="submit" Value="upload"/> </td>
</tr>
</table>
</form>
<!--- end --->



This would be the uploadVideo_act.cfm code:
<!--- start --->
<cffile
action="upload"
destination = "C:\_FULL_SYSETM_PATH_TO_YOUR_VIDEO_DIR\video\video" nameconflict="overwrite"
filefield="video" />
<!--- convert the video with FFMPEG --->
<cfexecute name = "C:\_FULL_SYSETM_PATH_TO_YOUR_FFMPEG.EXE_APP\ffmpeg.exe" arguments = "-i C:\_FULL_SYSETM_PATH_TO_YOUR_VIDEO_DIR\video\#cffile.SERVERFILE# -s 320x240 -r 15 -b 2000 -ar 44100 -ab 64 -ac 2 C:\_FULL_SYSETM_PATH_TO_YOUR_VIDEO_DIR\video\#replace(cffile.SERVERFILE, ".", "")#.flv"
outputFile = "C:\"
timeout = "900">
</cfexecute>
<cfset videoName = "#replace(cffile.SERVERFILE, ".", "")#.flv">
<!--- insert the name of the file into your database --->
<!--- end --->


Then the display page for the video:
<!--- start --->
<!--- get the name of the video from the database, query or something --->
<cfset videoName = query.videoName_YouJustGotFromTheDataBase />
<object type="application/x-shockwave-flash" data="/views/video/FlowPlayer.swf" width="320" height="263" id="FlowPlayer">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="/views/video/FlowPlayer.swf" />
<param name="quality" value="high" />
<param name="scale" value="noScale" />
<param name="wmode" value="transparent" />
<param name="flashvars" value="videoFile=../../video/#videoName#" />
</object>
<!--- end --->

How cool is ColdFusion? Really cool, again some non-programmer like myself can make a youTube clone.

 

I LOVE CF.

tags:
, ColdFusion, YouTube
Mike said:
 
Hi, is there a way to do that without using Model Glue ? What page should process the form ? I created a folder called Model and I put the VideoManager code as VideoManager.cfc where does the function controller goes ??? Great stuff but I just can't get it to work :(

Any help would be appreciate...

mike
 
posted 1071 days ago
Add Comment Reply to: this comment OR this thread
 
Rulos said:
 
Hello,

i luv your posted code and the idea, that making a youtube style is accessible, please i need help in installing the ffmpeg i dont know what to do please contact me at my email, rulosweb@atentiusa.com

please help me and i will show you my grattitude

Thanks

Raul
 
posted 661 days ago
Add Comment Reply to: this comment OR this thread
 

Search