[FFmpeg-user] When cutting part of video I get a silence part before it

Cecil Westerhof Cecil at decebal.nl
Sat Aug 15 14:33:59 EEST 2020


Cecil Westerhof <Cecil at decebal.nl> writes:

Some logging of the problem.

When I use:
    ffmpeg -y -ss 61 -i zoom_4.mp4 -to 469 -acodec copy -vcodec copy -async 1 4_compressed.mp4

The video starts with 26 seconds (of negative time stamped) silent
video.

The log:
    ffmpeg version 4.1.6-1~deb10u1 Copyright (c) 2000-2020 the FFmpeg developers
      built with gcc 8 (Debian 8.3.0-6)
      configuration: --prefix=/usr --extra-version='1~deb10u1' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
      libavutil      56. 22.100 / 56. 22.100
      libavcodec     58. 35.100 / 58. 35.100
      libavformat    58. 20.100 / 58. 20.100
      libavdevice    58.  5.100 / 58.  5.100
      libavfilter     7. 40.101 /  7. 40.101
      libavresample   4.  0.  0 /  4.  0.  0
      libswscale      5.  3.100 /  5.  3.100
      libswresample   3.  3.100 /  3.  3.100
      libpostproc    55.  3.100 / 55.  3.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'zoom_4.mp4':
      Metadata:
        major_brand     : mp42
        minor_version   : 0
        compatible_brands: isommp42
        creation_time   : 2020-07-31T20:26:28.000000Z
      Duration: 00:08:54.24, start: 0.000000, bitrate: 480 kb/s
        Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 32000 Hz, mono, fltp, 49 kb/s (default)
        Metadata:
          creation_time   : 2020-07-31T20:26:28.000000Z
          handler_name    : AAC audio
        Stream #0:1(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x360, 429 kb/s, 25 fps, 25 tbr, 30k tbn, 60k tbc (default)
        Metadata:
          creation_time   : 2020-07-31T20:26:28.000000Z
          handler_name    : H.264/AVC video
          encoder         : AVC Coding
    Output #0, mp4, to '4_compressed.mp4':
      Metadata:
        major_brand     : mp42
        minor_version   : 0
        compatible_brands: isommp42
        encoder         : Lavf58.20.100
        Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x360, q=2-31, 429 kb/s, 25 fps, 25 tbr, 30k tbn, 30k tbc (default)
        Metadata:
          creation_time   : 2020-07-31T20:26:28.000000Z
          handler_name    : H.264/AVC video
          encoder         : AVC Coding
        Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 32000 Hz, mono, fltp, 49 kb/s (default)
        Metadata:
          creation_time   : 2020-07-31T20:26:28.000000Z
          handler_name    : AAC audio
    Stream mapping:
      Stream #0:1 -> #0:0 (copy)
      Stream #0:0 -> #0:1 (copy)
    Press [q] to stop, [?] for help
    frame=12391 fps=0.0 q=-1.0 Lsize=   29113kB time=00:07:48.98 bitrate= 508.5kbits/s speed=1.89e+03x    
    video:25861kB audio:2973kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.970170%

What could be the problem?


> In the past I had sometimes the following strange problem. When
> cutting a part out of a video with:
>     ffmpeg -y                                    \
>            -ss "${startSeconds}"                 \
>            -i  "${INPUT_FILE}"                   \
>            -to "$((stopSeconds - startSeconds))" \
>            -acodec copy                          \
>            -vcodec copy                          \
>            -async 1                              \
>            "${OUTPUT_FILE}"
>
> sometimes before the selected video was put something extra that was
> silent and had a negative time index.
>
> At a certain point I found out that it had to do when compressing the
> file with:
>       ffmpeg -y              \
>         -i "${_inputfile}"   \
>         -vcodec libx264      \
>         -crf 23              \
>         -acodec libmp3lame   \
>         -preset veryfast     \
>         "${_outputfile}"
>
> The reason that I did this was that the original file was between four
> to thirteen times bigger, without me seeing a quality loss.
> Most of the times I did not have this problem, but sometimes I did.
> When first cutting the video and then compressing it I did not have
> this problem.
>
> Sadly the problem emerged again. :'-(
> I have to publish recordings of a Zoom meeting. They are very small
> (not even 10 MB pro minute) and I got the same problem. I have to
> generate some logging (I use ffmpeg through bash and tcl scripts), but
> was wondering if somebody knows what could generate this kind of
> problems and what to do about it.
> I will later on share some logging.

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


More information about the ffmpeg-user mailing list