[FFmpeg-user] Retrieve duration of an m2v >MPEG>2 elementary stream file

Robert Krüger robert.m.krueger.de at gmail.com
Thu Mar 2 12:54:44 EET 2023


On Wed, Mar 1, 2023 at 4:07 PM Ferdi Scholten <ferdi at sttc-nlp.nl> wrote:

> Hi,
> > if I invoke ffmpeg on an M2V MPEG-2 elementary stream, I get "N/A" for
> the
> > duration. I guess this is because this file doesn't contain a header that
> > contains the duration. Is it possible to force ffmpeg to parse the entire
> > file to obtain the duration?
> >
> > Full command line and output:
> >
> > ffmpeg -i
> >
> /Users/krueger/lesspain/samples/software/compressor/compressor_dvd_mpeg2_480_24p.m2v
> >
> > ffmpeg version N-109938-g67fd1b79e7 Copyright (c) 2000-2023 the FFmpeg
> > developers
> >    built with Apple clang version 11.0.0 (clang-1100.0.33.17)
> >    configuration:
> >    libavutil      58.  3.100 / 58.  3.100
> >    libavcodec     60.  5.100 / 60.  5.100
> >    libavformat    60.  4.100 / 60.  4.100
> >    libavdevice    60.  2.100 / 60.  2.100
> >    libavfilter     9.  4.100 /  9.  4.100
> >    libswscale      7.  2.100 /  7.  2.100
> >    libswresample   4. 11.100 /  4. 11.100
> > Input #0, mpegvideo, from
> >
> '/Users/krueger/lesspain/samples/software/compressor/compressor_dvd_mpeg2_480_24p.m2v':
> >    Duration: N/A, bitrate: N/A
> >    Stream #0:0: Video: mpeg2video (Main), yuv420p(tv, smpte170m,
> > progressive), 720x480 [SAR 32:27 DAR 16:9], 30 fps, 59.94 tbr, 1200k tbn
> >      Side data:
> >        cpb: bitrate max/min/avg: 7700000/0/0 buffer size: 1835008
> vbv_delay:
> > N/A
> > At least one output file must be specified
> >
> > Thanks,
> > Robert
> >
> You can use  -analyzeduration 10000000M -probesize 10000000M for example
> to scan more of the input file. like this:
>
> ffmpeg -i -analyzeduration 10000000M -probesize 10000000M
> /Users/krueger/lesspain/samples/software/compressor/compressor_dvd_mpeg2_480_24p.m2v
>
>
Thanks. I tried that and used values that were way beyond the actual file
duration and size and that didn't change the result, i.e. I still get "N/A"
for the duration. It looks a bit as if getting exact duration by iterating
through the packets isn't supported at all. Can someone confirm this?

Thanks,
Robert


More information about the ffmpeg-user mailing list