[FFmpeg-user] Matroska has different starting DTS/PTS after stream copy from mov after rescale
Kieran O Leary
kieran.o.leary at gmail.com
Wed Jul 13 11:56:04 EEST 2016
This is the only scenario that I've ever seen a different starting
DTS/PTS (seen in framemd5) after doing a stream copy from quicktime to
matroska.
I don't know enough about DTS and PTS to know how serious this. I
never encounter it usually, but it would be preferable to retain these
values when stream copying.
1. Rescale 2048*1536 v210.mov to 4096*3072 (Source PTS/DTS and
rescaled PTS/DTS start at 0)
2. Stream copy to matroska (PTS/DTS start at 1)
I tried re-creating by rescaling a 320*240 testsrc mov to 640*480 mov,
then stream copying to matroska, but the PTS/DTS were identical. I
apologise for the large test files, but I can't reproduce otherwise.
Example input and output here along with framemd5s:
1 frame of input https://drive.google.com/open?id=0ByvCvU9YVB09ZDRmRGdSemZWaXc
1 frame of mkv output
https://drive.google.com/open?id=0ByvCvU9YVB09OHpWZl9zX2pnNTg
input framemd5 https://drive.google.com/open?id=0ByvCvU9YVB09eDh3NnZNdEdETWs
output framemd5 https://drive.google.com/open?id=0ByvCvU9YVB09MGU0YTdBZ1B5X0k
Here's the input framemd5:
#format: frame checksums
#version: 2
#hash: MD5
#software: Lavf57.38.102
#tb 0: 1/24
#media_type 0: video
#codec_id 0: rawvideo
#dimensions 0: 4096x3072
#sar 0: 0/1
#stream#, dts, pts, duration, size, hash
0, 0, 0, 1, 50331648, ff246e50f79911593a9b39649233c64e
and output mkv framemd5
#format: frame checksums
#version: 2
#hash: MD5
#software: Lavf57.38.102
#tb 0: 1/24
#media_type 0: video
#codec_id 0: rawvideo
#dimensions 0: 4096x3072
#sar 0: 1/1
#stream#, dts, pts, duration, size, hash
0, 1, 1, 1, 50331648, ff246e50f79911593a9b39649233c64e
Console outputs of
1. Rescale to 4k
2. Framemd5 of mov
3. stream copy to matroska
4. framemd5 of mkv
**********************
1. Rescale to 4k (only chose one frame, the exact same thing happens
if I don't trim and encode the whole file):
ffmpeg -i /Volumes/Stardom/kieran_tests/guinness_no_other_beer_comes_near_raw.mov
-c:v v210 -t 00:00:00.01 -vf scale=4096:3072
/Volumes/Stardom/kieran_tests/bug/4k.mov
ffmpeg version git-2016-06-21-9204a84 Copyright (c) 2000-2016 the
FFmpeg developers
built with Apple LLVM version 7.3.0 (clang-703.0.31)
configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD
--enable-shared --enable-pthreads --enable-gpl --enable-version3
--enable-hardcoded-tables --enable-avresample --cc=clang
--host-cflags= --host-ldflags= --enable-opencl --enable-libx264
--enable-libmp3lame --enable-libxvid --enable-libfreetype
--enable-ffplay --disable-lzma --enable-libopenjpeg
--disable-decoder=jpeg2000
--extra-cflags=-I/usr/local/Cellar/openjpeg/1.5.2_1/include/openjpeg-1.5
--enable-vda
libavutil 55. 24.100 / 55. 24.100
libavcodec 57. 46.100 / 57. 46.100
libavformat 57. 38.102 / 57. 38.102
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 46.102 / 6. 46.102
libavresample 3. 0. 0 / 3. 0. 0
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 1.100 / 2. 1.100
libpostproc 54. 0.100 / 54. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
'/Volumes/Stardom/kieran_tests/guinness_no_other_beer_comes_near_raw.mov':
Metadata:
major_brand : qt
minor_version : 537199360
compatible_brands: qt
creation_time : 2016-07-05 13:59:49
timecode : 01:00:53:12
Duration: 00:01:17.71, start: 0.000000, bitrate: 1624356 kb/s
Stream #0:0(eng): Audio: pcm_s24be (in24 / 0x34326E69), 48000 Hz,
mono, s32 (24 bit), 1152 kb/s (default)
Metadata:
creation_time : 2016-07-05 13:59:49
handler_name : Apple Alias Data Handler
Stream #0:1(eng): Video: v210 (v210 / 0x30313276), yuv422p10le,
2048x1536, 1623195 kb/s, 24 fps, 24 tbr, 24k tbn, 24k tbc (default)
Metadata:
creation_time : 2016-07-05 13:59:49
handler_name : Apple Alias Data Handler
encoder : Uncompressed 10-bit 4:2:2
Stream #0:2(eng): Data: none (tmcd / 0x64636D74) (default)
Metadata:
creation_time : 2016-07-05 14:01:48
handler_name : Apple Alias Data Handler
timecode : 01:00:53:12
File '/Volumes/Stardom/kieran_tests/bug/4k.mov' already exists.
Overwrite ? [y/N] y
[mov @ 0x7fad9a040000] Using AVStream.codec to pass codec parameters
to muxers is deprecated, use AVStream.codecpar instead.
Last message repeated 1 times
Output #0, mov, to '/Volumes/Stardom/kieran_tests/bug/4k.mov':
Metadata:
major_brand : qt
minor_version : 537199360
compatible_brands: qt
timecode : 01:00:53:12
encoder : Lavf57.38.102
Stream #0:0(eng): Video: v210 (v210 / 0x30313276), yuv422p10le,
4096x3072, q=2-31, 200 kb/s, 0.04 fps, 12288 tbn, 24 tbc (default)
Metadata:
creation_time : 2016-07-05 13:59:49
handler_name : Apple Alias Data Handler
encoder : Lavc57.46.100 v210
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
mono, fltp (24 bit), 69 kb/s (default)
Metadata:
creation_time : 2016-07-05 13:59:49
handler_name : Apple Alias Data Handler
encoder : Lavc57.46.100 aac
Stream mapping:
Stream #0:1 -> #0:0 (v210 (native) -> v210 (native))
Stream #0:0 -> #0:1 (pcm_s24be (native) -> aac (native))
Press [q] to stop, [?] for help
frame= 1 fps=0.0 q=-0.0 Lsize= 33026kB time=00:00:00.02
bitrate=12682164.2kbits/s speed=0.0909x
video:33024kB audio:0kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 0.005840%
[aac @ 0x7fad9a02b800] Qavg: 47249.418
*********
2. framemd5 of mov:
ffmpeg -i /Volumes/Stardom/kieran_tests/bug/4k.mov -an -f framemd5 -
ffmpeg version git-2016-06-21-9204a84 Copyright (c) 2000-2016 the
FFmpeg developers
built with Apple LLVM version 7.3.0 (clang-703.0.31)
configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD
--enable-shared --enable-pthreads --enable-gpl --enable-version3
--enable-hardcoded-tables --enable-avresample --cc=clang
--host-cflags= --host-ldflags= --enable-opencl --enable-libx264
--enable-libmp3lame --enable-libxvid --enable-libfreetype
--enable-ffplay --disable-lzma --enable-libopenjpeg
--disable-decoder=jpeg2000
--extra-cflags=-I/usr/local/Cellar/openjpeg/1.5.2_1/include/openjpeg-1.5
--enable-vda
libavutil 55. 24.100 / 55. 24.100
libavcodec 57. 46.100 / 57. 46.100
libavformat 57. 38.102 / 57. 38.102
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 46.102 / 6. 46.102
libavresample 3. 0. 0 / 3. 0. 0
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 1.100 / 2. 1.100
libpostproc 54. 0.100 / 54. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
'/Volumes/Stardom/kieran_tests/bug/4k.mov':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
encoder : Lavf57.38.102
Duration: 00:00:00.04, start: 0.000000, bitrate: 6441633 kb/s
Stream #0:0(eng): Video: v210 (v210 / 0x30313276), yuv422p10le,
4096x3072, 6492782 kb/s, 24 fps, 24 tbr, 12288 tbn, 12288 tbc
(default)
Metadata:
handler_name : DataHandler
encoder : Lavc57.46.100 v210
timecode : 01:00:53:12
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
mono, fltp, 6 kb/s (default)
Metadata:
handler_name : DataHandler
Stream #0:2(eng): Data: none (tmcd / 0x64636D74), 0 kb/s
Metadata:
handler_name : DataHandler
timecode : 01:00:53:12
[framemd5 @ 0x7fd77c011e00] Using AVStream.codec to pass codec
parameters to muxers is deprecated, use AVStream.codecpar instead.
#format: frame checksums
#version: 2
#hash: MD5
#software: Lavf57.38.102
#tb 0: 1/24
#media_type 0: video
#codec_id 0: rawvideo
#dimensions 0: 4096x3072
#sar 0: 0/1
#stream#, dts, pts, duration, size, hash
Output #0, framemd5, to 'pipe:':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
encoder : Lavf57.38.102
Stream #0:0(eng): Video: rawvideo (Y3[10][10] / 0xA0A3359),
yuv422p10le, 4096x3072, q=2-31, 200 kb/s, 24 fps, 24 tbn, 24 tbc
(default)
Metadata:
handler_name : DataHandler
timecode : 01:00:53:12
encoder : Lavc57.46.100 rawvideo
Stream mapping:
Stream #0:0 -> #0:0 (v210 (native) -> rawvideo (native))
Press [q] to stop, [?] for help
0, 0, 0, 1, 50331648, ff246e50f79911593a9b39649233c64e
frame= 1 fps=0.0 q=-0.0 Lsize= 0kB time=00:00:00.04 bitrate=
57.0kbits/s speed=0.292x
video:49152kB audio:0kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: unknown
**************
3. Stream copy to matroska:
ffmpeg -i /Volumes/Stardom/kieran_tests/bug/4k.mov -c copy
/Volumes/Stardom/kieran_tests/bug/4k.mkv
ffmpeg version git-2016-06-21-9204a84 Copyright (c) 2000-2016 the
FFmpeg developers
built with Apple LLVM version 7.3.0 (clang-703.0.31)
configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD
--enable-shared --enable-pthreads --enable-gpl --enable-version3
--enable-hardcoded-tables --enable-avresample --cc=clang
--host-cflags= --host-ldflags= --enable-opencl --enable-libx264
--enable-libmp3lame --enable-libxvid --enable-libfreetype
--enable-ffplay --disable-lzma --enable-libopenjpeg
--disable-decoder=jpeg2000
--extra-cflags=-I/usr/local/Cellar/openjpeg/1.5.2_1/include/openjpeg-1.5
--enable-vda
libavutil 55. 24.100 / 55. 24.100
libavcodec 57. 46.100 / 57. 46.100
libavformat 57. 38.102 / 57. 38.102
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 46.102 / 6. 46.102
libavresample 3. 0. 0 / 3. 0. 0
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 1.100 / 2. 1.100
libpostproc 54. 0.100 / 54. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
'/Volumes/Stardom/kieran_tests/bug/4k.mov':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
encoder : Lavf57.38.102
Duration: 00:00:00.04, start: 0.000000, bitrate: 6441633 kb/s
Stream #0:0(eng): Video: v210 (v210 / 0x30313276), yuv422p10le,
4096x3072, 6492782 kb/s, 24 fps, 24 tbr, 12288 tbn, 12288 tbc
(default)
Metadata:
handler_name : DataHandler
encoder : Lavc57.46.100 v210
timecode : 01:00:53:12
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
mono, fltp, 6 kb/s (default)
Metadata:
handler_name : DataHandler
Stream #0:2(eng): Data: none (tmcd / 0x64636D74), 0 kb/s
Metadata:
handler_name : DataHandler
timecode : 01:00:53:12
File '/Volumes/Stardom/kieran_tests/bug/4k.mkv' already exists.
Overwrite ? [y/N] y
[matroska @ 0x7f96d3811e00] Using AVStream.codec to pass codec
parameters to muxers is deprecated, use AVStream.codecpar instead.
Last message repeated 1 times
Output #0, matroska, to '/Volumes/Stardom/kieran_tests/bug/4k.mkv':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
encoder : Lavf57.38.102
Stream #0:0(eng): Video: v210 (v210 / 0x30313276), yuv422p10le,
4096x3072, q=2-31, 6492782 kb/s, 24 fps, 24 tbr, 1k tbn, 12288 tbc
(default)
Metadata:
handler_name : DataHandler
encoder : Lavc57.46.100 v210
timecode : 01:00:53:12
Stream #0:1(eng): Audio: aac (LC) ([255][0][0][0] / 0x00FF), 48000
Hz, mono, 6 kb/s (default)
Metadata:
handler_name : DataHandler
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 1 fps=0.0 q=-1.0 Lsize= 33025kB time=00:00:00.02
bitrate=12297363.3kbits/s speed=0.206x
video:33024kB audio:0kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 0.003327%
4. framemd5 of output mkv:
ffmpeg -i /Volumes/Stardom/kieran_tests/bug/4k.mov -c copy
/Volumes/Stardom/kieran_tests/bug/4k.mkv
ffmpeg version git-2016-06-21-9204a84 Copyright (c) 2000-2016 the
FFmpeg developers
built with Apple LLVM version 7.3.0 (clang-703.0.31)
configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD
--enable-shared --enable-pthreads --enable-gpl --enable-version3
--enable-hardcoded-tables --enable-avresample --cc=clang
--host-cflags= --host-ldflags= --enable-opencl --enable-libx264
--enable-libmp3lame --enable-libxvid --enable-libfreetype
--enable-ffplay --disable-lzma --enable-libopenjpeg
--disable-decoder=jpeg2000
--extra-cflags=-I/usr/local/Cellar/openjpeg/1.5.2_1/include/openjpeg-1.5
--enable-vda
libavutil 55. 24.100 / 55. 24.100
libavcodec 57. 46.100 / 57. 46.100
libavformat 57. 38.102 / 57. 38.102
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 46.102 / 6. 46.102
libavresample 3. 0. 0 / 3. 0. 0
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 1.100 / 2. 1.100
libpostproc 54. 0.100 / 54. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
'/Volumes/Stardom/kieran_tests/bug/4k.mov':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
encoder : Lavf57.38.102
Duration: 00:00:00.04, start: 0.000000, bitrate: 6441633 kb/s
Stream #0:0(eng): Video: v210 (v210 / 0x30313276), yuv422p10le,
4096x3072, 6492782 kb/s, 24 fps, 24 tbr, 12288 tbn, 12288 tbc
(default)
Metadata:
handler_name : DataHandler
encoder : Lavc57.46.100 v210
timecode : 01:00:53:12
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
mono, fltp, 6 kb/s (default)
Metadata:
handler_name : DataHandler
Stream #0:2(eng): Data: none (tmcd / 0x64636D74), 0 kb/s
Metadata:
handler_name : DataHandler
timecode : 01:00:53:12
File '/Volumes/Stardom/kieran_tests/bug/4k.mkv' already exists.
Overwrite ? [y/N] y
[matroska @ 0x7f96d3811e00] Using AVStream.codec to pass codec
parameters to muxers is deprecated, use AVStream.codecpar instead.
Last message repeated 1 times
Output #0, matroska, to '/Volumes/Stardom/kieran_tests/bug/4k.mkv':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
encoder : Lavf57.38.102
Stream #0:0(eng): Video: v210 (v210 / 0x30313276), yuv422p10le,
4096x3072, q=2-31, 6492782 kb/s, 24 fps, 24 tbr, 1k tbn, 12288 tbc
(default)
Metadata:
handler_name : DataHandler
encoder : Lavc57.46.100 v210
timecode : 01:00:53:12
Stream #0:1(eng): Audio: aac (LC) ([255][0][0][0] / 0x00FF), 48000
Hz, mono, 6 kb/s (default)
Metadata:
handler_name : DataHandler
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 1 fps=0.0 q=-1.0 Lsize= 33025kB time=00:00:00.02
bitrate=12297363.3kbits/s speed=0.206x
video:33024kB audio:0kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 0.003327%
ifi-mac-pro:~ admin$ ffmpeg -i
/Volumes/Stardom/kieran_tests/bug/4k.mkv -an -f framemd5 -
ffmpeg version git-2016-06-21-9204a84 Copyright (c) 2000-2016 the
FFmpeg developers
built with Apple LLVM version 7.3.0 (clang-703.0.31)
configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD
--enable-shared --enable-pthreads --enable-gpl --enable-version3
--enable-hardcoded-tables --enable-avresample --cc=clang
--host-cflags= --host-ldflags= --enable-opencl --enable-libx264
--enable-libmp3lame --enable-libxvid --enable-libfreetype
--enable-ffplay --disable-lzma --enable-libopenjpeg
--disable-decoder=jpeg2000
--extra-cflags=-I/usr/local/Cellar/openjpeg/1.5.2_1/include/openjpeg-1.5
--enable-vda
libavutil 55. 24.100 / 55. 24.100
libavcodec 57. 46.100 / 57. 46.100
libavformat 57. 38.102 / 57. 38.102
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 46.102 / 6. 46.102
libavresample 3. 0. 0 / 3. 0. 0
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 1.100 / 2. 1.100
libpostproc 54. 0.100 / 54. 0.100
Input #0, matroska,webm, from '/Volumes/Stardom/kieran_tests/bug/4k.mkv':
Metadata:
COMPATIBLE_BRANDS: qt
MAJOR_BRAND : qt
MINOR_VERSION : 512
ENCODER : Lavf57.38.102
Duration: 00:00:00.06, start: 0.000000, bitrate: 4294317 kb/s
Stream #0:0(eng): Video: v210 (v210 / 0x30313276), yuv422p10le,
4096x3072, SAR 1:1 DAR 4:3, 24 fps, 24 tbr, 1k tbn, 1k tbc (default)
Metadata:
HANDLER_NAME : DataHandler
ENCODER : Lavc57.46.100 v210
TIMECODE : 01:00:53:12
DURATION : 00:00:00.063000000
Stream #0:1(eng): Audio: aac (LC), 48000 Hz, mono, fltp (default)
Metadata:
HANDLER_NAME : DataHandler
DURATION : 00:00:00.052000000
[framemd5 @ 0x7fbd8a011800] Using AVStream.codec to pass codec
parameters to muxers is deprecated, use AVStream.codecpar instead.
#format: frame checksums
#version: 2
#hash: MD5
#software: Lavf57.38.102
#tb 0: 1/24
#media_type 0: video
#codec_id 0: rawvideo
#dimensions 0: 4096x3072
#sar 0: 1/1
#stream#, dts, pts, duration, size, hash
Output #0, framemd5, to 'pipe:':
Metadata:
COMPATIBLE_BRANDS: qt
MAJOR_BRAND : qt
MINOR_VERSION : 512
encoder : Lavf57.38.102
Stream #0:0(eng): Video: rawvideo (Y3[10][10] / 0xA0A3359),
yuv422p10le, 4096x3072 [SAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 24 fps, 24
tbn, 24 tbc (default)
Metadata:
HANDLER_NAME : DataHandler
DURATION : 00:00:00.063000000
TIMECODE : 01:00:53:12
encoder : Lavc57.46.100 rawvideo
Stream mapping:
Stream #0:0 -> #0:0 (v210 (native) -> rawvideo (native))
Press [q] to stop, [?] for help
0, 1, 1, 1, 50331648, ff246e50f79911593a9b39649233c64e
frame= 1 fps=0.0 q=-0.0 Lsize= 0kB time=00:00:00.08 bitrate=
28.5kbits/s speed=0.569x
video:49152kB audio:0kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: unknown
Best,
Kieran.
More information about the ffmpeg-user
mailing list