Jump to content




Video Player - Watch Rick Roll in ComputerCraft!

media utility computer

47 replies to this topic

#1 CrazedProgrammer

  • Members
  • 495 posts
  • LocationWageningen, The Netherlands

Posted 27 May 2015 - 07:53 PM

Have you ever wanted to play a video in ComputerCraft?
Well now you can!
Video:


Downloads:
Video Player: pastebin get W69aKDBh player
VideoConverter
Rick Roll file
Move Your Feet file (high resolution, might be slow)

Buttons:
|| The video is paused, play the video.
|> The video is playing, pause the video.
L Load a video.
X Close the player.
When you click on the time bar at the bottom it skips.

It is recommended that you set the maximum disk space to at least 100 MB in the file %appdata%\.minecraft\config\ComputerCraf­t.cfg:
I:computerSpaceLimit=100000000

To convert a video to the video player format, you first need to convert the video to
a bunch of JPGs or PNGs using something like the Video to JPG Converter by DVDVideoSoft.
When you've done that, launch the VideoConverter application.
Click on the "Select First Frame" button and select the first image.
Note that all images need to be in a separate directory, so you can't have 2 videos in one directory.
Enter the width, height and FPS in the text fields.
It's recommended that you don't make the video bigger than 50x50 pixels and that it isn't higher than 30 FPS.
The limit is 255 pixels wide and high, 255 FPS and 65536 frames.
At 30 FPS, the maximum length is 36.4 minutes.
When you're done setting the options, click on the "Convert" button and save the video to the folder of your ComputerCraft computer.
It will take a few seconds/minutes and then you're done.

Edited by CrazedProgrammer, 28 May 2015 - 05:53 PM.


#2 Creator

    Mad Dash Victor

  • Members
  • 2,168 posts
  • LocationYou will never find me, muhahahahahaha

Posted 27 May 2015 - 08:10 PM

This is actually amazing. You deserve a +1.

#3 flaghacker

  • Members
  • 655 posts

Posted 27 May 2015 - 08:34 PM

Looks nice, but I think you managed to mess up the "controls" section of your post :P.

And, as I already said somewhere else, awesome idea to "create" more colors!

#4 CrazedProgrammer

  • Members
  • 495 posts
  • LocationWageningen, The Netherlands

Posted 27 May 2015 - 08:34 PM

View PostCreator, on 27 May 2015 - 08:10 PM, said:

This is actually amazing. You deserve a +1.
Thanks!

#5 CrazedProgrammer

  • Members
  • 495 posts
  • LocationWageningen, The Netherlands

Posted 27 May 2015 - 08:45 PM

View Postflaghacker, on 27 May 2015 - 08:34 PM, said:

Looks nice, but I think you managed to mess up the "controls" section of your post :P.

And, as I already said somewhere else, awesome idea to "create" more colors!
Thanks!
I hope I fixed the "controls" section correctly.

#6 flaghacker

  • Members
  • 655 posts

Posted 27 May 2015 - 10:05 PM

View PostCrazedProgrammer, on 27 May 2015 - 08:45 PM, said:

View Postflaghacker, on 27 May 2015 - 08:34 PM, said:

Looks nice, but I think you managed to mess up the "controls" section of your post :P/>.

And, as I already said somewhere else, awesome idea to "create" more colors!
Thanks!
I hope I fixed the "controls" section correctly.

Aha, I see. I didn't understand what you meant at first. It clearer now...

#7 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 28 May 2015 - 01:47 AM

Did you record your video then add the sound later, or...?

#8 nitrogenfingers

    Lua Professor

  • Members
  • 551 posts
  • LocationAustralia

Posted 28 May 2015 - 02:10 AM

Wow that dithering...

Nice work man :)

#9 Cranium

    Ninja Scripter

  • Moderators
  • 4,031 posts
  • LocationLincoln, Nebraska

Posted 28 May 2015 - 04:17 AM

Very nice. I love the dithering on it as well, and the fact that it runs at a fairly high framerate. Do you get any lag while playing it on those monitors?

I can't help but wonder though if you'd be able to run the program from cached memory of the files hosted on a website. Such as reading the file data from GitHub or any other hosted site. Then users can play it that way, rather than having to alter their config files. I think it's worth a shot if you can make it.

#10 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 28 May 2015 - 04:52 AM

View PostCranium, on 28 May 2015 - 04:17 AM, said:

I can't help but wonder though if you'd be able to run the program from cached memory of the files hosted on a website.

Erm, that strikes me as a move in the wrong direction. The RR video is 10mb, for eg. Asking MineCraft servers to do those sort of downloads every time they do playback might be a bit much?

Beats me how many filesize reduction techniques are already in play here - I see filesizes have gone down since posting the initial "Move Your Feet" video, so something's definitely changed to improve matters - but I'd suggest dropping repeated frames, partial frame updates, and perhaps some RLE or something as well.

#11 CrazedProgrammer

  • Members
  • 495 posts
  • LocationWageningen, The Netherlands

Posted 28 May 2015 - 05:31 AM

View PostBomb Bloke, on 28 May 2015 - 01:47 AM, said:

Did you record your video then add the sound later, or...?
Yes.
It is impossible to play real audio files with Computercraft.

View Postnitrogenfingers, on 28 May 2015 - 02:10 AM, said:

Wow that dithering...

Nice work man :)
Thanks!

#12 CrazedProgrammer

  • Members
  • 495 posts
  • LocationWageningen, The Netherlands

Posted 28 May 2015 - 05:40 AM

View PostCranium, on 28 May 2015 - 04:17 AM, said:

Very nice. I love the dithering on it as well, and the fact that it runs at a fairly high framerate. Do you get any lag while playing it on those monitors?

I can't help but wonder though if you'd be able to run the program from cached memory of the files hosted on a website. Such as reading the file data from GitHub or any other hosted site. Then users can play it that way, rather than having to alter their config files. I think it's worth a shot if you can make it.
Thanks!
On those monitors (8x6 blocks 1x text scale) it stays around 20fps with the Rick Roll video.
I only got some miniscule frame drops.
It really depends on how big the video is and how many changes per frame occur.
For example, the Move Your Feet video is 4 times as big and that can lag a little.

The file handling is already slow in CC, I can't imagine that streaming from the web would be better.
I could make it download the entire video into RAM but depending on the internet connection it would also take a very long time.

#13 CrazedProgrammer

  • Members
  • 495 posts
  • LocationWageningen, The Netherlands

Posted 28 May 2015 - 06:01 AM

View PostBomb Bloke, on 28 May 2015 - 04:52 AM, said:

View PostCranium, on 28 May 2015 - 04:17 AM, said:

I can't help but wonder though if you'd be able to run the program from cached memory of the files hosted on a website.

Erm, that strikes me as a move in the wrong direction. The RR video is 10mb, for eg. Asking MineCraft servers to do those sort of downloads every time they do playback might be a bit much?

Beats me how many filesize reduction techniques are already in play here - I see filesizes have gone down since posting the initial "Move Your Feet" video, so something's definitely changed to improve matters - but I'd suggest dropping repeated frames, partial frame updates, and perhaps some RLE or something as well.
Only changes are written to the file.
The way the file format works is this (in bytes):
abcddeefghfghfgh...
Header:
a - width
b - height
c - FPS
d - number of frames (+1)
Frame:
e - number of changes
Change:
f - X position
g - Y position
h - color

So it is pretty compressed the way it is.

#14 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 28 May 2015 - 09:33 AM

View PostCrazedProgrammer, on 28 May 2015 - 05:31 AM, said:

It is impossible to play real audio files with Computercraft.

Not so! A resource pack along with playsound can play most anything. Granted you can't pause/resume that (at least, not to my knowledge), but it wouldn't surprise me if one of the peripheral mods add further options.

Edit:

Actually, looks like you could do it with just the resource pack:

Spoiler

By dividing the sound clip into tons of eg ~3-5 second snippets, even resuming should be quite simple from there.

Edited by Bomb Bloke, 28 May 2015 - 09:38 AM.


#15 CrazedProgrammer

  • Members
  • 495 posts
  • LocationWageningen, The Netherlands

Posted 28 May 2015 - 06:19 PM

View PostBomb Bloke, on 28 May 2015 - 09:33 AM, said:

View PostCrazedProgrammer, on 28 May 2015 - 05:31 AM, said:

It is impossible to play real audio files with Computercraft.

Not so! A resource pack along with playsound can play most anything. Granted you can't pause/resume that (at least, not to my knowledge), but it wouldn't surprise me if one of the peripheral mods add further options.

Edit:

Actually, looks like you could do it with just the resource pack:

Spoiler

By dividing the sound clip into tons of eg ~3-5 second snippets, even resuming should be quite simple from there.
Thanks for explaining!

#16 biggest yikes

  • Members
  • 573 posts

Posted 30 May 2015 - 12:54 AM

Maybe we could have some sort of "ComputerCraft YouTube" where you could upload your .ccv files and view them?
Either way, excellent work :)
EDIT: It turns out that converting a video to CCV compacts it, the original video file I converted was 92.4 MB and now it's 3.91 MB, but I guess that's because it has to convert it to 16 colors.

Edited by Atenefyr, 30 May 2015 - 01:04 AM.


#17 CrazedProgrammer

  • Members
  • 495 posts
  • LocationWageningen, The Netherlands

Posted 30 May 2015 - 10:06 AM

View PostAtenefyr, on 30 May 2015 - 12:54 AM, said:

Maybe we could have some sort of "ComputerCraft YouTube" where you could upload your .ccv files and view them?
Either way, excellent work :)
EDIT: It turns out that converting a video to CCV compacts it, the original video file I converted was 92.4 MB and now it's 3.91 MB, but I guess that's because it has to convert it to 16 colors.
Thanks!
That would be possible, but I don't know if the http API is fast enough.
The reason why converting a video to CCV decreases file size is that there are less pixels (max 255x255, recommended 50x30) and that it only writes changes in the pixels.
Also, there are a total of 256 colors instead of 16777216, and there is no audio.

Edited by CrazedProgrammer, 30 May 2015 - 10:08 AM.


#18 Shefla

  • Members
  • 30 posts

Posted 30 May 2015 - 12:18 PM

This is actually amazing.
Love how you made 256 colors out of 16.

#19 CrazedProgrammer

  • Members
  • 495 posts
  • LocationWageningen, The Netherlands

Posted 30 May 2015 - 01:44 PM

View PostShefla, on 30 May 2015 - 12:18 PM, said:

This is actually amazing.
Love how you made 256 colors out of 16.
Thanks!

#20 biggest yikes

  • Members
  • 573 posts

Posted 30 May 2015 - 01:49 PM

View PostCrazedProgrammer, on 30 May 2015 - 10:06 AM, said:

View PostAtenefyr, on 30 May 2015 - 12:54 AM, said:

Maybe we could have some sort of "ComputerCraft YouTube" where you could upload your .ccv files and view them?
Either way, excellent work :)
EDIT: It turns out that converting a video to CCV compacts it, the original video file I converted was 92.4 MB and now it's 3.91 MB, but I guess that's because it has to convert it to 16 colors.
Thanks!
That would be possible, but I don't know if the http API is fast enough.
The reason why converting a video to CCV decreases file size is that there are less pixels (max 255x255, recommended 50x30) and that it only writes changes in the pixels.
Also, there are a total of 256 colors instead of 16777216, and there is no audio.
I know about why it decreases file size, but what do you mean by 256 colors? I thought there were 16.





3 user(s) are reading this topic

0 members, 3 guests, 0 anonymous users