Opened 7 years ago

Last modified 3 years ago

#6725 new defect

wrong timecode for dpx

Reported by: shekh Owned by:
Priority: normal Component: avcodec
Version: git-master Keywords: dpx
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

In the case when framerate is embedded in dpx the timestamps are still calculated from default framerate "25".
Example test.01.dpx
r_frame_rate=15/1
time_base=1/25
One of these is wrong.

How to reproduce:

ffprobe.exe  -i "test.01.dpx" -show_streams
ffprobe version N-87353-g183fd30 Copyright (c) 2007-2017 the FFmpeg developers
  built with gcc 7.2.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib
  libavutil      55. 76.100 / 55. 76.100
  libavcodec     57.106.101 / 57.106.101
  libavformat    57. 82.101 / 57. 82.101
  libavdevice    57.  8.101 / 57.  8.101
  libavfilter     6.105.100 /  6.105.100
  libswscale      4.  7.103 /  4.  7.103
  libswresample   2.  8.100 /  2.  8.100
  libpostproc    54.  6.100 / 54.  6.100
[dpx_pipe @ 000000000045a8e0] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, dpx_pipe, from 'test.01.dpx':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: dpx, gbrp10le, 2048x1556, 15 tbr, 25 tbn, 15 tbc
[STREAM]
index=0
codec_name=dpx
codec_long_name=DPX (Digital Picture Exchange) image
profile=unknown
codec_type=video
codec_time_base=0/1
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
width=2048
height=1556
coded_width=2048
coded_height=1556
has_b_frames=0
sample_aspect_ratio=0:1
display_aspect_ratio=0:1
pix_fmt=gbrp10le
level=-99
color_range=unknown
color_space=unknown
color_transfer=unknown
color_primaries=unknown
chroma_location=unspecified
field_order=unknown
timecode=N/A
refs=1
id=N/A
r_frame_rate=15/1
avg_frame_rate=0/0
time_base=1/25
start_pts=N/A
start_time=N/A
duration_ts=N/A
duration=N/A
bit_rate=N/A
max_bit_rate=N/A
bits_per_raw_sample=10
nb_frames=N/A
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
DISPOSITION:timed_thumbnails=0
[/STREAM]

Change History (6)

in reply to:  description ; comment:2 by Carl Eugen Hoyos, 7 years ago

Component: undeterminedavcodec
Keywords: dpx added
Version: unspecifiedgit-master

Replying to shekh:

In the case when framerate is embedded in dpx the timestamps are still calculated from default framerate "25".

How can I reproduce this?
time_base is not supposed to have an effect on decoding.

in reply to:  2 comment:3 by shekh, 7 years ago

Replying to cehoyos:

How can I reproduce this?

Reproduce what, dpx with framerate? IDK, maybe FFMPEG can do this. Found #3511

time_base is not supposed to have an effect on decoding.

My understanding (maybe incomplete):
Image2 demuxer assumes default framerate "25" and derives time_base 1/25 from it.
Then it assigns sequentially increasing pts/dts to packets and frames, as well as packet/frame duration to 1/25, as well as stream duration to number of pictures (which makes sense assuming time_base).
Therefore, if I derive framerate from timestamps and timebase, I get 25. But r_framerate says 15.

Maybe more informative command:

ffprobe.exe -i "test.%%02d.dpx" -start_number 1 -show_frames

Notice pkt_duration_time=0.040000 (0.04 is 1/25)

[FRAME]
media_type=video
stream_index=0
key_frame=1
pkt_pts=0
pkt_pts_time=0.000000
pkt_dts=0
pkt_dts_time=0.000000
best_effort_timestamp=0
best_effort_timestamp_time=0.000000
pkt_duration=1
pkt_duration_time=0.040000
pkt_pos=N/A
pkt_size=12748800
width=2048
height=1556
pix_fmt=gbrp10le
sample_aspect_ratio=N/A
pict_type=?
coded_picture_number=0
display_picture_number=0
interlaced_frame=0
top_field_first=0
repeat_pict=0
[/FRAME]
[FRAME]
media_type=video
stream_index=0
key_frame=1
pkt_pts=1
pkt_pts_time=0.040000
pkt_dts=1
pkt_dts_time=0.040000
best_effort_timestamp=1
best_effort_timestamp_time=0.040000
pkt_duration=1
pkt_duration_time=0.040000
pkt_pos=N/A
pkt_size=12748800
width=2048
height=1556
pix_fmt=gbrp10le
sample_aspect_ratio=N/A
pict_type=?
coded_picture_number=0
display_picture_number=0
interlaced_frame=0
top_field_first=0
repeat_pict=0
[/FRAME]
[FRAME]
media_type=video
stream_index=0
key_frame=1
pkt_pts=2
pkt_pts_time=0.080000
pkt_dts=2
pkt_dts_time=0.080000
best_effort_timestamp=2
best_effort_timestamp_time=0.080000
pkt_duration=1
pkt_duration_time=0.040000
pkt_pos=N/A
pkt_size=12748800
width=2048
height=1556
pix_fmt=gbrp10le
sample_aspect_ratio=N/A
pict_type=?
coded_picture_number=0
display_picture_number=0
interlaced_frame=0
top_field_first=0
repeat_pict=0
[/FRAME]
[FRAME]
media_type=video
stream_index=0
key_frame=1
pkt_pts=3
pkt_pts_time=0.120000
pkt_dts=3
pkt_dts_time=0.120000
best_effort_timestamp=3
best_effort_timestamp_time=0.120000
pkt_duration=1
pkt_duration_time=0.040000
pkt_pos=N/A
pkt_size=12748800
width=2048
height=1556
pix_fmt=gbrp10le
sample_aspect_ratio=N/A
pict_type=?
coded_picture_number=0
display_picture_number=0
interlaced_frame=0
top_field_first=0
repeat_pict=0
[/FRAME]

comment:4 by Elon Musk, 5 years ago

This can not be fixed because image2 demuxer code in another library.

comment:5 by Balling, 3 years ago

There is also this 6623421454c55890a720b8dd818bb9304e9ff529 and SMPTE timecode patch a041c0a0315f0941ddc2b3258c74edf40f86c8f5 (yes, there are some, that look invalid, as you can see by using ffprobe -i "test.%02d.dpx" -start_number 1 -show_frames). Besides all other fixes recently.
They did not affect this issue. What is nuts, is those are transfer linear! mpv does use linear for those, while ffplay does not. Hilarious. Linear stuff was added in 0539f15bbb86c5e81af56454c94e2eddefd34b7c.

Last edited 3 years ago by Balling (previous) (diff)

comment:6 by Balling, 3 years ago

More interesting samples are here. https://www.dropbox.com/s/a84t4bvlf2wmv9f/dpx_test.zip?dl=1'

With very nice r_frame_rate=2997/125

LOL, what? Should not it be 24/1.001???

Last edited 3 years ago by Balling (previous) (diff)
Note: See TracTickets for help on using tickets.