mediainfo
mediainfo --Inform="Video;%Codec%" video.mkv
Mi caso de retorno:
V_MPEG4/ISO/AVC
respuesta posible gracias a How to find duration of a video file using mediainfo in seconds or other formats?
ffprobe (ffmpeg) forma fácil
Asumiendo que su vídeo tiene una solo transmisión de video:
ffprobe -v error -select_streams v:0 -show_entries stream=codec_name \
-of default=noprint_wrappers=1:nokey=1 video.mkv
Will en mi caso de retorno:
h264
respuesta posible gracias a How to get video duration in seconds?
ffprobe (ffmpeg) manera sucia
Este método es más fácil de entender, pero desordenado.
Para obtener la información del códec sin reproducir el archivo, use ffprobe
.
$ ffprobe video.mkv
[...]
Input #0, matroska,webm, from 'video.mkv':
Metadata:
ENCODER : Lavf56.25.101
Duration: 00:28:05.15, start: 0.000000, bitrate: 4353 kb/s
Stream #0:0: Video: h264 (High 4:4:4 Predictive), yuv444p, 1280x960, SAR 1:1 DAR 4:3, 29.97 fps, 29.97 tbr, 1k tbn, 59.94 tbc (default)
Metadata:
ENCODER : Lavc56.26.100 libx264
Stream #0:1: Audio: vorbis, 48000 Hz, stereo, fltp (default)
Metadata:
ENCODER : Lavc56.26.100 libvorbis
para extraer la información de códec de vídeo - desde ffmpeg envía información a stderr - pipe y GrEP que:
$ ffprobe video.mkv 2>&1 >/dev/null | grep Stream.*Video
Stream #0:0: Video: h264 (High 4:4:4 Predictive), yuv444p, 1280x960, SAR 1:1 DAR 4:3, 29.97 fps, 29.97 tbr, 1k tbn, 59.94 tbc (default)
Para reducir esto aun más lejos, introducir SED:
$ ffprobe video.mkv 2>&1 >/dev/null |grep Stream.*Video | sed -e 's/.*Video: //' -e 's/[, ].*//'
h264
No se puede reproducir. ffmpeg-0.5-5.20091026svn.fc12.x86_64 –