日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

FFmpeg av_dump_format输出的tbn、tbc、tbr、PAR、DAR的含义

發(fā)布時(shí)間:2023/12/14 编程问答 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 FFmpeg av_dump_format输出的tbn、tbc、tbr、PAR、DAR的含义 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

http://www.jianshu.com/p/5b78a91f1091

利用 ffmpeg 系統(tǒng)函數(shù) dump 碼流信息

ffmpeg 提供了一個(gè)函數(shù)直接幫助你打印出解析到的媒體信息,用法如下:

av_dump_format(ic, 0, ic->filename, 0); 如:

av_dump_format(fmtCtx, 0, "rtmp://live.hkstv.hk.lxdns.com/live/hks", 0);會(huì)打印流媒體的信息,比如:

[flv @ 0x7fa6ec813400] Stream discovered after head already parsed Input #0, flv, from 'rtmp://live.hkstv.hk.lxdns.com/live/hks':Metadata:author : PowerSmartcopyright : description : datarate : 500livetime : 1453688059timeshift : 0Duration: 01:00:00.00, start: 0.000000, bitrate: N/AStream #0:0: Audio: aac (LC), 32000 Hz, stereo, fltpStream #0:1: Video: h264 (Constrained Baseline), yuv420p, 640x480, 15.17 fps, 15 tbr, 1k tbn, 30 tbc

其中,15 tbr, 1k tbn, 30 tbc是什么意思,很多人并不了解。

There are three different time bases for time stamps in FFmpeg. The values printed are actually reciprocals of these, i.e. 1/tbr, 1/tbn and 1/tbc.

tbn is the time base in AVStream that has come from the container, I think. It is used for all AVStream time stamps.

tbc is the time base in AVCodecContext for the codec used for a particular stream. It is used for all AVCodecContext and related time stamps.

tbr is guessed from the video stream and is the value users want to see when they look for the video frame rate, except sometimes it is twice what one would expect because of field rate versus frame rate.

tbr一般被當(dāng)成幀率。當(dāng)視頻的碼率為固定碼率時(shí),FFmpeg顯示tbr為正常的碼率值。當(dāng)視頻有變長碼率時(shí),FFmpeg打印的tbr為多個(gè)碼率的均值,看著像音頻流。比如:

Video: h264, yuv420p, 640x480, 22050 tbr, 22050 tbn, 44100 tbc

新問題
Stream #0.0[0xfe]: Video: h264, yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], 59.94 tbr, 90k tbn, 59.94 tbc中PAR、DAR是什么含義?

PAR - pixel aspect ratio大多數(shù)情況為1:1,就是一個(gè)正方形像素,否則為長方形像素

DAR - display aspect ratio就是視頻播放時(shí),我們看到的圖像寬高的比例,縮放視頻也要按這個(gè)比例來,否則會(huì)使圖像看起來被壓扁或者拉長了似的。

SAR - storage aspect ratio就是對(duì)圖像采集時(shí),橫向采集與縱向采集構(gòu)成的點(diǎn)陣,橫向點(diǎn)數(shù)與縱向點(diǎn)數(shù)的比值。比如VGA圖像640/480 = 4:3,D-1 PAL圖像720/576 = 5:4

這三者的關(guān)系PAR x SAR = DAR或者PAR = DAR/SAR.

如果一段視頻的DAR為4:3,它的SAR為VGA存儲(chǔ)的4:3,那么可推出PAR為1:1,如果它的SAR為D-1 PAL存儲(chǔ)的5:4,那么可以推出PAR為16:15


D-1 PAL圖像

看上圖,假設(shè)這就是一個(gè)D-1 PAL圖像,每個(gè)方格代表一個(gè)存儲(chǔ)的點(diǎn),橫向有5個(gè)點(diǎn),縱向有4個(gè)點(diǎn),所以SAR為5:4

現(xiàn)已知這幅圖象的寬度為160,高度為120,即DAR為4:3

那這個(gè)方格的寬高比是多少呢?答案16:15,即PAR,這個(gè)方格代表的是一個(gè)長方形的像素。

視頻三比率SAR,PAR,DAR是從宏觀上描述一個(gè)視頻輪廓很重要的三個(gè)參數(shù)。在不同的文檔中,通常對(duì)這三個(gè)參數(shù)有不同的表述。但是,均指代同一事物。

參考及推薦閱讀:

  • What does the output of ffmpeg mean? tbr tbn tbc etc?
  • What does the video output stream details from ffmpeg mean?
  • ffmpeg frame rate
  • 對(duì)PAR DAR SAR的理解

總結(jié)

以上是生活随笔為你收集整理的FFmpeg av_dump_format输出的tbn、tbc、tbr、PAR、DAR的含义的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。