简体   繁体   English

从电视调谐器/网络摄像头录制,gstreamer和音频/视频不同步

[英]Recording from tv tuner/webcam with gstreamer and audio/video going out of sync

I have a TV tuner card that shows up as /dev/video1 . 我有一张电视调谐卡,显示为/dev/video1 I am trying to digitize some old VHS tapes. 我正在尝试数字化一些旧的VHS磁带。 The TV tuner doesn't do audio, I have a wire connected to my microphone in. 电视调谐器没有音频,我有一根电线连接到我的麦克风。

This is the gstreamer pipeline I'm using to capture video & audio and save it to a file. 这是我用来捕获视频和音频并将其保存到文件的gstreamer管道。 I'm using motion jpeg because I don't want it to drop frames and lose content. 我正在使用动作jpeg,因为我不希望它丢帧并丢失内容。 I'll re-encode it better later. 稍后我将对其进行更好的重新编码。

gst-launch-0.10 v4l2src device=/dev/video1 ! \
    queue ! \
    video/x-raw-yuv,width=640,height=480 ! \
    ffmpegcolorspace ! \
    jpegenc ! \
    avimux name=mux ! \
    filesink location=output.avi \
   pulsesrc ! \
    queue ! \
    audioconvert ! \
    audio/x-raw-int,rate=44100,channels=2 ! \
    mux.

This all works well and good. 这一切都很好。 I have files that play that have video and audio. 我有播放的视频和音频文件。 However sometimes when playing the output files, the audio & video goes out of sync. 但是,有时在播放输出文件时,音频和视频不同步。 It happens at the same place in the video, on numerous different media players (totem, mplayer). 它发生在视频中同一位置的许多不同的媒体播放器(图腾,mplayer)上。 So I think this is a problem in how I'm saving and recording the file. 所以我认为这是我如何保存和录制文件的问题。

Is there anything I can do to the pipeline to make it less likely to suffer from audio/video sync problems? 我可以对管道做些什么,以减少遭受音频/视频同步问题的可能性? I'm a bit of a newbie to gstreamer and video/audio codecs, so I might be doing something stupid here (please point out!). 我有点像gstreamer和视频/音频编解码器的新手,所以我可能在这里做一些愚蠢的事情(请指出!)。 Is there any video/audio/muxer codec that would be better? 有没有更好的视频/音频/多路复用器编解码器?

尝试在音频分支中添加audiorate元素,在视频分支中添加videorate元素,以查看是否有所不同,或尝试使用其他多路复用器,如qtmux或matroskamux。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM