Hey folks
i have encoded a few vhs tapes to mpegts with an adtec edje2000 realtime network video encoder.
The encoder works great and produces great quality mpeg video that is compatiable with dvd format without re-encoding
the original capture i used ffmpeg
Code:
ffmpeg udp://224.0.1.250:2000 -format mpegts -acodec copy -vcodec copy tape1.ts
ffprobe shows the file as
Code:
Input #0, mpegts, from 'tape.ts':
Duration: 00:35:53.49, start: 1.400000, bitrate: 8827 kb/s
Program 1
Metadata:
service_name : Service01
service_provider: FFmpeg
Stream #0.0[0x100]: Video: mpeg2video (Main), yuv420p, 720x480 [SAR 8:9 DAR 4:3], 8000 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
Stream #0.1[0x101](eng): Audio: mp2, 48000 Hz, stereo, s16, 192 kb/s
The problem i have is there are parts of the video where the tape is damaged, or when the sceens change and the encoder drops out for a few frames. This causes the audio and video to go out of sync. I have ordered a TBC to deal with this, but in the meantime i would like to fix the sync with software.
I cut up the file with mpegstreamclip to dump the transports stream into the different mpg files for each chapter. I made sure "fix timecode breaks" and "fix stream with data breaks" were both selected. here is the ffprobe for the files
Code:
Input #0, mpeg, from './track01.mpg':
Duration: 00:10:22.07, start: 1.000000, bitrate: 8147 kb/s
Stream #0.0[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x480 [SAR 8:9 DAR 4:3], 8000 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
Stream #0.1[0x1c0]: Audio: mp2, 48000 Hz, stereo, s16, 192 kb/s
ok soo far so good.
i tried to process the file with dvdauthor but got this
Code:
#VIDEO_FORMAT=NTSC dvdauthor -o dvd/ -t ./track01.mpg
DVDAuthor::dvdauthor, version 0.7.0.
Build options: gnugetopt imagemagick iconv freetype fribidi fontconfig
Send bug reports to <dvdauthor-users@lists.sourceforge.net>
INFO: default video format is NTSC
INFO: dvdauthor creating VTS
STAT: Picking VTS 01
STAT: Processing ./track01.mpg...
WARN: Skipping sector, waiting for first VOBU...
WARN: Skipping sector, waiting for first VOBU...
WARN: Skipping sector, waiting for first VOBU...
WARN: Skipping sector, waiting for first VOBU...
WARN: Skipping sector, waiting for first VOBU...
Sooo i realize i shoulded exported the video as headed mpg in streamclip. but i didnt know.
so i fixed it with mencoder
Code:
mencoder ../track01.mpg -of mpeg -oac copy -ovc copy -mpegopts format=dvd:tsaf -vf harddup -o ./track01_copy.mpg
MEncoder 1.0rc4-4.5.2 (C) 2000-2010 MPlayer Team
success: format: 0 data: 0x0 - 0x25c38453
MPEG-PS file format detected.
VIDEO: MPEG2 720x480 (aspect 2) 29.970 fps 8000.0 kbps (1000.0 kbyte/s)
[V] filefmt:2 fourcc:0x10000002 size:720x480 fps:29.970 ftime:=0.0334
==========================================================================
Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
AUDIO: 48000 Hz, 2 ch, s16le, 192.0 kbit/12.50% (ratio: 24000->192000)
Selected audio codec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3)
==========================================================================
PACKET SIZE: 2048 bytes, deltascr: 43885
videocodec: framecopy (720x480 24bpp fourcc=10000002)
audiocodec: framecopy (format=50 chans=2 rate=48000 bits=16 B/s=24000 sample-1)
Limiting audio preload to 0.4s.
Increasing audio density to 4.
Writing header...
INITV: 0.200, 0.167, fps: 29.970
Pos: 0.7s 21f ( 0%) 0.00fps Trem: 0min 0mb A-V:0.067 [0:192]
Skipping frame!
--- ( ALOT OF THESE MESSAGES )
1 duplicate frame(s)!
Writing index...32f (100%) 897.56fps Trem: 0min 613mb A-V:-0.060 [7945:192]
Overhead: 1.763% (11148904 / 632555928)
Writing header...
Video stream: 7945.732 kbit/s (993216 B/s) size: 617636208 bytes 621.855 secs 18532 frames
Audio stream: 192.000 kbit/s (24000 B/s) size: 14924736 bytes 621.864 secs
my ffprobe at this point shows
Code:
Input #0, mpeg, from 'track01_copy.mpg':
Duration: 00:10:21.82, start: 0.233367, bitrate: 8281 kb/s
Stream #0.0[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x480 [SAR 8:9 DAR 4:3], 8000 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
Stream #0.1[0x1c0]: Audio: mp2, 48000 Hz, stereo, s16, 192 kb/s
i then used dvd author to create the dvd structure
Code:
VIDEO_FORMAT=NTSC dvdauthor -o dvd/ -t ./track01_copy.mpg
DVDAuthor::dvdauthor, version 0.7.0.
Build options: gnugetopt imagemagick iconv freetype fribidi fontconfig
Send bug reports to <dvdauthor-users@lists.sourceforge.net>
INFO: default video format is NTSC
INFO: dvdauthor creating VTS
STAT: Picking VTS 01
STAT: Processing ./track01_copy.mpg...
STAT: VOBU 1232 at 610MB, 1 PGCs
INFO: Video pts = 0.231 .. 622.086
INFO: Audio[8] pts = 0.231 .. 621.903
STAT: VOBU 1238 at 613MB, 1 PGCs
CHAPTERS: VTS[1/1] 0.000
INFO: Generating VTS with the following video attributes:
INFO: MPEG version: mpeg2
INFO: TV standard: ntsc
INFO: Aspect ratio: 4:3
INFO: Resolution: 720x480
INFO: Audio ch 0 format: mp2/2ch, 48khz 20bps
STAT: fixed 1238 VOBUs
I then add the table of contents
Code:
VIDEO_FORMAT=NTSC dvdauthor -o dvd/ -T
DVDAuthor::dvdauthor, version 0.7.0.
Build options: gnugetopt imagemagick iconv freetype fribidi fontconfig
Send bug reports to <dvdauthor-users@lists.sourceforge.net>
INFO: default video format is NTSC
INFO: dvdauthor creating table of contents
INFO: Scanning dvd/VIDEO_TS/VTS_01_0.IFO
If i burn the dvd or play in VLC the are a some spots where the video is still damaged and freezes because and the audio/video becomes out of sync.
Is there any software that can sanitize a mpeg ts/ps and replace areas of damaged video with blank video or something? seems as all programs can detect the errors, but none can handle them?