[FFmpeg-user] How to preserve the time code of first frame
Friedrichsen, Merle
Merle.Friedrichsen at tib.uni-hannover.de
Wed Nov 4 17:05:46 CET 2015
Hello,
MediaInfo shows me metadata regarding the time code of some videos (see
two outputs below).
I transcode these videos to ffv1/matroska. Unfortunately the information
on the time code of the first frame isn't
in the metadata of the matroska-file.
When I transcode an MPEG-PS-files to ffv1, the "time code of the first
frame" is never shown in the metadata.
When the time code is saved as a data-stream, in some cases the time
code of the first frame is in the general
metadata, and sometimes not.
I tried -copyts (see report below) but it didn't work (at least I could
not find the time code of the first frame in the
metadata).
And -f ffmetadata doesn't catch the time code of the first frame.
How can I ensure that the information on the time code of the first
frame is preserved to the ffv1/matroska-file?
Thank you very much for your help.
Greetings,
Merle
## MediaInfo Output file 1 #######
General
Complete name : file1.wmv
Format : Windows Media
File size : 102 MiB
Duration : 1mn 3s
Overall bit rate mode : Constant
Overall bit rate : 13.6 Mbps
Maximum Overall bit rate : 15.3 Mbps
Video
ID : 2
Format : VC-1
Format profile : MP at HL
Codec ID : WMV3
Codec ID/Info : Windows Media Video 9
Codec ID/Hint : WMV3
Description of the codec : Windows Media Video 9 -
Professional
Duration : 1mn 3s
Bit rate mode : Constant
Bit rate : 15.0 Mbps
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate : 25.000 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Compression mode : Lossy
Bits/(Pixel*Frame) : 0.289
Stream size : 113 MiB
Audio
ID : 1
Format : WMA
Format version : Version 2
Codec ID : 161
Codec ID/Info : Windows Media Audio
Description of the codec : Windows Media Audio 9.2 - 256
kbps, 44 kHz, stereo 2-pass CBR
Duration : 1mn 3s
Bit rate mode : Constant
Bit rate : 256 Kbps
Channel(s) : 2 channels
Sampling rate : 44.1 KHz
Bit depth : 16 bits
Stream size : 1.93 MiB (2%)
Other
Type : Time code
Format : WM TC
Time code of first frame : 00:00:00:00
## MediaInfo output file 2 ########
General
Complete name file2.mpg
Format : MPEG-PS
File size : 259 MiB
Duration : 4mn 58s
Overall bit rate : 7 274 Kbps
Video
ID : 224 (0xE0)
Format : MPEG Video
Format version : Version 2
Format profile : Main at Main
Format settings, BVOP : Yes
Format settings, Matrix : Default
Format settings, GOP : M=3, N=12
Format settings, picture structure : Frame
Duration : 4mn 58s
Bit rate : 7 000 Kbps
Width : 720 pixels
Height : 576 pixels
Display aspect ratio : 4:3
Frame rate : 25.000 fps
Standard : PAL
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Interlaced
Scan order : Top Field First
Compression mode : Lossy
Bits/(Pixel*Frame) : 0.675
Time code of first frame : 10:29:28:03
Time code source : Group of pictures header
GOP, Open/Closed : Open
GOP, Open/Closed of first frame : Closed
Stream size : 247 MiB (95%)
Audio
ID : 192 (0xC0)
Format : MPEG Audio
Format version : Version 1
Format profile : Layer 2
Duration : 4mn 58s
Bit rate mode : Constant
Bit rate : 192 Kbps
Channel(s) : 2 channels
Sampling rate : 48.0 KHz
Compression mode : Lossy
Stream size : 6.84 MiB (3%)
## report transcode to ffv1/matroska #######
ffmpeg started on 2015-11-02 at 13:37:31
Report written to "ffmpeg-20151102-133731.log"
Command line:
ffmpeg -i file2.mpg -c:v ffv1 -level 3 -g 1 -coder 1 -context 1 -slices
16 -slicecrc 1 -copyts -c:a pcm_s24le file2ffv1.mkv -report
ffmpeg version N-75275-gd13a2df Copyright (c) 2000-2015 the FFmpeg
developers
built with gcc 4.9.3 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r
--enable-gnutls --enable-iconv --enable-libass --enable-libbluray
--enable-libbs2b --enable-libcaca --enable-libdcadec
--enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc
--enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus
--enable-librtmp --enable-libschroedinger --enable-libsoxr
--enable-libspeex --enable-libtheora --enable-libtwolame
--enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc
--enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp
--enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid
--enable-lzma --enable-decklink --enable-zlib
libavutil 55. 2.100 / 55. 2.100
libavcodec 57. 1.100 / 57. 1.100
libavformat 57. 0.100 / 57. 0.100
libavdevice 57. 0.100 / 57. 0.100
libavfilter 6. 3.100 / 6. 3.100
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.100 / 2. 0.100
libpostproc 54. 0.100 / 54. 0.100
Splitting the commandline.
Reading option '-i' ... matched as input file with argument '14781.mpg'.
Reading option '-c:v' ... matched as option 'c' (codec name) with
argument 'ffv1'.
Reading option '-level' ... matched as AVOption 'level' with argument
'3'.
Reading option '-g' ... matched as AVOption 'g' with argument '1'.
Reading option '-coder' ... matched as AVOption 'coder' with argument
'1'.
Reading option '-context' ... matched as AVOption 'context' with
argument '1'.
Reading option '-slices' ... matched as AVOption 'slices' with argument
'16'.
Reading option '-slicecrc' ... matched as AVOption 'slicecrc' with
argument '1'.
Reading option '-copyts' ... matched as option 'copyts' (copy
timestamps) with argument '1'.
Reading option '-c:a' ... matched as option 'c' (codec name) with
argument 'pcm_s24le'.
Reading option 'file2ffv1.mkv' ... matched as output file.
Reading option '-report' ... matched as option 'report' (generate a
report) with argument '1'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option copyts (copy timestamps) with argument 1.
Applying option report (generate a report) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input file 14781.mpg.
Successfully parsed a group of options.
Opening an input file: 14781.mpg.
[mpeg @ 0308cbe0] Format mpeg probed with size=2048 and score=26
[mpeg @ 0308cbe0] Before avformat_find_stream_info() pos: 0 bytes
read:32768 seeks:0
[mpeg @ 0308cbe0] max_analyze_duration 5000000 reached at 5000000
microseconds st:0
[mpeg @ 0308cbe0] After avformat_find_stream_info() pos: 0 bytes
read:4935824 seeks:2 frames:337
Input #0, mpeg, from '14781.mpg':
Duration: 00:04:58.88, start: 0.220000, bitrate: 7274 kb/s
Stream #0:0[0x1e0], 127, 1/90000: Video: mpeg2video (Main),
yuv420p(tv), 720x576 [SAR 16:15 DAR 4:3], 7000 kb/s, 25 fps, 25 tbr, 90k
tbn, 50 tbc
Stream #0:1[0x1c0], 210, 1/90000: Audio: mp2, 48000 Hz, stereo,
s16p, 192 kb/s
Successfully opened the file.
Parsing a group of options: output file file2ffv1.mkv.
Applying option c:v (codec name) with argument ffv1.
Applying option c:a (codec name) with argument pcm_s24le.
Successfully parsed a group of options.
Opening an output file: file2ffv1.mkv.
Successfully opened the file.
detected 4 logical cores
[graph 0 input from stream 0:0 @ 0309e600] Setting 'video_size' to value
'720x576'
[graph 0 input from stream 0:0 @ 0309e600] Setting 'pix_fmt' to value
'0'
[graph 0 input from stream 0:0 @ 0309e600] Setting 'time_base' to value
'1/90000'
[graph 0 input from stream 0:0 @ 0309e600] Setting 'pixel_aspect' to
value '16/15'
[graph 0 input from stream 0:0 @ 0309e600] Setting 'sws_param' to value
'flags=2'
[graph 0 input from stream 0:0 @ 0309e600] Setting 'frame_rate' to value
'25/1'
[graph 0 input from stream 0:0 @ 0309e600] w:720 h:576 pixfmt:yuv420p
tb:1/90000 fr:25/1 sar:16/15 sws_param:flags=2
[format @ 054753a0] compat: called with
args=[yuv420p|yuva420p|yuva422p|yuv444p|yuva444p|yuv440p|yuv422p|yuv411p
|yuv410p|bgr0|bgra|yuv420p16le|yuv422p16le|yuv444p16le|yuv444p9le|yuv422
p9le|yuv420p9le|yuv420p10le|yuv422p10le|yuv444p10le|yuva444p16le|yuva422
p16le|yuva420p16le|yuva444p10le|yuva422p10le|yuva420p10le|yuva444p9le|yu
va422p9le|yuva420p9le|gray16le|gray|gbrp9le|gbrp10le|gbrp12le|gbrp14le]
[format @ 054753a0] Setting 'pix_fmts' to value
'yuv420p|yuva420p|yuva422p|yuv444p|yuva444p|yuv440p|yuv422p|yuv411p|yuv4
10p|bgr0|bgra|yuv420p16le|yuv422p16le|yuv444p16le|yuv444p9le|yuv422p9le|
yuv420p9le|yuv420p10le|yuv422p10le|yuv444p10le|yuva444p16le|yuva422p16le
|yuva420p16le|yuva444p10le|yuva422p10le|yuva420p10le|yuva444p9le|yuva422
p9le|yuva420p9le|gray16le|gray|gbrp9le|gbrp10le|gbrp12le|gbrp14le'
[AVFilterGraph @ 0307e1c0] query_formats: 4 queried, 3 merged, 0 already
done, 0 delayed
[graph 1 input from stream 0:1 @ 0554b3c0] Setting 'time_base' to value
'1/48000'
[graph 1 input from stream 0:1 @ 0554b3c0] Setting 'sample_rate' to
value '48000'
[graph 1 input from stream 0:1 @ 0554b3c0] Setting 'sample_fmt' to value
's16p'
[graph 1 input from stream 0:1 @ 0554b3c0] Setting 'channel_layout' to
value '0x3'
[graph 1 input from stream 0:1 @ 0554b3c0] tb:1/48000 samplefmt:s16p
samplerate:48000 chlayout:0x3
[audio format for output stream 0:1 @ 0554b520] Setting 'sample_fmts' to
value 's32'
[auto-inserted resampler 0 @ 0554b5a0] Setting 'output_sample_bits' to
value '24'
[audio format for output stream 0:1 @ 0554b520] auto-inserting filter
'auto-inserted resampler 0' between the filter 'Parsed_anull_0' and the
filter 'audio format for output stream 0:1'
[AVFilterGraph @ 0309e920] query_formats: 4 queried, 6 merged, 3 already
done, 0 delayed
[auto-inserted resampler 0 @ 0554b5a0] [SWR @ 030a0780] Using s16p
internally between filters
[auto-inserted resampler 0 @ 0554b5a0] ch:2 chl:stereo fmt:s16p
r:48000Hz -> ch:2 chl:stereo fmt:s32 r:48000Hz
Output #0, matroska, to 'file2ffv1.mkv':
Metadata:
encoder : Lavf57.0.100
Stream #0:0, 0, 1/1000: Video: ffv1 (FFV1 / 0x31564646), yuv420p,
720x576 [SAR 16:15 DAR 4:3], q=2-31, 200 kb/s, 25 fps, 1k tbn, 25 tbc
Metadata:
encoder : Lavc57.1.100 ffv1
Stream #0:1, 0, 1/1000: Audio: pcm_s24le ([1][0][0][0] / 0x0001),
48000 Hz, stereo, s32, 2304 kb/s
Metadata:
encoder : Lavc57.1.100 pcm_s24le
Stream mapping:
Stream #0:0 -> #0:0 (mpeg2video (native) -> ffv1 (native))
Stream #0:1 -> #0:1 (mp2 (native) -> pcm_s24le (native))
Press [q] to stop, [?] for help
[matroska @ 030ba640] Writing block at offset 1111, size 6912, pts 220,
dts 220, duration 24, keyframe 1
##short version############
[matroska @ 030ba640] Writing block at offset 1809665686, size 6654, pts
299080, dts 299080, duration 40, keyframe 1
[output stream 0:0 @ 0309e760] EOF on sink link output stream
0:0:default.
[output stream 0:1 @ 0554b440] EOF on sink link output stream
0:1:default.
No more output streams to write to, finishing.
[matroska @ 030ba640] Writing block at offset 1809672347, size 6912, pts
299092, dts 299092, duration 24, keyframe 1
[matroska @ 030ba640] end duration = 299120
[matroska @ 030ba640] stream 0 end duration = 299120
[matroska @ 030ba640] stream 1 end duration = 299116
frame= 7472 fps= 98 q=-0.0 Lsize= 1767424kB time=00:04:59.12
bitrate=48404.4kbits/s
video:1682933kB audio:84064kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 0.024102%
Input file #0 (14781.mpg):
Input stream #0:0 (video): 7472 packets read (261476996 bytes); 7472
frames decoded;
Input stream #0:1 (audio): 12454 packets read (7173504 bytes); 12454
frames decoded (14347008 samples);
Total: 19926 packets (268650500 bytes) demuxed
Output file #0 (file2ffv1.mkv):
Output stream #0:0 (video): 7472 frames encoded; 7472 packets muxed
(1723323803 bytes);
Output stream #0:1 (audio): 12454 frames encoded (14347008 samples);
12454 packets muxed (86082048 bytes);
Total: 19926 packets (1809405851 bytes) muxed
19926 frames successfully decoded, 0 decoding errors
[AVIOContext @ 055195a0] Statistics: 44852 seeks, 92812 writeouts
[AVIOContext @ 03080de0] Statistics: 276711572 bytes read, 2 seeks
More information about the ffmpeg-user
mailing list