1

I'm curious to know if I can program the videos that can be played on computer in general and on Youtube as a special case.

I had this crazy idea and I was able to create a very simple toss the coin game (without programming) on youtube: https://youtu.be/fkYYF5w5vpE

I think programming a video would create more complex games and has some other nice applications like choosing whether or not to watch the movie uncut, turn on and off 3D feature, creating videos for visually impaired people, ..etc.

On Youtube, I think it would be dangerous as in the past, hackers wrote programming lines (viruses) in a jpg or gif file extensions and uploaded it to the servers of the websites. So, If videos can be programmed on computers. Is it possible to upload them safely?

Edit:

I would like to write some codes inside a video so that it randomly chooses between two frames (Head or Tail). When someone plays the video, the head will appear. When he pauses and plays again, the Tail appears. Just like the linked video but the one that I would like to make should somehow contain programming code inside it.

1 Answers1

4

You cannot use a video to execute code or embed code inside a video without exploiting some property of the video file format or video player software itself. Video files are code that video players execute but the code is handling the frames and sound information. Non-frame or sound information would likely not be handled by a video player well.

Here is another relevant Stack Exchange post you should check out if you want to learn more.

YouTube most certainly would not allow that. If they did, you can imagine that malicious actors would put all kinds of malware to brick people's computers, steal information, and otherwise cause problems.

However...

You can write a program to randomly show one picture or another picture and have it loop for a time period and record this to save into a video format, edit it and upload it to YouTube. Even the video editing process could be programmed using something like ffmpeg and YouTube has an API for uploading but that is not the question at hand.

User gronostaj points out that people have come up with ideas for "interactive" videos on YouTube before. Here is an article I found about interactive YouTube videos to see more ideas on how this works.

kemotep
  • 156
  • 1
  • 1
  • 7