VideoHelp Forum
+ Reply to Thread
Results 1 to 12 of 12
Thread
  1. .
    [how to] Overlay image title(s) on AVC H.264 video — without recoding


    Hi
    "What? NO printscreens?! "
    See attachment.

    "How to add an image title (or several) losslessly and~in~a~snap to... tons * of videos, waiting to be fully converted, knowing that I (of course) lack spare time to recode? "
    * one by one / no batch (come back in ten... days / I mean: years)
    So, in short: some friends' request, that I couldn't satisfy for "a while" and until lately. Thanks to the valuable help I found at videohelp.com **, I can finally suggest some kind of ('luxury') treat, to those "raw" or bare "flicks". Image: of any shape, exploiting ".png" transparency (100% only, no gradual transparency I guess...).
    ** https://forum.videohelp.com/threads/374839-Overlay-picture-on-AVC-vid-in-MP4-NOT-hardcoded?p=2415545
    I had to switch to ".mkv" container, though, instead of ".mp4" (compatible only with ".idx + .sub" DVD poor color image subtitles / new MP4 version badly needed!)... I doubt ".mkv" videos are as widely compatible as ".mp4". But "well", with no recoding: main requirement...
    ~ Hey: BTW, thanks in advance: to anyone who'd simplify or improve "my" method (yet somewhat tedious). ~

    ————— tools —————

    · Windows based PC; tested OK under old Win. XP
    · Photoshop (commercial) or Fotografix (free) or else
    · tsMuxer
    · BDSup2sub (+ Java... portable unless installed)
    · MediaInfo
    · MKVToolNix GUI


    ——— six steps quick SUMMARY ———
    or better: see attached zip, including .pdf + example, to test the "toolbox". Overall "principle or idea": scroll down.

    — 1 — Modify some ".srt" or attached "Test-subtitles.srt" to the timestamps & durations you want (never mind texts). And drop it to tsMuxer, check "Demux", click "Start demuxing" – to generate "Test-subtitles.sup".

    — 2 — Drop "Test-subtitles.sup" to BDSup2sub > OK. Select "XML/PNG". Save/export, to generate "Test-subtitles_exp.xml" + "Test-subtitles_exp_0001.png", etc. Quit BDSup2sub.

    — 3 — Check your video image size = width × height in pixels, using MediaInfo.

    — 4 — Create title image, using Photoshop or Fotografix: same size as video; resolution: 72 dpi. Mode: RGB. Don't convert to "indexed / 256 colors"! Background: TRANSPARENT. Save to ".png" format > "None" (= not "Interlaced") > name: "Test-subtitles_exp_0002.png", OK to replace the existing.

    — 5 — Drop "Test-subtitles_exp.xml" to BDSup2sub. Top left, select (Subtitle) "2". Bottom right, double click small preview. Center (or position) image using the sliders. And so on, with titles #3, #4... Top of main window: "Output format" field: this time, select "SUP(BD)". Then, File > Export/save. Accept "Test-subtitles_exp_exp.sup".

    — 6 — Drop "_Video_orig.mp4" (my sample) or your own and "Test-subtitles_exp_exp.sup" to MKVToolNix GUI > OK to "Add as new input files". Modify file name to "Video_RESULT.mkv" or else; click "Start muxing".


    At least the "principle or idea" (well: the only way I know so far...) is quite simple, if not the steps & manipulations.

    Start from an ".srt" plain text subtitle file, since it contains the necessary "time stamps". Modify them. Usually, you would keep the 1st subtitle only, or two to three. And/or: if you want end credits, modify one or a few timestamps, that display something (whatever) at the end of the film.

    Next, convert the ".srt" to as many tiny ".png" pictures as the ".srt" contains subtitles. The text of subtitles is of no importance, since we then "modify" (in fact: replace) those images: enlarge, of course, + enrich, etc.

    Lastly, convert that bunch of ".png" images to ONE ".sup" file — and insert it into the video container, which HAS to be ".mkv"...

    "VLC" and "Media Player Classic" are the most compatible players — with the overlaid result; "PotPlayer" also but, depending on its settings, it may display shapes edges smoothly, or pixelated!
    [ "PotPlayer" pixelated display? See attached "PotPlayer settings" example, to download. ]

    .
    Last edited by bulgom; 31st Oct 2015 at 13:23.
    Quote Quote  
  2. Is anyone supposed to actually read that mess you posted? Different font size, different font colors, formatting all over the place. Sorry, I have no patience to sit there and subject my eyes to that.

    If someone else wants to read that mess more power to them.
    Quote Quote  
  3. Member godai's Avatar
    Join Date
    Oct 2012
    Location
    United States Florida
    Search PM
    i guess , he is just very technical and thats it.
    Quote Quote  
  4. .
    Hi — and thanks for your nice replies
    [ including the precious hint, more or less between the lines, on good typography usage ]

    @ Sophisticles & Godai

    OK, let's — really — get technical, below (though I wonder who could follow, considering the level of difficulty):

    on the top of my post, while holding the left mouse button, you could select it all the way down, and, then (guess what), on (a PC) keyboard, hit Ctrl+C (I can explain that further, if you wish).

    Then — please don't faint, yet —, Ctrl+V (i.e. paste, yes Sir!) to any plain text editor.

    And, miracle, HERE's the eye candy you didn't even ask for :


    · · · · · · · · · · · · · · · · · · · · · ·


    — 1 — Modify some ".srt" or attached "Test-subtitles.srt" to the timestamps & durations you want (never mind texts). And drop it to tsMuxer, check "Demux", click "Start demuxing" – to generate "Test-subtitles.sup".

    — 2 — Drop "Test-subtitles.sup" to BDSup2sub > OK. Select "XML/PNG". Save/export, to generate "Test-subtitles_exp.xml" + "Test-subtitles_exp_0001.png", etc. Quit BDSup2sub.

    — 3 — Check your video image size = width × height in pixels, using MediaInfo.

    — 4 — Create title image, using Photoshop or Fotografix: same size as video; resolution: 72 dpi. Mode: RGB. Don't convert to "indexed / 256 colors"! Background: TRANSPARENT. Save to ".png" format > "None" (= not "Interlaced") > name: "Test-subtitles_exp_0002.png", OK to replace the existing.

    — 5 — Drop "Test-subtitles_exp.xml" to BDSup2sub. Top left, select (Subtitle) "2". Bottom right, double click small preview. Center (or position) image using the sliders. And so on, with titles #3, #4... Top of main window: "Output format" field: this time, select "SUP(BD)". Then, File > Export/save. Accept "Test-subtitles_exp_exp.sup".

    — 6 — Drop "_Video_orig.mp4" (my sample) or your own and "Test-subtitles_exp_exp.sup" to MKVToolNix GUI > OK to "Add as new input files". Modify file name to "Video_RESULT.mkv" or else; click "Start muxing".



    .
    Last edited by bulgom; 31st Oct 2015 at 13:47.
    Quote Quote  
  5. Excellent!
    I recommend to download that zip first so there is an idea what is the workflow about.
    Quote Quote  
  6. off topic, a bit, not related to the general workflow, only for DVD or DV videos, Photoshop has those d1/dv templates, 720x480 (NTSC) or 720x576 (PAL), these are also used to create DVD menus , so you avoid resizing in later exporting that png (or bmp in DVD creating scenario, making subpicture or menu), ... the way it works, while generating that image, subtitle or menu for DVD, you see it on screen with aspect ratio, or when you import image, Phoshop gives that image aspect ratio as well, so at the end it is on screen as it should be, you can export 720x480 or 720x576 directly
    Quote Quote  
  7. .
    "D1/DV PAL (1.066) Photoshop P.A.R. option"


    @ _Al_

    Thanks for reminding. It can also be very useful in titling — especially when using pictures, of course (i.e. main point of my post). And moreover: portrait pictures or anything that denotes elongation or squishing at 1st glance.


    I often forget that "Photoshop" option, when preparing a DVD menu; and that's a mistake. Since you pointed, here's my quick reminder (that I should add to the .pdf):
    "Photoshop": Ctrl+N (new image), and set W. to 720 pixels, H. to 576 px. — or 480 for NTSC —, 72 dpi, background: transparent > OK.

    Next, for 4:3 video: menu Image > Pixel Aspect Ratio > D1/DV PAL (1.066) — or "D1/DV NTSC (1.09).

    In the case of my post, rather than "off topic", I find it a little advanced, at least for some of my friends who asked "how to title using images " — and knowing that few only use "Photoshop"... But not for a lot of the users of this forum.

    That's why I tried to skip aspect ratio questions / problems, in the attached .pdf. I mean: "tried"; because, in fact, I had to resize the test image to 704 pixels on width. Although it's not even a human figure, before resize, it did look squished (quite obviously).


    Besides that, what I'm really after would be: how to simplify the 5 or 6 steps to... less, of course;
    "step 3 · MediaInfo to check video image size" being quite useless as such = can be included to the next one — but that wouldn't simplify much, of the whole "thing".
    And "by the way", working directly on DISPLAY size, while "Photoshop knows" and outputs a 720 px. width, ALSO simplifies the manipulations (for those equipped with that tool, anyway).


    [ Another point — but I type "dim", here, as I know I'm dreaming — : having to wrap image titled videos in .mkv container is frustrating, since many standalone players are .mp4 compatible only...

    I'm sure that one of the "MPEG" engineers is a relative or yours . Therefore, please do me a favor: ask him or her to implement .png images — WITH transparency, yes —, to a next version of that stingy .mp4 container, +: NOT 256 colors only, but 16 millions, of course. ]


    .
    Last edited by bulgom; 31st Oct 2015 at 23:15.
    Quote Quote  
  8. Member godai's Avatar
    Join Date
    Oct 2012
    Location
    United States Florida
    Search PM
    you technical but if we read carefully you can understand.

    thanks for sharing it.
    Quote Quote  
  9. .
    When friends asked me "how to overlay an IMAGE title on AVC H.264 video in less than a minute + without recoding", I — like most newbies — thought that, somehow, a software or a method would take care of such a basic/simple expectation... in a snap!: an all-in-ONE process.

    Well, unless I don't know what I'm doing (and I never exclude that possibility), it's NOT the case.

    If I were technical enough, may be I'd be able to simplify that to one or three lines of instructions, period, such as:

    "All you want is to overlay an image title onto your video in no recode mode? Even your cat's able of that! Just drop them to 'this' software, and you're all set."


    So, to make too long a "story" even longer:

    Naively, I believed the ".mp4" container to be able to handle that, may be with the (simple) help of "Yamb/MP4box", or "MkvToolnix" (to ".mkv"), forgetting that any video player needs an overlay instruction, of course.

    I first thought of inserting pictures to ".mp4 & .mkv" videos, with no more instructions — dumb & counter technical to the bone! —, but, since I'm "only" 99% idiot and not 100%, I realized (my my!):

    "how will the players know that I want them overlaid, and where exactly, + what size, how long for; and which players will be compatible, etc.?"...


    It's far from being THAT easy: the darn tools and players ain't even able to read my thoughts! So in practice, it turned out to be — way — more complex a "procedure"...

    I'm a permanent beginner / lamer, that often needs help. With the help I found here, above, you have the clumsy method I was able to geek. I have explained clearly (from the start) that it's — or that I find it too complex, yet.

    Again, anybody's welcome to simplify it — to the LEAST technical steps & intructions.

    Being unable to program anything but simple batches, I cannot create a software, that would overlay with no recoding. I could may be (?) avoid one of the steps (or parts of some of them) through a ".bat" file, but that'd take me a long time, and might not even be worth it.



    .
    Last edited by bulgom; 1st Nov 2015 at 10:11. Reason: More formatting needed (on request!).
    Quote Quote  
  10. Originally Posted by bulgom View Post
    I could may be (?) avoid one of the steps (or parts of some of them) through a ".bat" file
    Well I decided to test it a bit, how it looks on WDTV Live player for example - colors are not right, which immediately brought a question where the player reads color information from Blu-Ray sup file. If it is like in DVD (VobSub) then players might use some default pallets in this case or something, not real color (VLC shows correct colors, so BDSup2Sub must keeps those colors, or VLC reads it from hardisk? Will get to it). So I have to look how things work. How a sup file is constructed, where does it take color information on playback etc.

    In the meantime to make it simple, for repetitive steps I use this batch file:
    Code:
    @echo off
    set path_editor=%windir%\system32\notepad.exe
    set path_xml=%~dp0Test-subtitles_exp.xml
    
    set BDSup2Sub=C:\tools\BDSup2Sub\BDSup2Sub.jar
    set path_java=C:\Program Files (x86)\Java\jre1.8.0_31\bin\java.exe
    set sup_output=Test-subtitles_exp_batch.sup
    set value=/fps:25 /res:576 /filter:lanczos3
    
    SET mkvmerge="C:\tools\mkvmerge\mkvmerge.exe"
    set input_video=_Video_orig.mp4
    rem choose one of those: 24000/1001p 24p 25p 30000/1001p 50i 60000/1001i 50p 60000/1001p
    set input_video_fps=25p
    set language=eng
    set "chapters="
    
    START /WAIT "%path_editor%" "%path_xml%"
    "%path_java%" -Xmx256m -jar "%BDSup2Sub%" "%path_xml%" "%sup_output%" %value%
    %mkvmerge% -o output_test.mkv "--forced-track" "0:no" "--default-duration" "0:%input_video_fps%" "--compression" "0:none" "-d" "0" "-A" "-S" "-T" "--no-global-tags" "(" "%input_video%" ")" "--language" "0:%language%"  "--default-track" "1:yes" "--forced-track" "1:no" "--compression" "1:none" "-a" "1" "-D" "-S" "-T" "--no-global-tags" "("  "%input_video%" ")" "--language" "0:%language%" "--default-track" "0:yes" "--forced-track" "0:no" "-s" "0" "-D" "-A" "-T" "--no-global-tags" "("  "%sup_output%" ")" %chapters% "--title" "test to include xml subtitles"
    echo done
    pause
    So those PNG's are made before in Photoshop or I tried even Paint.net and it worked, then running that BAT from folder where those PNG's are, XML editor pops on screen, one can edit it, save it, cancel window, then I just find muxed MKV. Subtitles are set as default on in that MKV also. So it simplifies those tests.

    Just that xml is being opened by Windows by whatever is set to open it by default, ignoring those lines in batch - not opening it by notepad, but that does not matter I guess.
    Last edited by _Al_; 1st Nov 2015 at 12:02.
    Quote Quote  
  11. .
    Well~well!.. Interesting, there!

    Thank you for the batch!!


    I can't test it at once, as I have to modify some paths, since I use "Java... portable" only. And BTW, I was also thinking of a "kit", knowing that all tools are free (except "Photoshop", OK).

    I sometimes prepare such kits — driven by a batch... full of as many RELATIVE paths as possible, so that anybody can use them regardless of drives & partitions letters...
    [ ... but didn't "bother" to mention that in the 1st place, since, as I was expecting, the responses I got denote a "certain dose" of misunderstanding, if not total, from some people. Not important; we know that most people begin to understand as soon as they actually NEED some result. ]

    —————— COLORS

    Yes, I sure "experienced" those problems in my 1st tries, not .png ovelaid to .mp4 (via ".sup") but:

    ".idx + .sub" onto ".mp4"... In that case, EACH player displays totally different colors! "Plus": 3 actual colors only anyway... With ONE advantage, though: gradual tranparency effect (e.g. "50% transparency").
    So I gave up, with "default & custom palettes" headache, considering that 3 colors aren't worth it.

    With the ".png to .sup" method, at least, both "VLC" and "PotPlayer" + "Media Player Classic" display colors right ("S-M & U-Mplayer" : greyscaled overlay only);

    for now (...), I consider that result... "good enough". Of course, if compatiblity with more players could improve, my friends & I would appreciate, since a lot of them will hardly care or (even) notice the "warning": "Use VLC or PotPlayer or MPC!".

    [ Not even talking about standalone players, including the ones contained in cell phones... ]

    Anyway, since 3 Windows based players behave quite well, I dont' let that stop me (otherwise, I'd do nothing).


    —————— About "Paint.NET"

    It created a "thumbs.db" file into almost every folder, on the partition from which I launched it. May be a bad setting; or because it's a lousy portable version, I found. Not important. If not "Photoshop", "Fotografix" works also (or almost any still picture editor).


    —————— About "making it simple(r) for repetitive steps"

    Yep, that sure improves the "thingy", since having to go thru my AMOUNT of steps, even to simply TEST a result, sure is tedious (if not frustrating / & of course, discouraging, to many users).


    —————— About the ".xml" file

    Sure not a priority. Further testing might indicate if its editing really counts or what. But anyway, whoever would want to modify it could just manually use "Notepad".


    1st things 1st: I have to test the batch, yet... knowing that I'm (of course) gonna try to group all tools into one folder only — including "portable Java" despite its weight:

    more than 100 MB but quite less once "7zipped" / with a little warning: "If you have Java INSTALLED, click here instead ": just another version of the batch (or a "set choice" command within the ".bat").


    .
    Last edited by bulgom; 1st Nov 2015 at 15:06.
    Quote Quote  
  12. @ _Al_

    Hey! Thanks to your excellent batch, the whole thing just... WORKS!..

    ... in one of my — prehistoric — Win. XP machines anyway. Haven't tested under Win. 7/8, yet.

    And with — ANY — AVC MP4 video, Full HD included; +: without the least modification of anything to begin with
    (only, in that case, the title is squished to wide screen AR, of course, but that's very easy to solve, by using and even providing ".png" template files, of that proportion).

    OK · from the start (that is: few days ago ), it's intended to help... NEWBIES, with their cell phone + other filming gadgets results.

    That would have been impossible without your spontaneous help.



    Newbies, then...

    That's why I just:
    — grouped all the tools into one folder: 161 MB uncompressed, 39 MB "7zipped";

    — and TRIED to modify your batch (to relative paths, since I want everything portable, including "Java", that bloat):

    "BATCH-2.bat".

    Though hard to believe after I laid my hands on it, it STILL works – but (now) displays an error (I'm not exactly talented, when it comes to batch commands), that I'm of course unable to solve:

    "ERROR: Too many input files."


    Here's the whole folder (in its "draft state" of course): attached.




    PS · I'd also like to add a command to (automatically) read the name of any (one only) MP4 video dropped into the folder, and rename from "Output.mkv" to "<Original-video-file-name>.mkv";

    so that the original video wouldn't need renaming first.

    It works well in a batch I'm using to modify the D.A.R + move the "Atom" info., up to the header section or AVC MP4 files (since "AviDemux" inserts it at bottom only...). Knowing my "batching abilities", adding that option to your batch sounds a little tricky, though...


    Code:
    for /r %%i in (*.mp4) do set "MyMP4=%%~nxi"
    ren *.mp4 test.mp4
    
    ren *.mp4 *.
    ren test %MyMP4%
    move *.mp4 2
    ren 2\*.mp4 %MyMP4%
    ren 2\*.mp4 *.
    for /r %%i in (2\*.) do set "NEW=%%~nxi"
    ren 2\*. %NEW%__moov-ok.mp4
    move 2\*.* .
    Image Attached Files
    Last edited by bulgom; 1st Nov 2015 at 22:01.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!