Repairing Damaged Recordings
From Nearline Storage
I used this workflow to repair a damaged recording of Fleetwood Mac on Soundstage that I captured off of Palladia.
Also worked with Sunrise Earth files:
- Convert the damaged MPG to an MKV with ffmpeg:
ffmpeg -i "/mythdata/recordings/1209_20101122140000.mpg" -filter:v yadif -aspect 16:9 -vf crop=1920:1080:0:0 -s 1920x1080 -b 4M -vcodec libx264 -vpre hq -g 15 -threads 8 -acodec copy -async 1 -f matroska /tmp/fleetwork.mkv
- "-g 15" means "set a keyframe every 15 frames." The "hq" preset sets "-g 250" and that's a problem because mkvmerge will only split on keyframes and 8 seconds between keyframes is too long to do decent editing. The one-half second intervals that "-g 15" gives works better. Using "-g 1" to make every frame a key frame didn't work, it resulted in a nasty shimmer in the video.
- Both "-g 15" and "-threads 8" must come after "-vpre hq" because the preset sets those options and will override anything set on the command line before the "-vpre" option.
- Figure out the timecodes for the edits using mplayer's -edlout option, fine-tuning the edits through trial and error using mplayer and a test edl file
mplayer -edlout edl.list tmp/fleetwork.mkv
- mplayer keys:
- o : toggle OSD (turn on timecode display)
- i : mark start or end of edit block in edl.list
- <- and -> : backward and forward 10 seconds
- up and down : backward and forward 1 minute
- pgup and pgdown : backward and forward 10 minutes
- To test playback with the edl.list, first edit the file and change the blocks so that they will be played rather than skipped. Then test with:
mplayer -edl edl.list tmp/fleetwork.mkv
- Convert the edl timecodes, which are in seconds, to hh:mm:ss.nnnnnnnn format for mkvmerge.
- Split the big file up into little ones using mkmerge:
mkvmerge --split timecodes:00:00:12.212,00:19:26.197998,00:21:56,00:39:07.077881,00:40:07,00:53:11.1,00:54:11,01:11:21,01:12:23,01:27:37.0625,01:28:36.5,01:41:12.1,01:43:12,02:00:14 -o fm.mkv fleetwood.mkv
- Merge the parts that I want to keep back into a single MKV file with mkvmerge:
mkvmerge -o fm.edited.mkv --append-mode track fm-002.mkv +fm-004.mkv +fm-006.mkv +fm-008.mkv +fm-010.mkv +fm-012.mkv +fm-014.mkv
2010-12-22, using stock Fedora 13 packages mythtv v23, ffmpeg and mkvtoolnix