Youtube mixer

MOJO's icon

I'm looking to make a video mixer that can crossfade between two youtube videos. Do you know of a way to do this in Jitter? I've got as far as trying to take the linked swf file and putting it into jweb but it does not seem to play.

Can anyone point me in the right direction?

Thanks

Lou K.'s icon

I expect this might be more easily done in Flash.

nesa's icon

I'm sure youtube won't like this, but since it's caturday:

Max Patch
Copy patch and select New From Clipboard in Max.

Dg's icon

Woh! Xellent!

Would you comment a little bit what are you doing with these regular expression?

I tryed to set a different youtube link, but I get only the tags.

Max Patch
Copy patch and select New From Clipboard in Max.

nesa's icon

It very much depends on the network, since qt.movie will try to asyncread directly from the url.
Banging 'p make_download_url' might reload the video.

I just tried your link, it works here(love the part with just two hands in the frame btw).

-n

Lou K.'s icon

Tried running the first patch and got the error -

jit.qt.movie: error -2048 reading URL

Subsequent mucking around returned error 503. Hmmm. Is the patch still working for others?

4nt0n's icon

The same with me.
I tried nesa's code and I got the same error:
error -2048 reading url

nesa's icon

Hi,

this is a hack, there's no guarantee that it's gonna work on your system.

error 2048 might mean that you're missing codec that can play flash videos, try installing perian.

error 503 is general 'service unavailable' error, this probably happens if you try to load the video too often and youtube suspects your doing something you shouldn't (i.e. this).

good luck!

4nt0n's icon

Hey perfect!
Once I installed perian everything works smoothly
thnx a lot!

MOJO's icon

Nesa, that is brilliant. There is some complex things going on there. Could you explain how you went about building it?

I now want use this patch in a project in college were I'm building an on line editing system using mobile phones for input. I want to use a live video sharing website called Qik (http://qik.com/) to upload content then stream it into max. The developers of the Qik have given me permission to use their API if it helps me in my project.

I am wondering Nesa were do I change your code to work with Qik videos?

endziu's icon

unfortunately perian workaround doesn't work for PC ;(. Anybody got a pc solution?

Kapten Center's icon

this is great! Is it possible to recieve the sound as well?

Ghostdad's icon

awesome hack! looks like the audio plays as well (provided you can get the flv's to play in quicktime with something like perian). in the qtm patcher you can change the volume level of the jit.quicktime.movie object.

i've got two instances running smooth. a crossfader and render window wouldn't be hard to add from there!

Ghostdad's icon

oh but you may need spigot~ to get audio to crossfade in msp. common question for quicktime mov's. not sure spigot is completely solid in max 5 yet tho i've read threads saying they're revising it for jitter 2. it works okay for me sometimes. i'm gonna try and build this up when i'm not at work i'll holler with what comes up!

Ghostdad's icon
MOJO's icon

To get the volume to work just change the @vol attrib in jit.qt.move from 0 to 1.

eleven_t's icon

to those who can't play flv due to quicktime bollocks on windows:

change the [combine] arguments in make_download_url patcher to:

combine http://www.youtube.com/get_video?&video_id= vid &t= t &fmt=18 @triggers 3

added &fmt=18 gets the url of an mp4 not flv if possible ;>

hope this helps...

edit: video plays only for few seconds, don't know why is that?

Greg Benton's icon

Here's a desktop application that does just that! Check it out...

asmarquis's icon

MOJO, your project sounds really interesting, I'm a New Media student at the University of Maine, USA and I am intrigued by your project. What do you mean by online editing system? my sense is that anyone will be able to edit uploaded content virally? Love to hear more.

esimmens's icon

i'm getting a 404 error when it is looking for the youtube url...I assume this is because youtube has once again changed the format of their urls in order to prevent users from download .flv files. has anyone had any luck with this patch recently? or any updates to correctly parse the new youtube url format? i saw a library for Processing that does this sort of thing

esimmens's icon

i've also looked into jweb a lot but there's currently no way to get jweb to output to jitter matrices...

Dg's icon

Any news about nesa patch?
Regular expression is really a hard way to go ...
Anyone in this forum to share something that would work with youtube new format?

Brico's icon
Dg's icon

Same issue: crash with qt.movie.
Any chance to have a look at your java patch?

Brico's icon

sure. basically the crucial bit is here, where it extracts the links from the page source:
[code]
private HashMap getVideoLink() throws Exception{
        String pageSource = getPageSource("http://www.youtube.com/watch?v=" + videoID);
        // System.out.println(videoID);

        Matcher matcher = Pattern.compile(""t":\s*"([^"]*)"").matcher(pageSource);
        matcher.find();
        String videoTicket = matcher.group(0);
        videoTicket = videoTicket.replace(""t": "", "").replace(""", "");
        // System.out.println(videoTicket);

        matcher = Pattern.compile(""fmt_url_map":\s*"([^"]*)"").matcher(pageSource);
        matcher.find();
        String videoFormats = matcher.group(0);
        videoFormats = videoFormats.replace(""fmt_url_map": "", "").replace(""", "");

        // parse fmt_url_map
        HashMap videoURLs = new HashMap();
        String sep1 = "%2C", sep2 = "%7C";
        if (videoFormats.indexOf(",") > -1) { // new UI
            sep1 = ",";
            sep2 = "\|";
        }
        String[] videoFormatsGroup = videoFormats.split(sep1);

        for (int i = 0; i < videoFormatsGroup.length; i++) {
            String[] videoFormatsElem = videoFormatsGroup[i].split(sep2);
            videoURLs.put(Integer.parseInt(videoFormatsElem[0]), URLDecoder.decode(videoFormatsElem[1]).replace("\", "").replace("u0026", "&") + "&title=video");
        }

        return videoURLs;
    }
[/code]