2010-09-11, 08:30
Okay, I've found out why comskip isn't finding commercials so well.. it doesn't like the output of and struggles to decode some video/audio:
I've changed it to
and it now finds all the commercials very accurately but with massive a/v sync issues.
Ive tried experimenting with -copyts 1 and -async 1 but had no luck. I'm hoping someone has a solution to getting tvheadend output to a comskip compatible file.
EDIT: I should add, mythtv's output works flawlessly.. When I re-encode mythtvs output with ffmpeg, it becomes a little more unreliable but still in sync.
EDIT2:
Works flawlessly for me. The above seems to work for ALL files, picking up every commercial break Ive thrown at it so far. Only downside is the longer processing time. ~30mins all up I think for a 2gb recording.
Just testing out the donators version of comskip now to see if it helps at all. Problem with the other settings seems to be some dropped frames or something at the beginning of some mkvs. All the commercial breaks were off by 30secs in those files.
Here's part of my ffmpeg log showing the sync problem. 768(frames) divided by 25(fps) = ~30sec
When comskip tries to find the commercials, the audio and video are out of sync by the same amount and the commercial breaks in the edl occur 30seconds early.
EDIT3: Just realised when playing back the original problematic files in xbmc, while it plays fine, the playtime begins at 0.30 and cannot be skipped back before that time. It does not skip 30seconds of video, rather there is something there which is erroneous. When I transcode the file, the new one has 30 seconds of grey and no sound at the beginning which helps comskip create a valid edl. I'm starting to think its a bug with how tvheadend creates the mkv. Fixing this would save alot of video transcoding time which I am currently doing to make the edl (which are working great!!).
Code:
ffmpeg -v 10 -i "$MKVVIDEO" -vcodec copy -acodec copy "$MPGVIDEO"
I've changed it to
Code:
ffmpeg -v 10 -i "$MKVVIDEO" -vcodec copy -ab 128k "$MPGVIDEO"
and it now finds all the commercials very accurately but with massive a/v sync issues.
Ive tried experimenting with -copyts 1 and -async 1 but had no luck. I'm hoping someone has a solution to getting tvheadend output to a comskip compatible file.
EDIT: I should add, mythtv's output works flawlessly.. When I re-encode mythtvs output with ffmpeg, it becomes a little more unreliable but still in sync.
EDIT2:
Code:
ffmpeg -v 10 -i "$MKVVIDEO" -vcodec mpeg2video -sameq -acodec copy -f vob -copyts "$MPGVIDEO"
Just testing out the donators version of comskip now to see if it helps at all. Problem with the other settings seems to be some dropped frames or something at the beginning of some mkvs. All the commercial breaks were off by 30secs in those files.
Quote:Output #0, mpeg, to '/home/nick/Recordings/NCIS.2010-09-10.mpg':
Metadata:
encoder : Lavf52.78.3
Stream #0.0(eng): Video: mpeg2video, yuv420p, 720x576 [PAR 64:45 DAR 16:9], q=2-31, 15000 kb/s, 90k tbn, 25 tbc
Stream #0.1(eng): Audio: mp2, 48000 Hz, 2 channels, 256 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Press [q] to stop encoding
[mpeg @ 0x915ca60] buffer underflow i=1 bufi=0 size=768
Last message repeated 1 times
frame= 555 fps= 0 q=-1.0 size= 16968kB time=52.24 bitrate=2660.8kbits/s
frame= 1011 fps=1011 q=-1.0 size= 30994kB time=70.50 bitrate=3601.3kbits/s
frame= 1617 fps=1078 q=-1.0 size= 49586kB time=94.67 bitrate=4290.7kbits/s
Here's part of my ffmpeg log showing the sync problem. 768(frames) divided by 25(fps) = ~30sec
When comskip tries to find the commercials, the audio and video are out of sync by the same amount and the commercial breaks in the edl occur 30seconds early.
EDIT3: Just realised when playing back the original problematic files in xbmc, while it plays fine, the playtime begins at 0.30 and cannot be skipped back before that time. It does not skip 30seconds of video, rather there is something there which is erroneous. When I transcode the file, the new one has 30 seconds of grey and no sound at the beginning which helps comskip create a valid edl. I'm starting to think its a bug with how tvheadend creates the mkv. Fixing this would save alot of video transcoding time which I am currently doing to make the edl (which are working great!!).