[FFmpeg-user] Extracting embedded xml metadata im mp4
Robert Krüger
krueger at lesspain.software
Wed Oct 19 20:31:21 EEST 2016
On Wed, Oct 19, 2016 at 5:39 PM, Moritz Barsnick <barsnick at gmx.net> wrote:
> On Wed, Oct 19, 2016 at 12:32:00 +0200, Robert Krüger wrote:
> > Hi,
> >
> > I am currently looking at files from Sony A7S cameras (h264 in mp4) and
> > looking at those files in a hex/text editor I can see that they have xml
> > metadata written in a "meta" tag as far as I can see:
>
> I couldn't find a sample to test. I found one with a "Timed Metadata
> Media Handler" data stream in this ticket:
> https://trac.ffmpeg.org/ticket/5645
> but it seems to contain binary data.
>
> Using
> $ ffprobe -show_packets -show_data
> or even
> $ ffprobe -show_packets -show_data -print_format compact
> you should see each packet's data in hexadecimal form. That could be
> parsed back to plain text (or binary, or whatever was in your data
> stream).
>
> To actually *extract* the data, I used this patch:
> http://ffmpeg.org/pipermail/ffmpeg-devel/2016-May/194445.html
>
> A newer version is here, though I think that's not the one I tested:
> http://ffmpeg.org/pipermail/ffmpeg-devel/2016-June/195929.html
>
> Note that both were rejected on ffmpeg-devel.
>
> I used that patch (patched ffmpeg) to extract the data stream to
> (Base64 text) file, and converted that to original data:
>
> $ grep -Ev ':|^\;' sony_a7s_XAVC_S_1080_25p_10s.fftextdata | perl
> -MMIME::Base64 -e 'while(<>) { print decode_base64($_) . "\n"; }'
>
>
I was wondering why the sample name looked familiar. It's mine :-).
> But as I said, there's only binary data in that sample apparently, and
> I *seem* to see the same stuff in the extracted data an in the MP4
> file.
>
>
In my case, I would not expect the data to be in a packet, so I guess the
-show_packets approach would not work. I want to extract the data using API
anyway but if it works on the command line, I know it works via API as well.
I just checked. The sample from ticket 5645 also contains that xml metadata
in the "meta" atom which is the last atom of the file. Contained data is:
<?xml version="1.0" encoding="UTF-8"?>
<NonRealTimeMeta
xmlns="urn:schemas-professionalDisc:nonRealTimeMeta:ver.2.00"
xmlns:lib="urn:schemas-professionalDisc:lib:ver.2.00" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
lastUpdate="2016-03-05T14:17:25Z">
<TargetMaterial
umidRef="060A2B340101010501010D431300000006C66D98527405C0FCDBB3FFFE513305"/>
<Duration value="252"/>
<LtcChangeTable tcFps="25" halfStep="false">
<LtcChange frameCount="0" value="19060600" status="increment"/>
<LtcChange frameCount="251" value="20160600" status="end"/>
</LtcChangeTable>
<CreationDate value="2016-03-05T14:17:25Z"/>
<Device manufacturer="Sony" modelName="ILCE-7S" serialNo="4294967295"/>
<RecordingMode type="normal" cacheRec="false"/>
</NonRealTimeMeta>
Are those meta atoms parsed in the mov demuxer?
More information about the ffmpeg-user
mailing list