Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1043609
  • 博文数量: 157
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 1388
  • 用 户 组: 普通用户
  • 注册时间: 2015-04-09 15:37
文章分类

全部博文(157)

文章存档

2023年(9)

2022年(2)

2021年(18)

2020年(7)

2017年(13)

2016年(53)

2015年(55)

我的朋友

分类: 服务器与存储

2017-07-24 18:20:50

获取metadata的命令:
一、flvmeta -只能获取文件的metadata信息
1.获取h264文件的metadata信息(需要提前在机器上安装flvmeta)(不加-y参数返回的结果是xml格式)
/usr/local/bin/flvmeta  /home/lq/lol.flv -y
 /usr/local/bin/flvmeta  /home/lq/lol.flv -y
---
duration: 0
width: 1920
height: 1080
framerate: 30
videocodecid: avc1
audiocodecid: mp4a
audiochannels: 2
audiodatarate: 128
audiosamplerate: 48000
audiosamplesize: 16
encoder: Open Broadcaster Software v0.657b
fileSize: 0
program_start: 1.4642252972e+12
stereo: true
videodatarate: 2000


2.获取h265文件的metadata信息(需要提前在机器上安装flvmeta)
/usr/local/bin/flvmeta   -y h265.flv
---
duration: 0
width: 1280
height: 720
videodatarate: 0
framerate: 23
videocodecid: 12
audiodatarate: 0
audiosamplerate: 48000
audiosamplesize: 16
stereo: true
audiocodecid: 10
filesize: 0
audiochannels: 2
cdn_ip: 59.56.30.83
server_version: 3.4.63
encoder: Lavf57.41.100
filesize: 0

二、ffprobe-可以获取流或者文件的metadata信息
1.获取h264流/h264文件的metadata信息
/usr/local/LTCLib/bin/ffprobe -i 123.flv >/tmp/resolution.txt 2>&1 (结果打印在界面上了但怎么获取----2>&1)
/usr/local/LTCLib/bin/ffprobe -i rtmp://192.168.0.11/live/livestream_1
注意:加-show_streams出来的是流的信息那里面的width不是metadata中的width
例如:/usr/local/LTCLib/bin/ffprobe -i /home/lq/lol.flv(界面输出不支持grep,输出到错误输出中了)
ffprobe version 3.1.1 Copyright (c) 2007-2016 the FFmpeg developers
  built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-17)
  configuration: --prefix=/usr/local/LTCLib --enable-gpl --enable-nonfree --enable-postproc --enable-pthreads --enable-x11grab --enable-scale --enable-version3 --enable-libspeex --disable-ffplay --disable-ffserver --enable-filter=movie --enable-frei0r --enable-libfaac --enable-libmp3lame --enable-libfdk-aac --enable-libx264 --enable-libx265 --enable-libv265 --enable-libopencore-amrnb --enable-libopencore-amrwb --extra-cflags='-D_FLV265 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4-m64 -mtune=generic -fPIC' --extra-ldflags='-g -ldl' --enable-shared --disable-stripping --enable-libopenjpeg --enable-encoder=png --enable-encoder=bmp --enable-encoder=wmv1 --enable-encoder=wmv2
  libavutil      55. 28.100 / 55. 28.100
  libavcodec     57. 48.101 / 57. 48.101
  libavformat    57. 41.100 / 57. 41.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 47.100 /  6. 47.100
  libscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
[flv @ 0x1188ca0] recv metadata
[flv @ 0x1188ca0] video stream discovered after head already parsed
[flv @ 0x1188ca0] audio stream discovered after head already parsed
recv aac header
avformat find stream frame = 30 frame = 0 duration = 0.000000 nb_frames = 1 probe nb_frames = 1 duration = 8.00
Input #0, flv, from '/home/lq/lol.flv':
  Metadata:
    duration        : 0
    width           : 1920
    height          : 1080
    framerate       : 30
    videocodecid    : avc1
    audiocodecid    : mp4a
    audiochannels   : 2
    audiodatarate   : 128
    audiosamplerate : 48000
    audiosamplesize : 16
    encoder         : Open Broadcaster Software v0.657b
    fileSize        : 0
    program_start   : 1464225297201
    stereo          : true
    videodatarate   : 2000
  Duration: 00:00:00.00, start: 0.005000, bitrate: N/A
    Stream #0:0: Video: h264 (High), yuv420p(tv, bt709/bt709/iec61966-2-1), 1920x1080, 30 tbr, 1k tbn, 60 tbc
    Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp


2.获取h265流/h265文件的metadata信息---注意用ffprobe必须是支持h265的版本,否则就会出现下面的问题-段错误
/usr/local/LTCLib/bin/ffprobe -i "rtmp://192.168.0.12/live/livestream_1"
ffprobe version 3.1.1 Copyright (c) 2007-2016 the FFmpeg developers
  built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-17)
  configuration: --prefix=/usr/local/LTCLib --enable-gpl --enable-nonfree --enable-postproc --enable-pthreads --enable-x11grab --enable-scale --enable-version3 --enable-libspeex --disable-ffplay --disable-ffserver --enable-filter=movie --enable-frei0r --enable-libfaac --enable-libmp3lame --enable-libfdk-aac --enable-libx264 --enable-libx265 --enable-libv265 --enable-libopencore-amrnb --enable-libopencore-amrwb --extra-cflags='-D_FLV265 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4-m64 -mtune=generic -fPIC' --extra-ldflags='-g -ldl' --enable-shared --disable-stripping --enable-libopenjpeg --enable-encoder=png --enable-encoder=bmp --enable-encoder=wmv1 --enable-encoder=wmv2
  libavutil      55. 28.100 / 55. 28.100
  libavcodec     57. 48.101 / 57. 48.101
  libavformat    57. 41.100 / 57. 41.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 47.100 /  6. 47.100
  libscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
[flv @ 0x1482ca0] recv metadata
    Last message repeated 2 times
[flv @ 0x1482ca0] video stream discovered after head already parsed
Segmentation fault
阅读(6230) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~