ColdFusion有沒有一種方法來獲取視頻文件的寬度和高度?ColdFusion:有沒有辦法獲得視頻的尺寸?
回答
這裏有一個FFMPEG的ColdFusion包裝:https ://github.com/rip747/cfffmpeg使用包裝的優點是它使用java.lang.Runtime來執行ffmpeg而不是cfexecute。使用cfexecute可能會導致ffmpeg在發生錯誤時不會退出,這將要求您手動將其終止。 – rip747 2012-03-23 19:54:03
亨利引用項目也使用java.lang.Runtime。 – 2012-03-23 20:06:35
@ rip747 - 是的,iirc在cf8更新之一修復了這個問題。 (預解決方法是使用['/ c'和'2>&1'標誌](http://stackoverflow.com/a/1002585/104223) – Leigh 2012-03-24 18:24:43
我用ffmpeg.org途徑獲取上傳到我們維護系統的一個Flash視頻的大小。我有一個批處理文件,我通過CFEXECUTE執行並輸入ffmpeg.exe的參數。這段代碼中有很多來自其他人,但我似乎沒有將他們的網站加入書籤。
<!--- Check if the file is a flash video --->
<cfif Form.FILETYPE IS "Flash Video" AND UCase(ListLast(Main, ".")) IS "FLV">
<!--- Execute batch file to create Information txt file --->
<cfexecute name="c:\windows\system32\CMD.EXE"
arguments="/C#App.DocPath#\FFmpeg\GetFLVSizes #App.DocPath#\FFmpeg\ffmpeg.exe #App.RootPath#\files\#Main# #App.RootPath#\files\#ListDeleteAt(Main, ListLen(Main, '.'), '.')#_Info.txt"
timeout="5">
</cfexecute>
<!---read in the text file that was created by ffmpeg--->
<cffile action="read" file="#App.RootPath#\files\#ListDeleteAt(Main, ListLen(Main, '.'), '.')#_Info.txt" variable="strInformation">
<!---find the pattern of two numbers, an 'x' then two more numbers
These are the dimensions of the file there are no other items that will match
this pattern, so this is safe--->
<cfset strPattern=refind("[0-9][0-9]x[0-9][0-9]", strInformation) />
<!---grab the 4 characters before the x, the x itself, then the 4 characters
after Essentially this will be:
1240x1000
But sometimes the numbers will be 2, or 3 digits, but grab the whole thing--->
<!---if this does NOT work, then set the size to 320px by 212px
.flv files created by some applications will not have the dimensions in the
header--->
<cftry>
<cfset strTemp=mid(strInformation, val(strPattern-2), 9)>
<!---take the value of the last 4 digits for the width this will always
end up with a number--->
<cfset FLVHeight =val(mid(strTemp, 6, 4)) />
<!---to get the first number, we just need to isolate the first 4
characters. But find out if there is a space, just in case this is less than 4
digits--->
<cfset FLVWidth = left(strTemp, 4) />
<cfset flvspace = find(' ', Variables.FLVWidth) />
<cfset FLVWidth = right(Variables.FLVWidth, val(4-flvspace)) />
<!---set this as the default, this works with the swf file I use to display
the flv--->
<cfcatch>
<cfset FLVWidth = 320 />
<cfset FLVHeight = 212 />
</cfcatch>
</cftry>
</cfif>
發佈CF代碼會非常有幫助請撥打
- 1. 有沒有辦法使用ColdFusion獲取視頻文件的持續時間?
- 2. 有沒有辦法通過3.0 API獲得YouTube視頻的所有者?
- 3. 有沒有辦法改變Android手機的MTU尺寸?
- 4. 有沒有辦法從iTextSharp讀取TrimBox和BleedBox的尺寸?
- 5. 有沒有辦法確定顯示器的物理尺寸?
- 6. 有沒有辦法使用可變的廣告橫幅尺寸?
- 7. 得到視頻的尺寸中的VideoDisplay
- 8. 有沒有辦法在MVC3中檢索手機屏幕尺寸
- 9. 有沒有辦法將圖像縮小到特定尺寸?
- 10. 有沒有辦法從FutureTask獲得Callable?
- 11. ShareKit - SHKFacebook:有沒有辦法獲得authorization_token?
- 12. 有沒有辦法將屏幕捕獲爲實時視頻?
- 13. 有沒有辦法在php中獲取視頻長度?
- 14. Oracle:有沒有辦法獲得視圖的列數據類型?
- 15. 設置視頻的尺寸
- 16. 在C中獲取視頻尺寸#
- 17. YouTube API:沒有獲得給定頻道的所有視頻
- 18. 沒有獲得8位灰度圖像的glcm矩陣尺寸
- 19. Videojs獲得視頻尺寸以全屏模式
- 20. 有沒有辦法將VS.NET中的代碼窗口擴展爲最大尺寸?
- 21. 有沒有辦法在不同的屏幕尺寸上更改浮點數?
- 22. 有沒有辦法讓頂層GTK窗口小於默認的最小尺寸?
- 23. 有沒有辦法訪問視頻的像素?
- 24. 有沒有辦法使用css調整iframe視頻的大小?
- 25. 有沒有辦法設置默認的HTML5視頻音量?
- 26. 有沒有辦法檢測視頻上的臉部特徵?
- 27. 有沒有辦法在HTML5中捕捉攝像頭的視頻?
- 28. 有沒有辦法讓DJI Phantom 3的視頻流到Unity?
- 29. 爲什麼視頻的尺寸小於iOS照片的尺寸
- 30. iOS ooyala視頻播放器:有沒有辦法播放視頻列表?
我相信Railo使用''標籤,但我很確定他們只是在幕後調用ffmpeg。 –
2012-03-23 16:34:46
是的以上評論,請參閱:http://stackoverflow.com/questions/9424005/can-cfvideo-tag-from-railo-be-used-under-adobe-cf – Henry 2012-03-23 17:37:44