Sunday, February 12, 2012

So I've recorded a ton of television shows using my HD-PVR, but the .MP4 and .TS files are huge. More than once I've tried to use ffmpeg and/or mencoder to compress the files, but every time I've tried, the audio and video would become unsynced. Last night, I deduced that it isn't a lag issue, the audio was just starting later. So I tried delaying the video using ffmpeg, something like:

ffmpeg -i tvshow.ts -itsoffset 00:00:02.5 -i tvshow.ts -map 0:0 -map 1:1 output.mkv

That wasn't exactly what I put in, and I got errors at first, but when I finally got it to work, it did the opposite of what I wanted. I played around with the maps for awhile, then I decided to do a negative offset and that worked--the correct offset ended up being 3 seconds. Now that I'm thinking of it, I could probably do it without two input files. I know almost nothing about ffmpeg, so I'm feeling my way around through trial, error, and googling. I also haven't tried this on any different files yet, so I'm not sure if the 3 seconds is constant or not.
...
Eh, I just went on and tried it on another file, and confirmed that (1) 3 seconds seems to be constant, and (2) I didn't need two inputs.