VideoHelp Forum




+ Reply to Thread
Results 1 to 8 of 8
  1. Member
    Join Date
    Jul 2008
    Location
    United States
    Search Comp PM
    the details of what I'm trying to do and the progress so far are in this thread. https://forum.videohelp.com/topic353687.html But my problem is with the conversion.

    basically the subject says it all. I have two jpegs. They start at 3072x2304. Both have been converted to 704x480 for use as SVCD stills and look fine at the resolution (with intended distortion b/c of rectangular tv pixels). I convert them to m2v so that I can later mux them in with audio commentary into an mpg.

    conversion is done using the following commands for resizing and encoding

    Code:
    # convert to 704x480
    convert -geometry '704x480!' -quality 100 $file svcd/$file
    
    # convert to m2v mpeg2 stills
    jpeg2yuv -v 0 -f 29.97 -j $file -I p -n 1 | \
    mpeg2enc -v 0 -a 2 -T 200 -n n -f 7 -o mpgs/m2v/${file%.JPG}.m2v
    
    # mux with audio
    mplex -f 7 $m2v $mp2 -o $dest
    All conversions work, and the resulting svcd plays in the dvd player fine. The problem is that certain images are horrible quality. Others are perfectly fine. The filesize of the bad quality pictures is 16K to 32K. certain 48K pictures look beautiful. Max size is 148K.

    Why is there such a huge difference? Can I add some options to mpeg2enc to make the process generate more uniform quailty? I've included an example m2v attached for your reference.

    Thanks
    Bill

    img_0104.m2v
    Quote Quote  
  2. Banned
    Join Date
    Jun 2007
    Location
    UNREACHABLE
    Search Comp PM
    If mpeg2enc supports custom quantization matrices,
    try a matrix that compresses less then the default one.
    HTH.
    Quote Quote  
  3. Would it be possible to start with a less compressed image? or lossless compression like a .png as opposed to a .jpg? I don't know the command line for this
    Quote Quote  
  4. Member
    Join Date
    Jul 2008
    Location
    United States
    Search Comp PM
    That's an idea. Although jpeg2yuv pipes raw yuv uncompressed data out, the picture does go through a jpeg compression at a relatively low resolution before (704x480). I could use ppm2yuv (or something like that). Also, I'm not sure if setting -q 3 is the same as a custom quantization matrix, but I had tried that to no avail. I will look into both. Thanks.

    Bill
    Quote Quote  
  5. Member
    Join Date
    Jul 2008
    Location
    United States
    Search Comp PM
    OK update. After much wrestling with ppmtoy4m, I finally got it piped successfully into mpeg2enc. However, the results were exactly the same, much to my dismay. I decided that I would have to try the custom quantization matrix (qm).

    It turns out that the qm is merely a threshold matrix that is applied to the DCT of an 8x8 section of the image. A threshold number is given to each frequency block. High frequency data usually has a higher threshold. If the threshold is not exceeded, then the data is ignored.

    mpeg2enc accepts a custom qm through the -K file=<filename> parameter. I couldn't find any information about the syntax of the file, so I ended up going to the source code. (woot for open source).

    The custom quantization matrix file for mpeg2enc should be a comma delimited list with 8 ascii numbers per line, terminated by a \n. Inter and Intra come right after one another.

    I decided to try the extreme case and put all 1's. This gave beautiful results. My 16K image is now 44K, and it looks great. Problem solved.

    Thanks
    Bill
    Quote Quote  
  6. Banned
    Join Date
    Jun 2007
    Location
    UNREACHABLE
    Search Comp PM
    We're glad you managed to solve your problem.

    mpeg2enc accepts a custom qm through the -K file=<filename> parameter.
    I couldn't find any information about the syntax of the file, so I ended up
    going to the source code. (woot for open source).
    "Open-sourcing" should not be an acceptable excuse for a half-assed manpage.

    -K|--custom-quant-matriceskvcd|tmpgenc|default|hi-res|file=input-file|help

    Specify which quantization matrices to use instead of the defaults
    (which can be specified by using "-K default"). Using "-K hi-res" is
    identical to using the -H option. The value kvcd uses the Kvcd.Net
    matrices from http://www.kvcd.net/; the value tmpgenc invokes the
    TMPGEnc matrices from http://www.tmpgenc.net/e_main.html.
    On average (this depends on the source material), the tmpgenc tables
    reduce the average bitrate by about 10% and the kvcd tables
    reduce bitrate by about 16% (compared to the default tables).
    -H|--keep-hf

    Setting this flag makes the encoder encode as much high-frequency
    information as possible. This is a good setting for maximising quality
    at VCD resolution with good quality low-noise source material.
    It can also help with "swimmy" material if you can spare the bitrate!
    Quote Quote  
  7. Member
    Join Date
    Jul 2008
    Location
    United States
    Search Comp PM
    it is hard when documentation isn't great. But I'm just glad that we've got people to program this stuff, because I sure couldn't.
    Quote Quote  
  8. Member
    Join Date
    Jul 2008
    Location
    United States
    Search Comp PM
    fyi, although it's not in the man page, running

    Code:
    mpeg2enc -K help
    give the output

    Code:
    $ mpeg2enc -K help
    Quantization matrix names:
    
    	help - this message
    	kvcd - matrices from http://www.kvcd.net
    	hi-res - high resolution tables (same as -H)
    	default - turn off -N or -H (use standard tables)
    	tmpgenc - TMPGEnc tables (http://www.tmpgenc.com)
    	file=filename - filename contains custom matrices
    		8 comma separated values per line.  8 lines per matrix, INTRA matrix first, then NONINTRA
    Quote Quote  



Similar Threads

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