How to hardcode subtitles into an AVI without loss of quality

5,781

Solution 1

No. The hardsubs modify the video content and so recompressing it is necessary.

Solution 2

I think as it is typically used, hard subtitles mean they are embedded into the image data, which by definition requires re-compression. Soft subtitles are added as separate files, e.g. .srt. However, there is a middle way in embedded subtitles. Embedded subtitles are added into the video container as a separate track, which means they will be included in the file but not require re-compression.

For Divx-format the best tool is Windows based application AVIAddXSubs. It can embed Idx/Sub/Srt subtitles.

For MP4 and some other alternatives, Handbrake can embed soft subtitles. Read more at their wiki

Solution 3

You can use mplayer to play the video with subtitles, and then output everything to a raw yuv file (-vo yuv4mpeg). If you play a movie, this outputted file will be really huge, hundreds of gigabytes, so make sure that it will not cause issues.

After the file has been outputted, it can be compressed by using ffmpeg and then H264 codec.

Share:
5,781
tony_sid
Author by

tony_sid

Born and raised in California. Computers are my main hobby.

Updated on September 17, 2022

Comments

  • tony_sid
    tony_sid almost 2 years

    I am using a program to hardcode subs into an AVI file. The problem is that is recompresses the video using a codec. I don't see why this is necessary and causes a noticeable loss of quality. Is there a program that will put the subs in without having to recompress the video so that there is no loss in video quality?

  • tony_sid
    tony_sid over 13 years
    What codec should be used to minimize loss of video quality?
  • Ignacio Vazquez-Abrams
    Ignacio Vazquez-Abrams over 13 years
    That is a question that entire doctorate theses have been written about.
  • Ignacio Vazquez-Abrams
    Ignacio Vazquez-Abrams over 13 years
    Based on the asker's other questions, I'm fairly sure they already have a MKV with embedded softsubs.
  • RipperDoc
    RipperDoc over 13 years
    Yes, you may be right but I was assuming the asker wanted an AVI file. AVI can include subs without recompression using AVIAddXSubs and a DivX/Xvid compatible player. If the MKV had a h264 video stream, the same could be accomplished with Handbrake and the MP4 container (example for iPad or Apple TV).
  • ttarchala
    ttarchala almost 13 years
    Soft subtitles may be embedded in containers such as MKV, but not all devices may be able to play them (I'm thinking about you, Playstation 3!)
  • Gert van den Berg
    Gert van den Berg over 7 years
    The recompression will cause loss of quality though...