[FFmpeg-user] ffmpeg create wrong time information

Cecil Westerhof Cecil at decebal.nl
Tue Dec 21 20:37:43 EET 2021


Cecil Westerhof via ffmpeg-user <ffmpeg-user at ffmpeg.org> writes:

After some experiments I solved it by putting -ss and -to behind -i
and not forgetting to alter the between values.
But this takes about a third more time.
Is there be a better solution?

I am now using:
    ffmpeg -y                                         \
        -i input.mp4                                  \
        -ss 00:26:05                                  \
        -to 00:44:04                                  \
        -vf "
             drawbox=enable='between(t, 1565, 1566.6)':
                color     = black                     :
                w         = in_w                      :
                h         = in_h                      :
                thickness = fill
        "                                             \
        -acodec copy                                  \
        -vcodec libx264                               \
        -crf 23                                       \
        -preset veryfast                              \
        output.mkv

> I have the recording of a zoom meeting where I need to cut out a
> portion from and the first little bit has to be blacked out.
>
> I use the following command:
>     ffmpeg -y                                    \
>         -ss 00:26:05                             \
>         -to 00:44:04                             \
>         -i input.mp4                             \
>         -vf "
>              drawbox=enable='between(t, 0, 1.6)' :
>                 color     = black                :
>                 w         = in_w                 :
>                 h         = in_h                 :
>                 thickness = fill
>         "                                        \
>         -acodec copy                             \
>         -vcodec libx264                          \
>         -crf 23                                  \
>         -preset veryfast                         \
>         output.mkv
>
> This creates a seemingly correct file, with one little problem: the
> time starts at 00:00:27 and ends at 00:18:26. (As displayed by the
> player mpv.)
>
> When I play it with vlc I find out that the 27 seconds of audio are
> before the video. Mpv starts with the video, but vlc starts with the
> audio.
> What could be the problem?
>
>
> I am using ffmpeg version 4.3.3-0+deb11u.
>
>
> The metadata of the input file:
> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'GMT20211216-184321_Recording_640x360.mp4':
>   Metadata:
>     major_brand     : mp42
>     minor_version   : 0
>     compatible_brands: isommp42
>     creation_time   : 2021-12-16T18:43:21.000000Z
>   Duration: 01:21:57.47, start: 0.000000, bitrate: 646 kb/s
>     Chapter #0:0: start 0.000000, end 4917.440000
>     Metadata:
>       title           : Recording Started
>     Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 32000 Hz, mono, fltp, 126 kb/s (default)
>     Metadata:
>       creation_time   : 2021-12-16T18:43:21.000000Z
>       handler_name    : AAC audio
>     Stream #0:1(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x360, 518 kb/s, 25 fps, 25 tbr, 30k tbn, 60k tbc (default)
>     Metadata:
>       creation_time   : 2021-12-16T18:43:21.000000Z
>       handler_name    : H.264/AVC video
>       encoder         : AVC Coding
>     Stream #0:2(und): Data: bin_data (text / 0x74786574)
>     Metadata:
>       creation_time   : 2021-12-16T18:43:21.000000Z
>       handler_name    : Text
>
> The metadata of the output file:
> Input #0, matroska,webm, from 'howToReachYourNewYearsResolutionsIn2022.mkv':
>   Metadata:
>     COMPATIBLE_BRANDS: isommp42
>     MAJOR_BRAND     : mp42
>     MINOR_VERSION   : 0
>     ENCODER         : Lavf58.45.100
>   Duration: 00:18:26.34, start: 0.000000, bitrate: 346 kb/s
>     Chapter #0:0: start 0.000000, end 3352.440000
>     Metadata:
>       title           : Recording Started
>     Stream #0:0: Video: h264, none, 640x360, 25 fps, 25 tbr, 1k tbn, 2k tbc (default)
>     Metadata:
>       HANDLER_NAME    : H.264/AVC video
>       ENCODER         : Lavc58.91.100 libx264
>       DURATION        : 00:18:26.336000000
>     Stream #0:1: Audio: aac (LC), 32000 Hz, mono, fltp (default)
>     Metadata:
>       HANDLER_NAME    : AAC audio
>       DURATION        : 00:18:26.336000000
>
>
> By the way when I create a mp4 file (which is not really an option,
> because I need to create chapters), the video seems to be correct,
> with one strange thing: both mpv and vlc think it is 00:55:52 long.
> Which it is not: it stops where it should 00:17:59.

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof


More information about the ffmpeg-user mailing list