AVCHD2SRT for Windows and Linux

FFMPEG-based program to extract the time/date/GPS/speed information from a h264 video stream and make this available in a subtitle file of the SRT format.

Using googleapi, the GPS location information is translated to an address (street/place/state/country) where possible and added. An internet connection and the packages "wget" and "awk" are required for this to work.

Tested on Ubuntu 10.10 and Windows 7 – older/other versions may work as well.

Copyright (c) 2010, 2011 Henry Devettens - The Netherlands - henryd65@gmail.com




The GPS data can be entered directly as formatted into maps.google.com. In the example above, simply type “30 6 29.53 N 31 32 32.81 E” in the address field.

CHANGE LOG

Version 0.7 – 5 Jun 2011:

avchd2srt-core:

Version 0.6 – 2 Jun 2011:

avchd2srt-core:

avchd2srt:

avchd2srt.awk:

Version 0.5 – 16 Feb 2011:

avchd2srt-core:

Will provide two distribitions: one for Linux, one for Windows.

Version 0.4 - 29 Jan 2011:

avchd2srt:

avchd2srt-core:

Version 0.3 - 29 Dec 2010:

avchd2srt:

avchd2srt-core:

Version 0.2 - 24 Dec 2010:

avchd2srt:

avchd2srt-core:

Version 0.1 - 27 Nov 2010:

First beta release

REFERENCES

For the complete FFMPEG package (0.6.1 has been used): http://www.ffmpeg.org/download.html

Phil Harley's exiftool and H264 doc: http://owl.phy.queensu.ca/~phil/exiftool/TagNames/H264.html

GMERLIN package, especially learnings from bgavdump: http://hirntier.blogspot.com

Example program for FFMPEG: http://dranger.com/ffmpeg/tutorial01.html

H264 muxer/demuxer: http://www.smlabs.net/tsmuxer_en.html

BACKGROUND

Sony AVC-HD camcorders insert metadata with every thirteenth frame or so, containing date, time, camera settings and when available geo-position information. This program reads the metadata and converts it to an SRT subtitle file. This makes it possible to edit and join single clips into one large fragment, then extract the metadata into an SRT file. Mediaplayers can then play both simultaneously. Or the SRT can be merged with the fragment using tsMuxeR (converting it to a PGS stream).

Use e.g. Sony's PMB for editing and tsMuxeR for joining clips.

More advanced use with e.g. Corel VideoStudio Pro X3:

PACKAGE CONTENTS

Linux package:

avchd2srt-core.c: the source code for the core program (uses the ffmpeg package)

avchd2srt-core: Linux executable, running for instance under Ubuntu 10.10

avchd2srt: linux bash script wrapper around the core, adding address info

avchd2srt.awk: awk script used to extract the address from the google API information

00 Readme.html: this file

A2S capture.jpg: the example image that belongs to the Readme file.

Windows package:

avchd2srt-core.c: the source code for the core program (uses the ffmpeg package)

avchd2srt-core.exe: Windows executable, running for intstance under Windows7 (cmd script)

avchd2srt.cmd: Windows script wrapper around the core, adding address info

avchd2srt.awk: awk script used to extract the address from the google API information

00 Readme.html: this file

A2S capture.jpg: the example image that belongs to the Readme file.

DEPENDENCIES

The program was created on Ubuntu 10.10, running under VMPlayer 3.1.2 on Windows 7 HP. It has not been tested on other Linux releases. There may be unknown dependencies as a result.

The core does not depend on runtime libraries. The script requires wget and awk (gawk on Windows) to get address information from Google via Internet. If Google changes the data format the script may stop working correctly. That has happened already before... You may have to fix it in the avchs2srt.awk script.

Windows version also runs “stand alone”. Please note it cannot handle path names – only video files in the current folder.

INSTALLATION

Unpack the zipped tar file and store in a folder somewhere, preferably a folder in your path.

You can run the wrapper script (avchd2srt) from anywhere, as long as the core (avchd2srt-core) and the awk scrript (avchd2srt.awk) are in the same directory as the wrapper script. Usage:

avchd2srt videofile1.mts [videofile2.mts...]

This will create files videofile1.srt etc with the subtitle, videofile1.log with video and processing information and temporary file videofile1.loc with data for the address (if Internet is working). Wildcards in filenames are supported.

Make sure that the applications wget and gawk have been installed as well.

The Linux executable runs on Ubuntu 10.10, and as such can also easily be run in a guest Ubuntu using VMPlayer on Windows. Ubuntu 10.10 comes with wget and awk, so no additional installation is required.

The Windows executable runs on Windows 7 – other windows versions may work. Get “gawk.exe” from http://gnuwin32.sourceforge.net/packages/gawk.htm and get “wget.exe” from http://users.ugent.be/~bpuype/wget/#download, please make sure these are in a folder in your path.

WARNINGS

The software is made available without any warranty - see also licensing below.

The core program will happily overwrite an .srt file if that was passed as a parameter. Hence make sure you only pass e.g. .m2ts or .MTS files.

BUGS

Many, I'm sure.

TO DO

  1. Test more on non-Sony full HD camera's

LICENSING

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.