PNG vs JPG, OGG vs MP3...

  • #1, by Simon_ASAWednesday, 14. January 2015, 12:37 10 years ago
    Hi everyone,

    when I read the documentation, the forum or the wiki, it is usually recommended to use specific formats in VS projects:
    - PNG pictures rather than JPG
    - OGG audio rather than MP3
    - VP8 codec rather than Xvid
    - MKV container rather than AVI

    Could someone tell me if, except for the copyrights issue (mp3, divx and more are not free of use), there is a true reason to use one format instead of another within VS?
    I mean, can there be technical issues if we create a VS game with Xvid videos? or with JPG pictures? or MP3 sound?

    The choice of specific codecs can definetely make important changes in a project, and can, for example, totally change the size of a game.
    In ASA: Remastered Edition, we are using JPG pictures for the backgrounds of the scenes. There are over 900 of these backgrounds in 1920x800.
    A single background in PNG will weight around 2,5 MB
    A single background in JPG will weight around 300 kB
    The total of size for the 900 backgrounds of the game shows a big difference depending on the choice of compression, and the pictures alone can go from 2 GB in PNG, to only 270 MB in JPG.

    So my question is simple: from a technical point of view, can there be a problem in a VS game if we don't use the recommended codecs? Have you ever noticed problems of compatibility, crashes, or anything else?


    Great Poster

    321 Posts


  • #2, by SimonSWednesday, 14. January 2015, 12:48 10 years ago
    Hi,

    JPG is not usable on mobile platforms, it has no transparency and bad quality, so don't use jpg, ever.
    PNG is very high quality but big, if you can allow some loss of quality, check out WEBP, best image codec there is imao, compresses better than JPG, but keep the losless files.
    OGG compresses better than MP3, and it's free, even better is OPUS, but it has only command line tools. Also note that MP3 has stability issues, because it's decoded with FFMPEG.
    VP8 is free and has a good quality ratio, xvid is old and has a bad quality ratio.
    MKV is the way to go, you could in fact put everything in AVI, but AVI isn't very robust and complex with some codecs.

    Thread Captain

    1581 Posts

  • #3, by afrlmeWednesday, 14. January 2015, 12:48 10 years ago
    I've noticed certain issues before, such as certain codecs causing issues such as incorrectly exported images with wrong options/modes enabled. Even had an issue with a jpg file not displaying once.

    In regards to mp3: the other issue with that was (pre 4.0) that it wasn't very stable & would often hiss & click & pop, whereas ogg tended to play more smoothly. I think that issue has been addressed. I don't think there's that much difference in size between an mp3 or ogg file.

    In regards to images we recommend png because it's a lossless image format unlike jpg, which is a lossy format. I don't think there is any legal reasons for why to use one image format & not any of the others. Obviously we don't recommend using .gif files because the quality of them is garbage.

    However I do recommend converting your image files webp instead, as you will see that they take your 2mb+ png file & compress them down to somewhere between 1/5 & 3/4 the size of the png file, while maintaining pretty much the same quality as the png version of the image - I've yet to discern the difference between them.

    We do mostly recommend those formats because they are open container/open source formats & we do actively support them over other formats/codecs.

    I hope this answers your questions a little bit.

    Imperator

    7278 Posts

  • #4, by Simon_ASAWednesday, 14. January 2015, 16:47 10 years ago
    THanks a lot to the 2 of you! Yes it totally answers my question. My main concern is now about JPG, as we used them in ASA: Remastered. We will see during the Beta-test if there are problems with them or not. In case some people complain about errors or loss of quality, I will probably convert the pics to webp...

    What is sure, is that I will follow your advice for my next project Catyph, and will use webp, mkv/vp8 and ogg directly.

    By the way, there is something I already asked in the past but I never succeeded in making it work:
    how do you read the subtitles in a MKV? Let's say I have several languages in my opening movie (english, french, german...) and I want the good subtitle to be displayed depending on the language chosen by the player in the game. How can you do that? (but maybe the answer has been posted in the wiki since then?)

    Great Poster

    321 Posts

  • #5, by ke4Wednesday, 14. January 2015, 17:16 10 years ago

    Key Killer

    810 Posts

  • #6, by Simon_ASAWednesday, 14. January 2015, 17:34 10 years ago
    Excellent! Thank you Ke4 wink

    I copy/paste the answer here, in case someone else would look for the answer:

    BigStans said:

    For multilanguage you can use:
    VGameVideoSubtitleFont (for the font)
    VGameVideoSubtitlePosition (for the subtitle position ] default was bottom)
    VGameVideoSubtitleLanguage (for the subtitle language)
    and
    VGameVideoAudioLanguage (if the MKV have different audio tracks)
    Simply use the ISO 639 to set the languages. MKVtoolnix sets the ISO 639 too.
    http://wiki.visionaire-tracker.net/wiki/ISO639_Lan...
    for example:
    game:setValue(VGameVideoSubtitleLanguage, de)
    to set the Subtitle language
    game:setValue(VGameVideoAudioLanguage, de)
    to set the Audio Track to german

    and we have:
    VGameSpeechLanguage
    for the character output "speech (audio)" language (if the language exists).
    More examples?wink

    Great Poster

    321 Posts

  • #7, by ke4Tuesday, 20. January 2015, 12:30 10 years ago
    I actually didn't have any video in my game with subs till now, and i found out that it's not working. It's not showing any subtitles at all.

    with my
    game:setValue(VGameVideoSubtitleLanguage, cze)
    game:setValue(VGameVideoSubtitleLanguage, eng)
    - mkv video file with subs in ISO through MKVtoolMix.

    are there any specification for supported subtitles files? i'm using .srt
    MKVtoolMix doesn't support .txt, .sub files

    Key Killer

    810 Posts

  • #8, by Simon_ASATuesday, 20. January 2015, 22:08 10 years ago
    Mmh I didn't try it yet, I was working on other things, but I remember that when I tried to create my MKV file with the subtitles inside, they were srt too.

    Great Poster

    321 Posts