Hello,
I am a visual artist and at the moment I am working on a video. I want to add, as subtitles, about 100 different sentences that appear one by one every 5 seconds. The difficulty is: I want the sentences to appear in a random order. Does anyone know if it is possible to script a subtitle file in such a way that it randomly picks one sentence every 5 seconds?
Thank you very much for your help!
Luuk
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 21 of 21
Thread
-
-
Scripting? I don't think so.
But it would be easy in most programming language if you have any such experience. Like java, php, etc. -
So maybe I should ask this question on a programming forum?
Do you think it would be possible to create a blu-ray with java-programmed subtitles?
Thank you -
And I was thinking of making ONE subtitle file with random sentences....making it random every time you play it would require a special subtitle decoder.
-
Probably you'll have to create your own special software
(OR "hire" someone for doing that).
Keep in mind that the "well-known" digital subtitle formats were designed for being «useful», not for being displayed *at random*. -
It's important that it's random every time I play it. Otherwise I would just add the subtitles in Adobe Premiere...
So I guess I'll need a special program for that, or some kind of subtitle decoder. -
Blu Ray spec won't allow for what you're trying to do. You're either going to have to use another medium or use other techniques (such as multiple versions of the same video) to give the "illusion" of randomness.
-
Yet another of the endless variations on what I call the old "I want to do something that nobody else in the world wants to do, so why doesn't software exist that allows me to do it?" question. This is almost always followed by a posting from the OP who is just shocked beyond belief that I would dare to suggest that nobody else in the world wants to do this and that surely hundreds of thousands of people at a minimum if not almost the entire population of the world wants to do this just like they do, yet they have no explanation at all for why there are no programs that can do it.
-
Well I suppose, in theory, this is possible.
You first create not one video but split that into 100 5 second chunks and place the 100 videos into a playlist - your player, obviously, has to support playlists.
Now you need 100 sub-title files and a program that runs in the background that randomly selects one, renames it to match the video segment that plays next, so when that video starts it loads that sub-title segment.
So that's the theory. Just do not ask me how to program for it -
Perhaps a clever AviSynth guru could manage it?
I think of storing 100 single lines in numbered text files and overlay these randomly every 5 seconds. I've seen these functions in the AviSynth docs that may be able to do it ? ...
ConditionalReader
rand
subtitle
The player should accept AviSynth scripts and the system must be fast to do it in real time.
It's just a thought. I'm not that guru (and it's bed time too). -
-
You could create a script that invents an SRT subtitle file from text within a .txt file then loads VLC or something to play the video with external subtitles, which then exits, repeat infinite.
VLC has a --play-and-exit option.
You could even make multiple SRTs and create a playlist with the --sub-file=<string> option.
https://wiki.videolan.org/VLC_command-line_helpLast edited by ndjamena; 1st Jun 2014 at 22:35.
-
There is a random function for playlists. I have no idea if this could be used for subtitles, or if a "master" subtitle script could play while the individual videos were randomized.
-
Thank you for so many reactions! I know that it might seem a bit impossible, but unfortunately that is the nature of my job. I personally find things more interesting when they haven't been done before.
I'll take some time to research each of the options you have suggested me and I'll let you know if there is any progress.
Thank you very much -
It really shouldn't be that hard to pull off, even with batch
--fullscreen will open a video in full screen with VLC. Assuming you use windows, if you kill explorer and install a Desktop Wallpaper that matches the video you could make the transitions a little neater.
You could use %TIME% to check how long the video played, if it's too short, restart explorer and exit the batch. That way you can hide the Command Prompt and end the batch by simply closing VLC early. I'd use MediaInfoCLI or FFProbe to find the length of the video, but if you already know the length there's no need.
.srt files would be simple enough to create with a simple echo Text>>"FileName.srt" [or >], so that would definitely work. Although it may be better to get it working without exiting the player constantly, if it's possible at all that will take a bit of research and fiddling to pull off. -
Randomizing a text list is a trivial matter for any programmer. But if you want this on a Blu-ray or DVD disc I don't think there's any way do that it runtime.
-
Yes, maybe my blu-ray idea is a bit ambitious... I can also play it from a computer and connect it to a projector...
-
-
It is possible using LUA scripting in AviUtl.
Demo video: see attached mp4 (around 1 minute, randomly select a sentence every 5 seconds)
To adapt the script for your own use:
Unzip the attached zip file
Copy the obj file into the .\script folder of AviUtl installation
Open the aup project file with AviUtl
See if some text appears on the main window (if some text appears, it works)
To customize the text:
open the obj file with a text editor
Add more text inside the brackets:
Code:local phrase={ "Eternity lies ahead of us and behind", "Have you drunk you fill?", "God does not play dice.", "Moe Culture", "More Text" }
Parameters(sliders):
Interval... time between re-picking subtitle
Style... borderd text, shadowed text...
Size... font size
Color button... font color
Other tweaks via script modification:
Code:obj.setfont("MS UI Gothic",obj.track2,obj.track1, color, RGB(0,0,0))
0,0,0: Shadow/Border color
That will become hard-coded into the video though, but different every time you encode it.Last edited by MaverickTse; 4th Jun 2014 at 08:44.
-
I wrote a quick little C++ program that takes a list of 5 lines of text and creates an SRT subtitle file with the subs in shuffled order. The subs are spaced at 5 second intervals and each sub displays for 4 seconds. Given input that looks like this:
Code:Subtitle 1 Subtitle 2 Subtitle 3 is\ntwo lines long Subtitle 4 Subtitle 5
Code:1 00:00:00,000 --> 00:00:04,000 Subtitle 2 2 00:00:05,000 --> 00:00:09,000 Subtitle 5 3 00:00:10,000 --> 00:00:14,000 Subtitle 4 4 00:00:15,000 --> 00:00:19,000 Subtitle 3 is two lines long 5 00:00:20,000 --> 00:00:24,000 Subtitle 1
-
Hello,
Sorry for my very late reaction. MaverickTse and jagabo, thank you very much for you work. I am sure I can use these scripts for my project.
I've connected a Python script to VLC using a socket file, and I think I can create the subtitle file from the same script. I will let you know how it went.
Thanks again!