从视频中提取缩略图 - jQuery 插件?
我正在使用 jwplayer 在网站上显示视频。
我正在寻找一个 jQuery 插件,可以从这些视频中提取缩略图,因为上传者只上传视频,而不上传缩略图。 我的目标是在表格中以缩略图形式显示视频(如 YouTube)。
我有什么想法可以实现这一目标吗?
I'm using jwplayer to display videos on a website.
I'm looking for a jQuery plugin that can extract thumbnail images from these videos because uploaders upload only the videos, no thumbnails. My aim is to show the videos as thumbnails in a table (like Youtube).
Any ideas how I can achieve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
它不适用于 jQuery。您无法让 jQuery 从视频文件中提取缩略图,因为它是一个客户端 Javascript 库,甚至不知道“视频文件”是什么。
该怎么做:为了获取视频缩略图,您需要一种可以访问上传的视频文件的服务器端编程语言。只要您的服务器上有可以提取图像的可执行程序,您就可以使用任何编程语言来执行此操作。
一个简单的工作流程是(例如):用户上传文件后,您的网站调用服务器上的脚本来提取缩略图,完成后,您可以将用户重定向到最终页面。
因此,例如,在您的服务器上,您需要
ffmpeg
,然后查看 其他人用来从视频文件获取缩略图。It doesn't work with jQuery. You can't get jQuery to extract a thumbnail from a video file because it's a client side Javascript library that doesn't even know what a "video file" is.
What to do instead: In order to get a video thumbnail you need a server side programming language that has access to the uploaded video file. You can probably do this with any programming language as long as you have an executable program on your server that can extract images.
A simple workflow would be (for example): After the user uploads the file, your website calls a script on the server that extracts the thumbnail and after it has finished, you can redirect the user to the final page.
So, for example, on your server you need
ffmpeg
and then see what others use to get thumbnails from video files.有一种方法使用 HTML5,
原文链接
http://jsfiddle.net/vphyr/`
there a way using HTML5,
Original link
http://jsfiddle.net/vphyr/`
当用户上传视频时,在
标记中显示该视频。我显示一张图像来通知用户他的视频已准备好,他现在可以按上传按钮将其上传到服务器。
此 MVC 代码只需复制并粘贴并测试它完全可以在其自身上工作
这里只需使用输入类型=文件,您可以使用 HTML 正常完成:
当用户更改或选择视频文件时,您应该使用该文件添加验证。如果您愿意,请输入。显示图像功能:它只是利用javascript文件读取器创建base64文件并将其放入视频或图像的src属性中。
target:是视频的标签,我将视频的src=64base放入其中
放置图像:是简单的功能,检查文件视频是否存在,如果是,则转到其他位置
make src= 用户使用它选择文件的 HTML 文件标记
target=用户将在其中看到视频图像的 HTML 视频标签
结论是,当用户从他的设备上传视频时,我所做的只是在视频标签中显示视频而没有播放按钮,这样他就可以知道他的视频已准备就绪。
When the user upload video, show this video in a
<Video/>
tag. I show an image to inform the user that his video is ready and he could press upload button now to upload it to server.This MVC code just copy and paste and test it work completely on itself
Here just use input type=file, you can do it normally with HTML:
When the user change or select file which is a video, you should add validation using the file.type if you wish. Show image function: it just makes use of javascript file reader to create base64 file to put it in src attribute of video or image.
target: is the tag of video which I put in it the src=64base of the video
put image: is simple function check the if the file video if yes it goes to else
make src= the HTML file tag where the user select the file using it
target=the HTML video tag where the user will see an image of the video
For conclusion, as the user upload video from his device what I did is just show the video in video tag without play button so he could know that his video ready.