Skip to content

Example of creating a CSV with a Mediainfo template

Notifications You must be signed in to change notification settings

pozar/mediainfo2csv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 

Repository files navigation

#mediainfo2csv

Example of creating a CSV from media containers with mediainfo. I had a need to create a database of streams in a bunch-o-files. In reality, containers such as MP4, can have zero to multiple video, audio and data streams. This script assumes that there is only one video and audio file in it. Anything outside of that will not be captured by it. Ideally, one would just scrape the XML that mediainfo spits out and use that. This is the quick and dirty method.

Running mediainfo2csv > foo.csv should get you something like...

General;CompleteName	Format	Format_Profile	CodecID	FileSize	Duration	OverallBitRate_Mode	OverallBitRate	Encoded_Date	Tagged_Date	Video;ID	Format	Format/Info	Format_Profile	Format_Settings_CABAC	Format_Settings_RefFrames	Format_Settings_GOP	CodecID	CodecID/Info	Duration	BitRate	BitRate_Maximum	Width	Height	DisplayAspectRatio/String	FrameRate_Mode	FrameRate	ColorSpace	ChromaSubsampling	BitDepth	ScanType	Bits-(Pixel*Frame)	StreamSize	Encoded_Library/String	Encoded_Library_Settings	Encoded_Date	Tagged_Date	Audio;ID	Format	Format/Info	Format_Profile	CodecID	Duration	BitRate_Mode	BitRate	BitRate_Maximum	Channel(s)	ChannelPositions	SamplingRate	Compression_Mode	StreamSize	Encoded_Date	Tagged_Date
/Camera/20151029_053230.mp4	MPEG-4	Base Media / Version 2	mp42	12807843	5943		17240912	UTC 2015-10-29 09:32:41	UTC 2015-10-29 09:32:41	1	AVC	Advanced Video Codec	High@L4	Yes	1	M=1, N=30	avc1	Advanced Video Coding	5943	16969333		1920	1080	16:9	VFR	29.933	YUV	4:2:0	8	Progressive	0.273	12613759			UTC 2015-10-29 09:32:41	UTC 2015-10-29 09:32:41	2	AAC	Advanced Audio Codec	LC	40	5931	CBR	256000		2	Front: L R	48000	Lossy	189784	UTC 2015-10-29 09:32:41	UTC 2015-10-29 09:32:41
/Camera/20151029_170238.mp4	MPEG-4	Base Media / Version 2	mp42	160052408	74368		17217342	UTC 2015-10-29 21:03:53	UTC 2015-10-29 21:03:53	1	AVC	Advanced Video Codec	High@L4	Yes	1	M=1, N=30	avc1	Advanced Video Coding	74259	16993716		1920	1080	16:9	VFR	29.970	YUV	4:2:0	8	Progressive	0.273	157632732			UTC 2015-10-29 21:03:53	UTC 2015-10-29 21:03:53	2	AAC	Advanced Audio Codec	LC	40	74368	CBR	256000		2	Front: L R	48000	Lossy	2379844	UTC 2015-10-29 21:03:53	UTC 2015-10-29 21:03:53
/Camera/VID_20121021_202147.mp4	MPEG-4	Base Media	isom	10141115	11947		6790736	UTC 2012-10-22 01:22:01	UTC 2012-10-22 01:22:01	1	AVC	Advanced Video Codec	[email protected]	No	1	M=1, N=30	avc1	Advanced Video Coding	11748	6524561		1280	720	16:9	VFR	23.976	YUV	4:2:0	8	Progressive	0.295	9592542			UTC 2012-10-22 01:22:01	UTC 2012-10-22 01:22:01	2	AAC	Advanced Audio Codec	LC	40	11947	CBR	96000		1	Front: C	48000	Lossy	143541	UTC 2012-10-22 01:22:01	UTC 2012-10-22 01:22:01
/Camera/VID_20130205_202042.mp4	MPEG-4	Base Media	isom	53713597	65707		6539772	UTC 2013-02-06 01:21:49	UTC 2013-02-06 01:21:49	1	AVC	Advanced Video Codec	[email protected]	No	1	M=1, N=30	avc1	Advanced Video Coding	65447	6418740		1280	720	16:9	VFR	24.000	YUV	4:2:0	8	Progressive	0.290	52520004			UTC 2013-02-06 01:21:49	UTC 2013-02-06 01:21:49	2	AAC	Advanced Audio Codec	LC	40	65707	CBR	96000		1	Front: C	48000	Lossy	788561	UTC 2013-02-06 01:21:49	UTC 2013-02-06 01:21:49

WARNING: Field names can and will repeat. For instance, Duration is used for the container, audio and video streams. This means that if you try to import this into a DB, the field names will collide.

About

Example of creating a CSV with a Mediainfo template

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages