Marcus
Marcus

Reputation: 855

FFPROBE get start-time of audio only

I am using this to get the start time of the video and audio:

ffprobe -show_entries stream=start_time -i https://www.website.com/video.mp4

And the response I get is:

    ffprobe version 4.3.1 Copyright (c) 2007-2020 the FFmpeg developers
      built with Apple clang version 12.0.0 (clang-1200.0.32.28)
      configuration: --prefix=/usr/local/Cellar/ffmpeg/4.3.1_9 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack
      libavutil      56. 51.100 / 56. 51.100
      libavcodec     58. 91.100 / 58. 91.100
      libavformat    58. 45.100 / 58. 45.100
      libavdevice    58. 10.100 / 58. 10.100
      libavfilter     7. 85.100 /  7. 85.100
      libavresample   4.  0.  0 /  4.  0.  0
      libswscale      5.  7.100 /  5.  7.100
      libswresample   3.  7.100 /  3.  7.100
      libpostproc    55.  7.100 / 55.  7.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'https://www.website.com/video.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        encoder         : Lavf58.76.100
      Duration: 00:03:14.85, start: 0.000000, bitrate: 4488 kb/s
        Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 4418 kb/s, 24 fps, 24 tbr, 90k tbn, 48 tbc (default)
        Metadata:
          handler_name    : VideoHandler
        Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 69 kb/s (default)
        Metadata:
          handler_name    : SoundHandler
[STREAM]
start_time=0.000000
[/STREAM]
[STREAM]
start_time=9.892993
[/STREAM]

How can I get only the second stream, which is the audio, and without all the extra info?

So the response would just be:

start_time=9.892993

Upvotes: 0

Views: 950

Answers (1)

Rems
Rems

Reputation: 141

ffprobe -loglevel quiet  -select_streams a -show_entries stream=start_time -of csv=p=0 -i input

Should extract the start_time for audio streams, without extra text. Selecting specific stream is possible by replacing the -select_streams a by -select_streams N where N is the stream index (starting at 0)

Upvotes: 2

Related Questions