Menu Sign In Contact FAQ
Banner
Welcome to our forums

A video with dynamic subtitles or a GPS moving map insert

Steve – many thanks for those pointers, but may I ask (because I am lazy) whether you or anyone else can put together an actual example (e.g. a batch file for a DOS box, winXP) whereby a text file, say CSV or something vaguely similar (time HH:MM:SS:SS in the 1st column, obviously) would be inserted into an mp4 video file, into a black-background stripe, in some specific font (say Courier) and specific position?

The black stripe is not necessary if the text being inserted is say black with a white shadow around it.

I guess the simplest way to implement it would be for all the text to end up as a single line at the bottom of the video frame, left-justified. Then new columns could be added to the input file and it would work so long as it doesn’t drop off the RH end.

The other way would be to generate an mp4 file (outside of any video editor) with just the text and a transparent background (which is possible – example) and I could just drop that into Vegas as a second video channel (or a 3rd, etc, if doing subtitles or whatever).

Chris – thanks for the great answer. That’s a powerful package you have there. However, the above video needs a sign-in of some sort.

Administrator
Shoreham EGKA, United Kingdom

However, the above video needs a sign-in of some sort.

Sorry, published as private. Now public so should work.



Spending too long online
EGTF Fairoaks, EGLL Heathrow, United Kingdom

but may I ask (because I am lazy) whether you or anyone else can put together an actual example

I’ll knock something together later.

Chris…. That’s a powerful package you have there.

(!) ;)

OK, I’ve found a really trivial way to do this.

Create an SRT file (this I’ll leave to you, but it’s really straightforward – you could do it as a VBScript in Excel or something – possibly even just an Excel formula))

The format is as ultranomad posted (or the second link I posted above).

Then use VidCoder (https://vidcoder.codeplex.com/).

Open your source video, then select your SRT file, and it will ‘burn’ the subtitles into the video.

Many thanks Steve.

I downloaded 1.5.6 beta (the last that runs on XP ). It turns out to be basically Handbrake but with more features in the GUI. Handbrake, which I have been using for years, can also import an SRT file.

So now I need to play with generating SRT files… initially I could start with Oziexplorer track logs, of this format

OziExplorer Track Point File Version 2.0
WGS 84
Altitude is in Feet
Reserved 3
0,2,255,Track Log File – 04/05/2015 08:33:26,1,,,,60
0
50.096345, 14.283482,1, 1405.0,42128.3155787, 04/05/2015, 07:34:26
50.096337, 14.283452,0, 1404.0,42128.3156481, 04/05/2015, 07:34:32
50.096363, 14.283462,0, 1359.0,42128.3195139, 04/05/2015, 07:40:06
50.096335, 14.283487,0, 1368.0,42128.3245370, 04/05/2015, 07:47:20
50.096613, 14.283992,0, 1360.0,42128.3265162, 04/05/2015, 07:50:11
50.097288, 14.283917,0, 1351.0,42128.3268981, 04/05/2015, 07:50:44
50.097202, 14.282795,0, 1350.0,42128.3272454, 04/05/2015, 07:51:14
50.096742, 14.281493,0, 1351.0,42128.3274306, 04/05/2015, 07:51:30
50.096288, 14.280208,0, 1353.0,42128.3275926, 04/05/2015, 07:51:44
50.095837, 14.278927,0, 1356.0,42128.3277662, 04/05/2015, 07:51:59
50.095607, 14.277640,0, 1359.0,42128.3282523, 04/05/2015, 07:52:41
50.096270, 14.276627,0, 1353.0,42128.3284491, 04/05/2015, 07:52:58
50.096927, 14.275617,0, 1352.0,42128.3285995, 04/05/2015, 07:53:11
50.097573, 14.274628,0, 1349.0,42128.3287269, 04/05/2015, 07:53:22
50.098260, 14.273580,0, 1350.0,42128.3288542, 04/05/2015, 07:53:33
50.098885, 14.272462,0, 1348.0,42128.3289931, 04/05/2015, 07:53:45
50.099440, 14.271305,0, 1347.0,42128.3291435, 04/05/2015, 07:53:58

I reckon one could do the conversion with sed, provided one removed the 6-line header junk manually.

Administrator
Shoreham EGKA, United Kingdom

Of course, I forgot Handbrake could read SRT files… Forget the thing I suggested then!

Unless you use a fixed width font, you’ll want to have multiple separate text blocks with co-ordinates on each otherwise the numbers will constantly jump all over the place.

Peter, what kind of output are you looking for from that source data? i.e. what do you want it to say?

Administrator
EGTR / London, United Kingdom

I would be happy just to put it underneath the video (say 20 pixels up from the bottom and 20 pixels from the left) in one line, and then copy out the values in that CSV file, with some titles I can easily edit e.g.

TIME: (time) POSITION: (LAT LONG) ALTITUDE: (ALT) etc

I can see 100 ways to convert the CSV into SRT. A while ago I would have done it with SED. Or even a Basic program.

All that stuff is in the Oziexplorer track file, in an obvious form
50.619690, 6.887390,0,10181.0,42128.4394213, 04/05/2015, 10:32:46
which is lat, long, unknown, altitude, unknown, date, time

Later on I will have values like heading, FOB and LFOB, wind aloft, etc. and I will add them as new columns into the CSV file before converting it.

The other approach I could take is to grab the NMEA from the KLN94, which has a lot more stuff in it, but I don’t have that coming out on a connector currently. That is also CSV.

Administrator
Shoreham EGKA, United Kingdom

You’ll need to offset the time though. Obviously the time in the SRT file is with reference to the start of the video, but the time in your log is UTC.

Also, you’ll want the ‘start’ time of the next subtitle to always be one frame after the ‘stop’ time of the previous one, or they’ll flash on and off.

You could probably, if you were a sadist, do this with SED, but I think you’d be better off using a higher level language!

OK; thanks… very good points Steve.

Presumably that also means that an SRT for a 25fps video will not work for a 30fps (actually 29.99-something) video? Those seem to be the two frame rates in common use.

In fact I bet this wheel has been reinvented a thousand times. I seem to recall that a lot of people used this (which I designed in 1991) for doing it on the fly…

Administrator
Shoreham EGKA, United Kingdom
Sign in to add your message

Back to Top