1

I have MPEG-2 Transport Stream (M2T) .ts files recorded on an airborne camera platform. They have embedded KLV/MISB metadata that I would like exported to a CSV.

When I ran the command:

exiftool '/file.ts'

It returns the following 56 lines, which looks like some basic header information and a single frame of MISB data. (Redacted some of the results but you can see all the headers)

ExifTool Version Number : 13.34 File Name : REDACTED Directory : REDACTED File Size : 25 MB File Modification Date/Time : 2023:07:19 21:39:01-04:00 File Access Date/Time : 2025:01:30 15:23:56-05:00 File Inode Change Date/Time : 2025:09:04 19:02:15-04:00 File Permissions : -rwxr-xr-x File Type : M2T File Type Extension : m2t MIME Type : video/mpeg Warning : [minor] The ExtractEmbedded option may find more tags in the video data [x2] Duration : 0:00:36 GPS Date Time : REDACTED Mission ID : REDACTED GPS Track : REDACTED Sensor Name : LWIR Image Coordinate System : WGS84 GPS Latitude : REDACTED GPS Longitude : REDACTED Horizontal Field Of View : REDACTED Vertical Field Of View : REDACTED Sensor Relative Azimuth Angle : REDACTED Sensor Relative Elevation Angle : REDACTED Sensor Relative Roll Angle : REDACTED Slant Range : REDACTED Frame Center Latitude : REDACTED Frame Center Longitude : REDACTED Target Location Latitude : REDACTED Target Location Longitude : REDACTED Target Location Elevation : REDACTED Target Error Estimate CE90 : REDACTED Target Error Estimate LE90 : REDACTED Generic Flag Data 01 : (none) Security Version : REDACTED Magnetic Heading : REDACTED UAS LS Version Number : REDACTED Event Start Time : REDACTED Operational Mode : Other Frame Center Height Above Ellipsoid: REDACTED Sensor Velocity North : REDACTED Sensor Velocity East : REDACTED Corner Latitude 1 : REDACTED Corner Longitude 1 : REDACTED Corner Latitude 2 : REDACTED Corner Longitude 2 : REDACTED Corner Latitude 3 : REDACTED Corner Longitude 3 : REDACTED Corner Latitude 4 : REDACTED Corner Longitude 4 : REDACTED Full Pitch Angle : REDACTED Full Roll Angle : REDACTED MIIS Core Identifier : (Binary data 18 bytes, use -b option to extract) Target Width Extended : (Binary data 3 bytes, use -b option to extract) Sensor Ellipsoid Height Extended: (Binary data 3 bytes, use -b option to extract) GPS Position : REDACTED 

I saw the warning about the ExtractEmbedded so I ran this command:

exiftool -ee '/file.ts'

This returned 46,015 results. This lead me to believe this includes the MISB data for all of the frames.

However, what I'm looking to do is drop all of that into a CSV file so I can animate graphs from various elements in Python or R. Basically I want one frame of metadata per line.

What I tried:

exiftool -csv -ee '/file.ts' > 'file.csv'

However this only exported the headers and a single frame of information to a single row of the CSV.

Any ideas what I'm missing? Thank you!

EDIT:

Exporting to CSV and JSON have the same problem, where each video file can only export to a single row with a set of columns for each frame of video. This makes processing in R extremely slow and inefficient. It was faster just to export to a .txt file and parse the data that way.

1 Answer 1

0

It sounds like you're expecting a row for each line of data. But the `-csv` option prints one row per file.

From the docs on the -csv option

If the -a option is used to allow duplicate tag names, the duplicate tags are only included in the CSV output if the column headings are unique. Adding the -G4 option ensures a unique column heading for each tag.

You might try adding -a -G4 to your command, but I suspect that you will end up with 46k columns.

A better options would probably be either the -j (-json) option or the -X (-xmlFormat) option. The -json option will also require the -G4 option, but I'm not sure about the -xmlFormat.

If you absolutely require the output in CSV, you'll have to use the -p (-printFormat) option. See also FAQ #12 "How do I export information from exiftool to a database?", paragraph starting "Finally, the -p option may be used…".

Sign up to request clarification or add additional context in comments.

3 Comments

I opted to export using the -j option combined with -a and -G4. This provided a format where the headers that repeat start with "copy####:" and all the data I need is in the file. I'll just have to figure out how to turn that into a table in Python or R. Thank you!
The -a option is automatically activated when using the -j option (last line of the first paragraph under the docs on -j), so it can be dropped from your command. But it won't change anything if you leave it.
Great to know, thank you! However, I ended up going back to a .txt file over a JSON. It turns out, it takes a lot less time and processing to turn a raw .txt file into a dataframe. Somethign about a JSON file who's structure is 1x10,000,000 is not efficient.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.