• 音视频同步测试方法


    1.计算依据

    延迟结果=图像出现时间-音频出现时间+客户端校验值(可正可负)

    判断依据:一般延时结果在200ms内属于正常范围

    2.获取视频信息

    a.mediainfo

    cd到视频文件的路径,然后在终端输入如下命令:

    mediainfo a.mp4

    输出结果:

    1. General
    2. Complete name : a.mp4
    3. Format : MPEG-4
    4. Format profile : Base Media
    5. Codec ID : isom (isom/iso2/avc1/mp41)
    6. File size : 13.1 MiB
    7. Duration : 19 s 947 ms
    8. Overall bit rate mode : Variable
    9. Overall bit rate : 5 491 kb/s
    10. Writing application : Lavf58.20.100
    11. Video
    12. ID : 1
    13. Format : AVC
    14. Format/Info : Advanced Video Codec
    15. Format profile : High@L4
    16. Format settings : CABAC / 4 Ref Frames
    17. Format settings, CABAC : Yes
    18. Format settings, Reference frames : 4 frames
    19. Codec ID : avc1
    20. Codec ID/Info : Advanced Video Coding
    21. Duration : 19 s 920 ms
    22. Bit rate : 5 490 kb/s
    23. Width : 1 920 pixels
    24. Height : 1 080 pixels
    25. Display aspect ratio : 16:9
    26. Frame rate mode : Constant
    27. Frame rate : 25.000 FPS
    28. Color space : YUV
    29. Chroma subsampling : 4:2:0
    30. Bit depth : 8 bits
    31. Scan type : Progressive
    32. Bits/(Pixel*Frame) : 0.106
    33. Stream size : 13.0 MiB (100%)
    34. Writing library : x264 core 155 r2917 0a84d98
    35. Encoding settings : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=6 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=21.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
    36. Language : English
    37. Codec configuration box : avcC
    38. Audio
    39. ID : 2
    40. Format : AAC LC
    41. Format/Info : Advanced Audio Codec Low Complexity
    42. Codec ID : mp4a-40-2
    43. Duration : 19 s 947 ms
    44. Bit rate mode : Variable
    45. Bit rate : 2 277 b/s
    46. Maximum bit rate : 128 kb/s
    47. Channel(s) : 2 channels
    48. Channel layout : L R
    49. Sampling rate : 48.0 kHz
    50. Frame rate : 46.875 FPS (1024 SPF)
    51. Compression mode : Lossy
    52. Stream size : 5.54 KiB (0%)
    53. Language : English
    54. Default : Yes
    55. Alternate group : 1

    从输出结果可以看到延迟结果=(19.920-19.947)*1000=27ms,属于正常范围

    b.ffprobe

    cd到视频文件的路径,然后在终端输入如下命令:

    ffprobe -v quiet -print_format json -show_format -show_streams -show_error -show_chapters a.mp4
    1. {
    2. "streams": [
    3. {
    4. "index": 0,
    5. "codec_name": "h264",
    6. "codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
    7. "profile": "High",
    8. "codec_type": "video",
    9. "codec_tag_string": "avc1",
    10. "codec_tag": "0x31637661",
    11. "width": 1920,
    12. "height": 1080,
    13. "coded_width": 1920,
    14. "coded_height": 1080,
    15. "closed_captions": 0,
    16. "film_grain": 0,
    17. "has_b_frames": 2,
    18. "pix_fmt": "yuv420p",
    19. "level": 40,
    20. "chroma_location": "left",
    21. "field_order": "progressive",
    22. "refs": 1,
    23. "is_avc": "true",
    24. "nal_length_size": "4",
    25. "id": "0x1",
    26. "r_frame_rate": "25/1",
    27. "avg_frame_rate": "25/1",
    28. "time_base": "1/12800",
    29. "start_pts": 0,
    30. "start_time": "0.000000",
    31. "duration_ts": 254976,
    32. "duration": "19.920000",
    33. "bit_rate": "5489806",
    34. "bits_per_raw_sample": "8",
    35. "nb_frames": "498",
    36. "extradata_size": 43,
    37. "disposition": {
    38. "default": 1,
    39. "dub": 0,
    40. "original": 0,
    41. "comment": 0,
    42. "lyrics": 0,
    43. "karaoke": 0,
    44. "forced": 0,
    45. "hearing_impaired": 0,
    46. "visual_impaired": 0,
    47. "clean_effects": 0,
    48. "attached_pic": 0,
    49. "timed_thumbnails": 0,
    50. "captions": 0,
    51. "descriptions": 0,
    52. "metadata": 0,
    53. "dependent": 0,
    54. "still_image": 0
    55. },
    56. "tags": {
    57. "language": "eng",
    58. "handler_name": "\u001fMainconcept Video Media Handler",
    59. "vendor_id": "[0][0][0][0]"
    60. }
    61. },
    62. {
    63. "index": 1,
    64. "codec_name": "aac",
    65. "codec_long_name": "AAC (Advanced Audio Coding)",
    66. "profile": "LC",
    67. "codec_type": "audio",
    68. "codec_tag_string": "mp4a",
    69. "codec_tag": "0x6134706d",
    70. "sample_fmt": "fltp",
    71. "sample_rate": "48000",
    72. "channels": 2,
    73. "channel_layout": "stereo",
    74. "bits_per_sample": 0,
    75. "id": "0x2",
    76. "r_frame_rate": "0/0",
    77. "avg_frame_rate": "0/0",
    78. "time_base": "1/48000",
    79. "start_pts": 0,
    80. "start_time": "0.000000",
    81. "duration_ts": 956400,
    82. "duration": "19.925000",
    83. "bit_rate": "2277",
    84. "nb_frames": "935",
    85. "extradata_size": 5,
    86. "disposition": {
    87. "default": 1,
    88. "dub": 0,
    89. "original": 0,
    90. "comment": 0,
    91. "lyrics": 0,
    92. "karaoke": 0,
    93. "forced": 0,
    94. "hearing_impaired": 0,
    95. "visual_impaired": 0,
    96. "clean_effects": 0,
    97. "attached_pic": 0,
    98. "timed_thumbnails": 0,
    99. "captions": 0,
    100. "descriptions": 0,
    101. "metadata": 0,
    102. "dependent": 0,
    103. "still_image": 0
    104. },
    105. "tags": {
    106. "language": "eng",
    107. "handler_name": "#Mainconcept MP4 Sound Media Handler",
    108. "vendor_id": "[0][0][0][0]"
    109. }
    110. }
    111. ],
    112. "chapters": [
    113. ],
    114. "format": {
    115. "filename": "a.mp4",
    116. "nb_streams": 2,
    117. "nb_programs": 0,
    118. "format_name": "mov,mp4,m4a,3gp,3g2,mj2",
    119. "format_long_name": "QuickTime / MOV",
    120. "start_time": "0.000000",
    121. "duration": "19.947000",
    122. "size": "13691488",
    123. "bit_rate": "5491146",
    124. "probe_score": 100,
    125. "tags": {
    126. "major_brand": "isom",
    127. "minor_version": "512",
    128. "compatible_brands": "isomiso2avc1mp41",
    129. "encoder": "Lavf58.20.100"
    130. }
    131. }
    132. }

    从输出结果依然可以看到延迟结果=(19.920-19.947)*1000=27ms,属于正常范围

  • 相关阅读:
    java-net-php-python-jspm在线作业提交系统计算机毕业设计程序
    数据库理论知识及相关发展方向
    uniapp 跳转页面保存和刷新 拦截器的使用
    Vue 路由懒加载
    uniapp引入uniapp打包的H5跳转H5以及H5返回app方法
    .Net Core 3.0 对 MongoDB 的多条件(两种)查询操作
    针对语音服务提供厂商的记录(2022-08-16)
    关于content-type的理解
    【简单易操作】图漾TM460-E2深度网络相机在ROS-melodic环境下的配置过程
    43_Object类
  • 原文地址:https://blog.csdn.net/weixin_39810558/article/details/126226242