[FFmpeg-user] How to access H.264 MP4 timecode data

Francois Visagie francois.visagie at gmail.com
Fri Jan 31 16:46:17 CET 2014


> -----Original Message-----
> From: ffmpeg-user-bounces at ffmpeg.org [mailto:ffmpeg-user-
> bounces at ffmpeg.org] On Behalf Of Rio Kierkels
> Sent: 31 January 2014 17:29
> To: FFmpeg user questions
> Subject: Re: [FFmpeg-user] How to access H.264 MP4 timecode data
> 
> On 31 January 2014 16:22, Francois Visagie
> <francois.visagie at gmail.com>wrote:
> 
> > Hi All,
> >
> >
> >
> > I'm trying to access the timecode information stored by my camcorder,
but
> > not having any luck. The camera is set to H.264 MP4 recording in this
case.
> > According to ExifTool as well as ffprobe and ffmpeg the timecode data is
> > present, but I haven't been able to find a way to extract it.
> >
> >
> >
> > According to the ffprobe manual:
> >
> > ffprobe supports Timecode extraction:
> >
> > *       .
> > *       MOV timecode is extracted from tmcd track, so is available in
the
> > tmcd stream metadata ('-show_streams', see TAG:timecode).
> >
> > I would expect this to extract the timecode stream, but only 1
> TAG:timecode
> > value is printed. Also, the "unsupported codec" message does not inspire
> > much confidence that this actually can work:
> >
> >
> >
> > C:\Users\fvisagie\Videos\Home Videos\Testing\AVCHD metadata
> > subtitles>ffprobe -i MVI_0006.MP4 -select_streams 2 -show_streams
> >
> > ffprobe version N-54277-gff130d7 Copyright (c) 2007-2013 the FFmpeg
> > developers
> >
> >   built on Jun 30 2013 01:20:12 with gcc 4.7.3 (GCC)
> >
> >   configuration: --enable-gpl --enable-version3 --disable-w32threads
> > --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r
> > --enable-gnutls --enab
> >
> > le-iconv --enable-libass --enable-libbluray --enable-libcaca
> > --enable-libfreetype --enable-libgsm --enable-libilbc
--enable-libmodplug
> > --enable-libmp3lame --ena
> >
> > ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg
> > --enable-libopus --enable-librtmp --enable-libschroedinger
--enable-libsoxr
> > --enable-libsp
> >
> > eex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc
> > --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-
> libx264
> > --enable-libxavs --
> >
> > enable-libxvid --enable-zlib
> >
> >   libavutil      52. 37.101 / 52. 37.101
> >
> >   libavcodec     55. 17.100 / 55. 17.100
> >
> >   libavformat    55. 10.100 / 55. 10.100
> >
> >   libavdevice    55.  2.100 / 55.  2.100
> >
> >   libavfilter     3. 77.101 /  3. 77.101
> >
> >   libswscale      2.  3.100 /  2.  3.100
> >
> >   libswresample   0. 17.102 /  0. 17.102
> >
> >   libpostproc    52.  3.100 / 52.  3.100
> >
> > Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'MVI_0006.MP4':
> >
> >   Metadata:
> >
> >     major_brand     : mp42
> >
> >     minor_version   : 1
> >
> >     compatible_brands: mp42avc1CAEP
> >
> >     creation_time   : 2014-01-30 17:57:13
> >
> >     timecode        : 11:54:27:03
> >
> >   Duration: 00:00:03.84, start: 0.000000, bitrate: 35109 kb/s
> >
> >     Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
> > 1920x1080, 34508 kb/s, 50 fps, 50 tbr, 50k tbn, 100k tbc
> >
> >     Metadata:
> >
> >       creation_time   : 2014-01-30 17:57:13
> >
> >     Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo,
> > fltp, 253 kb/s
> >
> >     Metadata:
> >
> >       creation_time   : 2014-01-30 17:57:13
> >
> >     Stream #0:2(eng): Data: none (tmcd / 0x64636D74), 1 kb/s
> >
> >     Metadata:
> >
> >       creation_time   : 2014-01-30 17:57:13
> >
> >       timecode        : 11:54:27:03
> >
> > Unsupported codec with id 0 for input stream 2
> >
> > [STREAM]
> >
> > index=2
> >
> > codec_name=unknown
> >
> > codec_long_name=unknown
> >
> > profile=unknown
> >
> > codec_type=data
> >
> > codec_time_base=1/25
> >
> > codec_tag_string=tmcd
> >
> > codec_tag=0x64636d74
> >
> > id=N/A
> >
> > r_frame_rate=0/0
> >
> > avg_frame_rate=0/0
> >
> > time_base=1/50000
> >
> > start_pts=0
> >
> > start_time=0.000000
> >
> > duration_ts=192000
> >
> > duration=3.840000
> >
> > bit_rate=1600
> >
> > nb_frames=192
> >
> > nb_read_frames=N/A
> >
> > nb_read_packets=N/A
> >
> > DISPOSITION:default=0
> >
> > DISPOSITION:dub=0
> >
> > DISPOSITION:original=0
> >
> > DISPOSITION:comment=0
> >
> > DISPOSITION:lyrics=0
> >
> > DISPOSITION:karaoke=0
> >
> > DISPOSITION:forced=0
> >
> > DISPOSITION:hearing_impaired=0
> >
> > DISPOSITION:visual_impaired=0
> >
> > DISPOSITION:clean_effects=0
> >
> > DISPOSITION:attached_pic=0
> >
> > TAG:creation_time=2014-01-30 17:57:13
> >
> > TAG:language=eng
> >
> > TAG:timecode=11:54:27:03
> >
> > [/STREAM]
> >
> >
> >
> > How do I go beyond this to extract the full tmcd stream? 'ffprobe -i
> > MVI_0006.MP4 -select_streams 2 -show_packets -show_data ' produces
> output
> > like:
> >
> > [PACKET]
> >
> > codec_type=data
> >
> > stream_index=2
> >
> > pts=191000
> >
> > pts_time=3.820000
> >
> > dts=191000
> >
> > dts_time=3.820000
> >
> > duration=1000
> >
> > duration_time=0.020000
> >
> > convergence_duration=N/A
> >
> > convergence_duration_time=N/A
> >
> > size=4
> >
> > pos=14832527
> >
> > flags=K
> >
> > data=
> >
> > 00000000: 0031 507d                                .1P}
> >
> >
> >
> > Is the '0031 507d' what I'm looking for, and if so, how to interpret
that?
> > Alternatively, if I'm barking up the wrong tree please point me to the
> > right
> > one!
> >
> >
> >
> > Many thanks,
> >
> > Francois
> >
> >
> >
> > Francois Visagie
> >
> >
> >
> >
> >
> > T: +27 (83) 326-4358
> >
> > F: +27 (86) 511-3490
> >
> > E: francois.visagie at gmail.com
> >
> >
> >
> >
> >
> > _______________________________________________
> > ffmpeg-user mailing list
> > ffmpeg-user at ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-user
> >
> 
> I don't think the data stream is what you need. Essentially you've already
> got the timecode.
> 
> TAG:timecode=11:54:27:03
> 
> This gives you the starting time code of the first frame of your video.
> This combined with the frame rate and video length is enough to set time
> code for your entire file.
>

I'm aware of this approach and am considering it for other applications, but
for this one it has some drawbacks. It requires additional steps to recreate
the rest of the (existing) timecode stream, and mainly it cannot account for
editing discontinuities. Thanks for the suggestion, though!

> --
> 42
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user



More information about the ffmpeg-user mailing list