Adding a useful informatin to your video files – such as title, authors, the date of production, and some description – can be quite helpful to both yourself and your customers. This additional data – or meta data – can be used by media players to organize your many video files. Unfortunately, while adding such meta data to audio files is straightforward, adding useful meta data to video files is … a nightmare. But don’t despair, as we’ve compiled some useful information for you!
Project Meta Data
Kdenlive allows you to specify the meta information that should be added to a rendered file. Just go to Project > Project Settings, then select the second tab named Metadata.
For your convenience, Kdenlive automatically adds the following four elements to each new project:
- author – doesn’t work for .mp4 containers, but for .mov containers; you may use artist instead with .mp4 containers.
- year – please note that this element does not work for video rendered into MP4 containers (such as .mov and .mp4). See below for more details. Use a date element instead. Oh, this year element is actually quite pesky: you can delete it, but it will automatically reappear. So simply ignore it … as ffmpeg does too.
But there are more elements that you actually may use with your MP4 containers.
Unfortunately, there are competing sets of meta data when working with MP4 containers. The older, standard MP4 set is rather limited in what additional meta data can be used. Then, there is Apple iTunes, and that brings in a lot of meta data, and even changes the allowed set from time to time. We will come back to this difference in a second.
Unfortunately, information about what meta data can be used in which situation is rather scarce, sometimes outdated, and sometimes plainly wrong. Of course, this may also apply to this Toolbox article, but I’ve taken much effort to cross-check things in real life. As Kdenlive uses ffmpeg for encoding, one would think that there’s plenty of information – unfortunately, it’s not, and the scarce information is sometimes plainly wrong. At some point, I’ve resorted to reading the source code in order to find out which so-called MP4 atoms actually are supported and through which element names (the magic happens inside
moveenc.c). Luckily, you don’t need to dive into the source anymore.
Finally, please note that other container formats, such as Matroska (.mkv) or *cough* Audio Video Interleave (.avi), support yet other sets of meta data elements. So, variance galore!
Ffmpeg Supported MP4 Container Meta Information
But now for the real meat: here come the available meta data elements that ffmpeg supports.
- Please note that you must use the ffmpeg meta data keys from the second column in the table below as the metadata keys in Kdenlive’s Project Metadata dialog!
- Ffmpeg supports different meta data elements, based on the type of container. And this container type normally gets derived from the container filename suffix (ending): in particular, .mp4 and .mov.
Meta Data Key
||The title of this video. (String)||©nam|
||The date of production. Please note that the ffmpeg documentation is totally wrong here, there is no key named year, but only date. (String)||©day|
||The copyright of your video. (String)||©cpy|
||The name of the (video) artist. Please don’t use this element for the composer, as there is a dedicated element especially for the composer, see below. (String)||©ART|
||The name of the album artist: this may be a guest artist or a featured artist. This element can also be left out or be the same name as the artist. (String)||aART|
||The author of the video. (String)||©aut|
||The name of the composer. (String)||©wrt|
||The title or the name of this album. (String)||©alb|
||A (content) description of this video. For a synopsis, please see the separate element instead. (String)||desc|
||A (short) comment on your video. This will probably a comment set by the audience, not at the time of production. (String)||©des|
||Same as before, but encoded in a separate element. (String)||©cmt|
||A synopsis, a longer description of this video. (String)||ldes|
||The genre this video belongs to. (String)||©gen|
||The name of a group of videos somehow belonging together. In contrast to the album elment, grouping happens inside (that is, below) the album level. (String)||©grp|
||The name of the TV show, if applicable. (String)||tvsh|
||Either the episode name or episode number, for display. If necessary, use the separate, yet optional episode number element for correct sorting. (String)||tven|
||This element is for sorting only, but never displayed. It allows numerical sorting of episode names that are strings, but not (necessarily) numbers. The valid range is limited to 0 to 255 only, so this doesn’t support all those endless telenovas, it seems… (Int8)||tves|
||The season number, in the range of 0 to 255 only. (Int8)||tvsn|
||Optional lyrics for badly sung sing-along… (String)||©lyr|
||If 1, then this video file is part of a compilation. 0 otherwise. (Int8)||cpil|
||Not available to us users, as it gets automatically set by ffmpeg itself; this is set to the libavformat version string.||©swr|
||Not available to us users, as it gets automatically set by ffmpeg itself; this is set to the libavformat version string.||©too|
- There is no way to add cover art or DVD art to MP4 containers through ffmpeg, and in consequence, in Kdenlive. Instead, you need to resort to other video container tagging tools, such as AtomicParsley.
The following references give some more background information on ffmpeg and meta data in .mov/.mp4 containers.
- First, and foremost, the ffmpeg source code for reference, and
mov_write_ilst_tag()is responsible to write the iTunes-compatible tags for .mp4 containers.
mov_write_udta_tag()write the MPEG-standard tags instead, when using a .mov container.
- How To: Create/Write ID3 tags using ffmpeg by Jon Hall. This article finally got me on the right track. However, beware of a few incorrect ffmpeg keys in Jon’s table (such as the TIT3 key, which I think isn’t correct); these may be due to later changes in ffmpeg (or whatever). In the end, since some of Jon’s keys didn’t work, I went for the ffmpeg source code which is the authorative source, of course. Nevertheless, I’m very thankful to Jon and he is some of the rare really good sources with good insight into the topic. Most other source just tell you how to press some buttons on some application, but don’t give you any clue as to what is actually going on behind the scenes.
- How To: Dump and Load metadata with ffmpeg by Jon Hall. Sheds more light on how to work with meta data when it comes to ffmpeg.
- FFmpeg Metadata article from the MultimediaWiki.
Is it possible to add some custom atom in the header of a video file?
I need to add the term “loop” in the header of MP4 files before the “moov” atom.
More information can be found here :
Note: Just opening the video file using any text editor shows the file header and atoms.
I do not want to edit the headers via too much calculations, as the answer suggests. Is there a simple FFMPEG command to add
the atom “loop” to any MP4 files?
Use Case :-
WhatsApp does a smart thing. Their animated GIFs are actually MP4 files (which contain this atom “loop”), and the MP4 files
which it wants to treat as videos in their UI, they do not add that “loop” atom
I tried loads of -loop and stream loop commands.. Nothing is adding the atom “loop” to my mp4 files
My current command for converting a GIF to MP4 is as follows :
ffmpeg -i giphy9.gif -c:v libx264 -c:a aac -pix_fmt yuv420p -movflags +faststart giphy9_loop.mp4
I wish to add some parameter to the above command (or maybe run a separate command) so that the output mp4 file has that
“loop” atom in the header.
Kdenlive leverages ffmpeg for encoding, so if ffmpeg doesn’t support certain atoms, there’s no way for Kdenlive to get it into the rendered output file. I checked the most recent
moveenc.cfrom ffmpeg’s source code repo and it doesn’t include support for the LOOP atom.
I highly recommend consulting the ffmpeg forum for your question; it might be even better to file a feature request or issue with the ffmpeg project.
Only after ffmpegs adds support for the LOOP atom with a corresponding metadata key(!!) you can start using it in Kdenlive without the need for any Kdenlive updates, as you could then simply set the key through the project meta data dialog. But you need ffmpeg supporting this.
How To: Dump and Load metadata with ffmpeg by Jon Hall is dead, but available on internet archives:
Muchas gracias. ?Como puedo iniciar sesion?
The signature line is located in the lower proper nook of
FYI, the links to the Jon Hall articles are dead, but I found them on a different domain: