On Mon, Apr 10, 2023 at 09:21:06PM +0200, Philipp Wolfer wrote:
>
> > I'm not quite sure which date and time you are referring to, but
> the
> > release date is usually stored inside m["妻ay"].
> >
> It's one of the tag values - creation_date.
>
> I'm still not sure which data you are actually looking for. The iTunes
> metadata specs have "妻ay" defined as the release date. Maybe that
> already is what you are looking for. Might also be that there is
> another tag some software commonly writes that I'm not aware of.
> If you are looking for creation and modification times of the files
> those are actually file system attributes and not part of the metadata.
> In Python you can access the creation and modification time for a file
> using the os.path.getctime and os.path.getmtime functions (see
> [3]
https://docs.python.org/3/library/os.path.html#os.path.getctime).
>
Here's the json for a stream of one of my MP4 files as output by
ffprobe :-
{
"index": 1,
"codec_name": "aac",
"codec_long_name": "AAC (Advanced Audio Coding)",
"profile": "LC",
"codec_type": "audio",
"codec_tag_string": "mp4a",
"codec_tag": "0x6134706d",
"sample_fmt": "fltp",
"sample_rate": "48000",
"channels": 2,
"channel_layout": "stereo",
"bits_per_sample": 0,
"id": "0x2",
"r_frame_rate": "0/0",
"avg_frame_rate": "0/0",
"time_base": "1/48000",
"start_pts": 0,
"start_time": "0.000000",
"duration_ts": 2442240,
"duration": "50.880000",
"bit_rate": "125247",
"nb_frames": "2385",
"extradata_size": 2,
"disposition": {
"default": 1,
"dub": 0,
"original": 0,
"comment": 0,
"lyrics": 0,
"karaoke": 0,
"forced": 0,
"hearing_impaired": 0,
"visual_impaired": 0,
"clean_effects": 0,
"attached_pic": 0,
"timed_thumbnails": 0,
"captions": 0,
"descriptions": 0,
"metadata": 0,
"dependent": 0,
"still_image": 0
},
"tags": {
"creation_time": "2022-10-01T17:09:31.000000Z",
"language": "und",
"vendor_id": "[0][0][0][0]"
}
It's the "creation_time" value I'm after.
> > For some example code maybe take a look at
> >
> [4]
https://github.com/quodlibet/quodlibet/blob/main/quodlibet/format
> s/mp4.py#L82-L113
> > , where the data gets loaded from a MP4 file by iterating over all
> tags and
> > applying some mapping.
> >
> At first glance I don't really follow that code but I'll take a
> longer
> look later.
>
> Maybe best would be that you check what tags are actually in your file.
> If you just take your original code and print the loaded data it'll
> show you all the metadata keys and values:
> >>> from mutagen.mp4 import MP4
> >>> m = MP4("P1030761.MP4")
> >>> print(m)
>>> from mutagen.mp4 import MP4
>>> m = MP4("P1030761.MP4")
>>> print(m)
{}
>>>
P1030761.MP4 is the file from which the ffprobe output above comes so it
definitely has some metadata! :-)
--
Chris Green