Log in

View Full Version : mpg: overlay a black mask without recoding


gate.keeper0
2nd June 2004, 13:41
hello folks,

i searched through this great site but i can't still found what i'm looking for. not in site or forum...

so first i hope i'm in the right part of this forum! if not => please move.

what i like to do sounds very easy but it come out to be very difficult:

i like to redraw the black mask (black bar/beam) on top & bottom of a recorded mpg/mpv without the need of recoding the whole movie (e.g. with CCE).

background: on my recordings from a special telesation there's a constant white line at the first pixelrow. that's really bothering during watching the recorded movies (finally from DVD-R).

so any help is welcome

thanx a lot

gatekeeper

Malcolm
2nd June 2004, 14:24
changing MPEGs or changing some screen-areas of MPEGs without reencoding is impossible normally. Although this is possible in theory. If someone skilled would write the right software for this, then applications like 'blacking out areas' were possible. I guess this would be the simplest approach for changing MPEGs in the first place. (e.g. black out station-logos)
i also had the idea for a software that detects block-errors (green or violet) blocks in mpegs (mainly erroneous DVB-transmission). the software would then have to 'reencode' or 'restore' the mpeg only in this screen-area so that the wrong-coloured block would be fixed (e.g. take the colour from the neighbouring blocks).
If it's impossible to do this on a low level (inside the mpeg file), then the affected frames/GOPs would have to be fixed traditionally (e.g. via avisynth), reencoded and the old erroneous frames/GOPs replaced by the newly encoded.

In your case there's a possibility to black out areas without reencoding. all you need is a 4 color bitmap in the size of your video. paint the area that you want to have blackenend out and paint the area that has to be transparent (for the video).
Then convert this bitmap to a subtitle-file (there are programs for this (subtitleworkshop i think)). maybe you can find them here at doom9.org. give the subtitle a duration from the first to the last second of the movie.
author your DVD and add the subtitle. You can use ifoedit for the authoring. remeber to set the color for the subtitle properly in ifoedit, so that the color for the blackened area _really_ is black!

Greetings,
Malcolm

gate.keeper0
3rd June 2004, 11:54
hi malcom,

thanx for your anwer :D

i fear that it's possible but no programm exists at the moment...

but your solution for my special problem sounds great!!
so i tried (use dvd maestro for authoring) but it seem to be a difficult problem!
cause it appear that the white line is outside the normal picture :angry:

here's a screenshot with a red subpicture:
http://www.soko.cc/doom9_1.jpg

the subpicture is placed -10/-10 (also tried 0/0) but the white line is again there.

is it possible, that die line is only in one half picture (interleaced) ??

thanx a lot

gatekeeper

Malcolm
7th June 2004, 10:34
Originally posted by gate.keeper0
the subpicture is placed -10/-10 (also tried 0/0) but the white line is again there.

is it possible, that die line is only in one half picture (interleaced) ??

i've never worked with DVD maestro, so i can't tell if this program has restrictions regarding subpictures (-placement).
You should try 'Subtitleworkshop' (-> download section of doom9). You can import Bitmap files and create DVD subtitle files with it. (use IfoEdit to create a DVD with the subtitle).
Another possibility is that the exact placement of the subtitle depends on the player. Did you try different Soft- and Hardwareplayers? The subtitles are placed on top of the video during playback by the decoding-engine (may it be soft- oder hardware). It could be that some players place the subtitle one line lower than expected...

i doubt that subpictures are placed only in one field. if that would be the case, then you would see only every 2nd line of the subpic.
On the other hand you could be right that (in some cases) the subpicture isn't placed at line 0 but line 1 instead! This could be because some videos are TFF while others are BFF. (Just a thought)

Another point: When you're watching videos on TV, then line 0 is outside the visible area on the screen. Why do you see it?? When you're watching your videos on your PC then there are other possibilities to get rid of the white line. automatic cropping while playing for instance.

Greetings,
Malcolm

communist
7th June 2004, 21:57
Originally posted by Malcolm
changing MPEGs or changing some screen-areas of MPEGs without reencoding is impossible normally.
Well TV Stations and the like who receive MPEG2 strams and have to uplink it again need to overlay logos / cut to other MPEG2 streams (splicing) etc. without having to reencode (-> decode -> overlay logo -> encode) do this using hardware like this one http://www.terayon.com/tools/static_page/view.html?phase=show&id=1075712690&tool_id=100&cat_id=9.2.8
For mpeg splicing there are several ways to do like explained here :
http://2001newsarchive.broadcastengineering.com/ar/broadcasting_mpeg_splicing_station/

Malcolm
8th June 2004, 10:05
interesting article!

to this terayon thing:
just what i said - impossible normally :)
normally = you can do it at home with existing (freeware) tools!
Nevertheless, one thing you can't avoid even with the terayon: the areas (macroblocks) where logos are placed have to be reencoded though! i'm curious what happens if there is motion-vector info concerning the reencoded macroblocks under the logo and other neighbouring macroblocks?!!

Still, it would be an interesting thing to work on a software that can black out / modify macroblocks in mpeg-streams. just for fun! Like this you could black out station logos (or place your own!). Also possible: replace macroblocks with the smeared color of the neighbouring macroblocks to get rid of logos.
A good starting point for such a software would be rejig. because in rejig, mpeg is decoded to the domain-level, requantized and then recompressed via huffman-encoding. All you have to do is to play around with the macroblocks in the domain-level.
if i only had more time... :rolleyes:

Greetings,
Malcolm