Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#2642 closed defect (invalid)

ffprobe unable to report video stream duration if stream is in matroska container.

Reported by: MountainMan Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: duration mkv
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: yes

Description

Summary of the bug: ffprobe reports "N/A" as the value for "duration_ts" and "duration" for the video stream if the stream is in a mkv container (it does report the duration of the file as a whole though). If the same video is copied to an avi container the video stream duration values are reported as expected. I've tried this with mkv files I created with ffmpeg from images as well as from a video from my camera recoded to mkv. I've tried this with multiple video codecs (ffv1 and the codec in the reproduction section) and for files with and without an audio stream.

I'm running ffprobe on Ubuntu 12.04. I'm not sure what the version number is, but I'm using today's build based on the instructions here: https://ffmpeg.org/trac/ffmpeg/wiki/UbuntuCompilationGuideQuantal

Here is what the output looks like:

ffprobe -pretty -show_streams -select_streams v testvideo.mkv
ffprobe version N-38182-g449558d Copyright (c) 2007-2013 the FFmpeg developers

built on Jun 4 2013 18:35:01 with gcc 4.6 (Ubuntu/Linaro? 4.6.3-1ubuntu5)
configuration: --extra-libs=-ldl --enable-gpl --enable-libass --enable-libfdk-aac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libopus --enable-libvpx --enable-x11grab --enable-libx264 --enable-nonfree --enable-version3
libavutil 52. 34.100 / 52. 34.100
libavcodec 55. 15.100 / 55. 15.100
libavformat 55. 8.102 / 55. 8.102
libavdevice 55. 2.100 / 55. 2.100
libavfilter 3. 75.101 / 3. 75.101
libswscale 2. 3.100 / 2. 3.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 3.100 / 52. 3.100

Input #0, matroska,webm, from 'testvideo.mkv':

Metadata:

ENCODER : Lavf55.8.102

Duration: 00:00:05.01, start: 0.000000, bitrate: 265 kb/s

Stream #0:0: Video: h264 (High 4:4:4 Predictive), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 29.97 fps, 29.97 tbr, 1k tbn, 59.94 tbc (default)

[STREAM]
index=0
codec_name=h264
codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
profile=High 4:4:4 Predictive
codec_type=video
codec_time_base=50/2997
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
width=640
height=480
has_b_frames=0
sample_aspect_ratio=1:1
display_aspect_ratio=4:3
pix_fmt=yuv420p
level=30
timecode=N/A
id=N/A
r_frame_rate=2997/100
avg_frame_rate=2997/100
time_base=1/1000
start_pts=0
start_time=0:00:00.000000
duration_ts=N/A
duration=N/A
bit_rate=N/A
nb_frames=N/A
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
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
STREAM

How to reproduce:

ffprobe -pretty -show_streams -select_streams v testvideo.mkv

Here is what I did to create the test video, but as I mentioned this acts the same with other videos transcoded into mkv, so you can probably duplicate it with any mkv file:

convert -size 640x480 xc:black  blackimage.png  #Using imagemagick to create a black image.
ffmpeg  -loop 1 -f image2 -i blackimage.png -r 29.97 -t 5 -an -vcodec libx264 -preset ultrafast -qp 0 -pix_fmt yuv420p testvideo.mkv




ffmpeg version
built on June 4th 2013

Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.

Change History (3)

comment:1 Changed 5 years ago by MountainMan

I just noticed "nb_frames=N/A" in the output as well. When I probe the same stream in an avi container it reports "nb_frames=150".

comment:2 Changed 5 years ago by saste

  • Analyzed by developer set
  • Component changed from FFprobe to avformat
  • Keywords duration matroska ffprobe added
  • Reproduced by developer set
  • Resolution set to invalid
  • Status changed from new to closed

The matroska container does not contain such information in the header, so the only way to get stream duration is to use the format-level information (format=duration) or compute it from the packet timestamps (but this needs demuxing).

I'm closing the ticket since this is a limitation inherent to the format itself, feel free to reopen if you can refute my claim.

comment:3 Changed 5 years ago by cehoyos

  • Keywords mkv added; matroska ffprobe removed
Note: See TracTickets for help on using tickets.