I am trying to see if it is possible to make a thumbnail pic from an online video (videos run in flash) programmatically. Just to elaborate on what I am exactly looking to do:
I have a link to to a video that plays in a browser using adobe flash. I would like to take a screenshot of the video (at any frame would do for now) using any programming language (prefer python). Also I have noticed that when one uploads a video on youtube, it automatically generates a thumbnail. Any pointers as to if this is a viable option and how to go about it?
Thanks
Related
Hello guys !
I'm working on a personal project, and I have a little problem which is the following one:
I'm using the moviepy module to build videos, with sound; When I execute my program,
I have the result that I expected, I mean the video I wanted to have, and I can read it well
from my PC as a mp4 video using VLC.
But,
When I try to export this video to my iPhone (I tried to use Google Drive, Dropbox, emails, etc),
the sound disappear.
What makes me think the mistake comes from my code ?
When I'm on my phone, I can read the video very well straightly from Google Drive (or something else), but when I trying to save it on my gallery (pictures/videos), the sound disappears at this moment. Even when I post my video directly from Dropbox to Instagram, it says that "this video has no sound".
Obviously, I've tried different .mp4 videos (not created with moviepy), and it works very well.
I'm so exhausted of spending hours trying to figured out where the problem could come from, that's why I'm asking for your help.
Here is the function that build my videos with the sound, and where I'm 100% sure the the problem is from :
def build_sentence_video(self):
logo = mpy.ImageClip(self.logo_path).set_position('center', 0).resize(width=100, height=100).set_position((10,5))
clip = mpy.VideoClip(self.make_simple_frame, duration=10)
video = mpy.CompositeVideoClip([clip, logo], size=VIDEO_SIZE).on_color(color=WHITE, col_opacity=1).set_duration(4)
video_with_new_audio = video.set_audio(AudioFileClip(self.audio, buffersize=200000, fps=44100))
video_with_new_audio.write_videofile(self.fr_word+".mp4",
fps=2,
)
Sorry in advance if my english is awful.
Thank you for your help !
After a long research, I can't find a way to get the mpd url for a YouTube video. My question is, is it even possible to get it?
In theory, YouTube has to have a manifest file, so that it could play out the segment files. My research has led to some old posts where people have allegedly found a way to do it. A python script that is supposed to extract the mpd file. After analyzing, what exactly it is done, I have found that line 68, he is looking for a dashmpd, which is not contained in the code. I thought maybe the name of the parameter is changed, and tried to look for some URL, but without success.
mpdurl = html[html.find("dashmpd"):]
Topic where MPD file is used., another similar topic.
So again, my question is is it even possible to extract the mpd url/file from a YouTube video? Or is it encrypted and not possible any more? Does it make a difference if the video is in webm or mp4 format?
I have a parent file type that is folderish, and I would like to include a thumbnail of the first page of a child pdf in the template. Can someone roughly outline the tools and process you can imagine would achieve this, so that I can investigate further?
Getting out the first page of pdf can be achieved by using ghostscript.
This is an example script which forms an gostscript command and stores the images. I took this from collective.pdfpeek. Which by the way could solve your problem right away :-)
Until few days ago I would have recommended you not to use it, since it was a little bit buggy, but they recently shipped a new version, so give it a try! I'm not sure whether they now support DX or not.
So the workflow for you should be.
Uploading a PDF
Subscribe modified/creation events.
create image of first page using ghostscript (check my command, or collective.pdfpeek)
store it as blob (NamedBlobImage) on your uploaded pdf.
Also implement some queueing like collective.pdfpeek to not block all your threads with ghostscript commands.
OR
Give collective.pdfpeek a shot!
BTW:
imho on a large scale the preview generation for pdfs needs to be implemented as a service, which stores/manages the images for you.
I have a lot of external links from users, and I need to scrap somehow the video content and generate thumbnail for it to display on my site.
I know this is a simple task with django-oembed, but the list of providers is limited. I need to support sites without oembed too.
So the main task is to determine if page contains the video or no, and generate thumbnail for it.
Can anybody suggest the best way?
You can use Pymedia to extract a frame from the video and PIL to create the thumbnail like suggested here
I'm writing a CLI for a music-media-platform. One of the features is going to be that you can directly play YouTube videos from the CLI. I don't really have an idea of how to do it, but this one sounded the most reasonable:
I'm going to use of those sites where you can download music from YouTube, for example, http://keepvid.com/ and then I directly stream and play this, but I have one problem. Is there any Python library capable of doing this and if so, do you have any concrete examples?
I've been looking, but I found nothing, even not with GStreamer.
You need two things to be able to download a YouTube video, the video id, which is represented by the v= section of the URL, and a hidden field t= which is present in the page source. I have no idea what this t value is, but it's what you need :)
You can then download the video using a URL in the format;
http://www.youtube.com/get_video?video_id=*******&t=*******
Where the stars represent the values obtained.
I'm guessing you can ask for the video id from user input, as it's straightforward to obtain. Your program would then download the HTML source for that video, parse the source for the t value, then download the video using the newly constructed URL.
For example, if you open this link in your browser, it should download the video, or you can use a downloading program such as Wget;
http://www.youtube.com/get_video?video_id=3HrSN7176XI&t=vjVQa1PpcFNM4c8MbEhsnGaNvYKoYERIJ-hK7ErLpUI=
It appears that KeepVid is simply a JavaScript bookmarklet that links you to a KeepVid download page where you can then download the YouTube video in any one of a variety of formats. So, unless you want to figure out how to stream the file that it links you to, it's not easily doable. You'd have to scrape the page returned and figure out which URL you wanted to download, and then you'd have to stream from that URL (and some of the formats may or may not be streamable anyway).
And as an aside, even though they don't have a terms of service specified, I'd imagine that since they appear to be mostly advertisement-supported that abusing their functionality by going around their advertisement-supported webpage would be ethically questionable.