Skip to content
Advertisement

Extract the time of the video with ffmpeg in Ubuntu

I am using Ubuntu 14.04.5 LTS 32 bit and ffmpeg to extract the time of a video.

In Windows 10 the command works:

/usr/bin/ffmpeg -i video.mp4 -vstats 2> & 1

In Linux ffmpeg returns the error in red:

At least one output file must be specified

The error complete is here:

ffmpeg version 2.4.3-1ubuntu1~trusty6 Copyright (c) 2000-2014 the FFmpeg developers
 built on Nov 22 2014 17:07:19 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1) 
configuration: --prefix=/usr --extra-version='1ubuntu1~trusty6' --build-suffix=-ffmpeg --toolchain=hardened
--extra-cflags= --extra-cxxflags= --libdir=/usr/lib/i386-linux-gnu --shlibdir=/usr/lib/i386-linux-gnu --incdir=/
usr/include/i386-linux-gnu --enable-gpl --enable-shared --disable-stripping --enable-avresample 
--enable-avisynth --enable-fontconfig --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray 
--enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfreetype --enable-libfribidi
 --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus
--enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libspeex --enable-libssh
--enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp
--enable-opengl --enable-x11grab --enable-libxvid --enable-libx265 --enable-libdc1394 --enable-libiec61883
--enable-libzvbi --enable-libzmq --enable-frei0r --enable-libx264 --enable-libsoxr --enable-openal
--enable-libopencv  
libavutil      54.  7.100 / 54.  7.100  
libavcodec     56.  1.100 / 56.  1.100  
libavformat    56.  4.101 / 56.  4.101  
libavdevice    56.  0.100 / 56.  0.100  
libavfilter     5.  1.100 /  5.  1.100  
libavresample   2.  1.  0 /  2.  1.  0  
libswscale      3.  0.100 /  3.  0.100  
libswresample   1.  1.100 /  1.  1.100  
libpostproc    53.  0.100 / 53.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':  
Metadata:
major_brand     : mp42
minor_version   : 0
compatible_brands: mp41isom
creation_time   : 2017-01-29 15:42:02
location        : -21.6646-46.7394/
location-eng    : -21.6646-46.7394/  
Duration: 00:01:49.43, start: 0.000000, bitrate: 1171 kb/s
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv), 640x360 [SAR 1:1 DAR 16:9], 992 kb/s,
15.01 fps, 15 tbr, 30k tbn, 60 tbc (default)
Metadata:
  creation_time   : 2017-01-29 15:42:02
  handler_name    : VideoHandler
  encoder         : AVC Coding
Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 174 kb/s (default)
Metadata:
  creation_time   : 2017-01-29 15:42:02
  handler_name    : SoundHandler
At least one output file must be specified

How can I fix this problem?

Advertisement

Answer

Use

/usr/bin/ffmpeg -i video.mp4 -vstats -map 0:v -f null - 2>&1

Or you could just use ffprobe

ffprobe -show_entries format=duration -of compact=p=0:nk=1 video.mp4 
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement