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

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

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

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

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

利用 ffmpeg 系統函數 dump 碼流信息

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

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

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

[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一般被當成幀率。當視頻的碼率為固定碼率時,FFmpeg顯示tbr為正常的碼率值。當視頻有變長碼率時,FFmpeg打印的tbr為多個碼率的均值,看著像音頻流。比如:

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大多數情況為1:1,就是一個正方形像素,否則為長方形像素

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

SAR - storage aspect ratio就是對圖像采集時,橫向采集與縱向采集構成的點陣,橫向點數與縱向點數的比值。比如VGA圖像640/480 = 4:3,D-1 PAL圖像720/576 = 5:4

這三者的關系PAR x SAR = DAR或者PAR = DAR/SAR.

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


D-1 PAL圖像

看上圖,假設這就是一個D-1 PAL圖像,每個方格代表一個存儲的點,橫向有5個點,縱向有4個點,所以SAR為5:4

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

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

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

參考及推薦閱讀:

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

總結

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

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。