gpt4 book ai didi

audio - 使用 gstreamer 将同步的视频和音频记录到容器文件中

转载 作者:行者123 更新时间:2023-12-04 06:38:45 27 4
gpt4 key购买 nike

我正在使用 TI DM365 EVM 来录制视频和音频。我需要对这两个流进行编码并将它们保存在容器文件中,例如 .avi 或 .mp4。我正在使用以下 gstreamer 管道:

gst-launch v4l2src always-copy=FALSE num-buffers=-1 do-timestamp=TRUE ! 'video/x-raw-yuv,format=(fourcc)NV12,width=1280,height=720,framerate=30/1' ! queue ! TIVidenc1 codecName=h264enc engineName=codecServer byteStream=false genTimeStamps=true ! queue ! mux. alsasrc num-buffers=-1 typefind=TRUE do-timestamp=TRUE ! audio/x-raw-int,width=16 ! queue ! TIAudenc1 codecName=aaclcenc engineName=codecServer genTimeStamps=true name=aenc ! queue ! mux. avimux name=mux ! filesink location=vidaudtest.avi sync=true

结果是我得到了一个 .avi 文件,但是当我使用 Totem Movie Player 在 PC 上播放该文件时,视频播放速度过快而音频以正常速度播放。例如,在 5 分钟的文件中,视频在 40 秒内播放完毕。

此外,在录制时,我收到了一些这样的消息:

WARNING: from element /GstPipeline:pipeline0/GstAlsaSrc:alsasrc0: Can't record audio fast enough
Additional debug info:
gstbaseaudiosrc.c(822): gst_base_audio_src_create (): /GstPipeline:pipeline0/GstAlsaSrc:alsasrc0:
Dropped 33516 samples. This is most likely because downstream can't keep up and is consuming samples too slowly.

还有其他人看到过这种行为吗?有什么想法或解决方案吗?

最佳答案

我想问题是您的设备无法以您请求的速率传送帧。一个可能的解决方案是通过 videorate 元素运行它来“重新采样”您的视频流:

v4l2src ! 'video/x-raw-yuv,format=(fourcc)NV12,width=1280,height=720' ! videorate force-fps=30  ! ...

更新:或者像这样的东西也可以工作:

... ! 'video/x-raw-yuv,format=(fourcc)NV12,width=1280,height=720' ! videorate ! 'video/x-raw-yuv,framerate=(fraction)30/1' ! ...

关于audio - 使用 gstreamer 将同步的视频和音频记录到容器文件中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13020290/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com