0

I'm using ffmpeg to record NTSC analog video on Linux Fedora 36 using a Blackmagic Intensity Pro 4K for video and a Scarlett 2i2 for audio. I'm using a TBC to avoid dropped frames and to ensure a constant S-Video Y/C framerate on the analog end.

The problem I'm running into is that on playback the audio will start out relatively in sync with the video at the beginning of the captured file but will eventually run ahead of the video eventually becoming many seconds off.

Nothing I do seems to change this or change the degree to which it happens. The audio and video stay in sync throughout the entire video as I'm monitoring the source so I don't understand how they can diverge so much once encoded into a digital file?

Here is the command I am using:

ffmpeg -hwaccel cuda -fflags +igndts -format_code ntsc -f decklink -raw_format auto -vsync passthrough -rtbufsize 1500M -thread_queue_size 512 -i 'Intensity Pro 4K' -f pulse -rtbufsize 500M -thread_queue_size 512 -i 'Scarlett 2i2 Camera Analog Stereo' -c copy -map 0:1 -map 1:0 "/tmp/ffmpeg-raw/file-raw.avi"

here's the ffprobe output from one of my files:

Input #0, avi, from 'test2-raw.avi':
  Metadata:
    software        : Lavf59.33.100
  Duration: 00:11:42.87, start: 0.000000, bitrate: 169341 kb/s
  Stream #0:0: Video: rawvideo (UYVY / 0x59565955), uyvy422, 720x486, 167801 kb/s, 59.94 fps, 59.94 tbr, 59.94 tbn
  Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, 2 channels, s16, 1536 kb/s

As you can see in my code snippet, I've been throwing things at the wall for a bit. I've tried different rtbufsizes, adding -copyts, and going through the different -vsync options. I've tried it with and without hardware acceleration ( I do have a NVIDIA card), +igdts did get rid of a warning but did not help with the sync, as did changing the thread queue sizes.

OBS can do this, why can't I?

2
  • Don't save to AVI - use MKV or NUT.
    – Gyan
    Nov 2, 2022 at 4:26
  • Tried MKV and NUT and both have the same issue. Nov 4, 2022 at 15:24

1 Answer 1

0

I figured it out, I just needed to add -video_pts reference to change the timestamp source. I also needed to add -itsoffset -0.4 to remove the constant delay between the video and audio.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.