VideoHelp Forum




+ Reply to Thread
Results 1 to 8 of 8
  1. Hi,

    I've been learning how to create and manipulate my video DVDs for my HTPC using Handbrake, ffmpeg, dvdauthor, etc.

    My main target format is .mkv. I create them from my original sources using Handbrake.

    On occassion, I want to convert one of those .mkv files into a VIDEO_TS so I can (re)burn it to a DVD.

    I use ffmpeg + dvdauthor to do it. The result plays fine -- video & audio work as expected.

    Except, the size gets screwed up along the way. Unlike the streamed-mkv which plays full/wide screen with black bars on top & bottom, the VIDEO_TS resulting from my conversion process gets stretched so that no bars show, the picture *vertically* fills the screen, and the left/right sides of the picture are cropped off.

    I'm hoping someone here might help with a little guidance of how to maintain the picture dimensions from Handbrake-created .mkv through to the VIDEO_TS.

    My process is pretty simple. Starting with the "movie.mkv" created by Handbrake

    Code:
        ffmpeg -i movie.mkv -target ntsc-dvd -aspect 16:9 movie.mpg
    
        cat movie.xml
            <dvdauthor>
             <vmgm></vmgm>
              <titleset><titles><pgc>
               <vob file="movie.mpg" />
              </pgc></titles></titleset>
            </dvdauthor>
    
        cat $HOME/.config/video_format
            NTSC
    
        dvdauthor -o movie_FOLDER -x movie.xml
    then I just burn the movie_FOLDER, which contains populated AUDIO_TS/VIDEO_TS folders to DVD with K3B.

    How do I "tell" ffmpeg and dvdauthor to "preserve" the dimensions of the movie as it's in Handbrake's mkv?

    I've included the Handbrake .plist, below, that works for getting my DVDs into a streamable .mkv for my HTPC. I'm guessing, but am not sure, that each step of my process needs to pull the right info from the data of the previous step.

    Appreciate any help!

    Izzy

    Code:
    .plist
    ------------------------------------------------
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <array>
        <dict>
            <key>AudioAllowAACPass</key>
            <true />
            <key>AudioAllowAC3Pass</key>
            <true />
            <key>AudioAllowDTSHDPass</key>
            <true />
            <key>AudioAllowDTSPass</key>
            <true />
            <key>AudioAllowMP3Pass</key>
            <true />
            <key>AudioEncoderFallback</key>
            <string>AC3 (ffmpeg)</string>
            <key>AudioList</key>
            <array>
                <dict>
                    <key>AudioBitrate</key>
                    <string>160</string>
                    <key>AudioEncoder</key>
                    <string>AAC (faac)</string>
                    <key>AudioEncoderActual</key>
                    <string>faac</string>
                    <key>AudioMixdown</key>
                    <string>Dolby Pro Logic II</string>
                    <key>AudioSamplerate</key>
                    <string>Auto</string>
                    <key>AudioTrack</key>
                    <integer>1</integer>
                    <key>AudioTrackDRCSlider</key>
                    <real>0</real>
                    <key>AudioTrackDescription</key>
                    <string>English (AC3) (5.1 ch)</string>
                    <key>AudioTrackGain</key>
                    <real>0</real>
                    <key>AudioTrackName</key>
                    <string></string>
                    <key>AudioTrackQuality</key>
                    <real>-1</real>
                    <key>AudioTrackQualityEnable</key>
                    <false />
                </dict>
                <dict>
                    <key>AudioBitrate</key>
                    <string>448</string>
                    <key>AudioEncoder</key>
                    <string>AC3 Passthru</string>
                    <key>AudioEncoderActual</key>
                    <string>copy:ac3</string>
                    <key>AudioMixdown</key>
                    <string>None</string>
                    <key>AudioSamplerate</key>
                    <string>Auto</string>
                    <key>AudioTrack</key>
                    <integer>1</integer>
                    <key>AudioTrackDRCSlider</key>
                    <real>0</real>
                    <key>AudioTrackDescription</key>
                    <string>English (AC3) (5.1 ch)</string>
                    <key>AudioTrackGain</key>
                    <real>0</real>
                    <key>AudioTrackName</key>
                    <string></string>
                    <key>AudioTrackQuality</key>
                    <real>-1</real>
                    <key>AudioTrackQualityEnable</key>
                    <false />
                </dict>
            </array>
            <key>ChapterMarkers</key>
            <true />
            <key>Default</key>
            <false />
            <key>FileFormat</key>
            <string>MKV file</string>
            <key>Folder</key>
            <false />
            <key>Mp4HttpOptimize</key>
            <false />
            <key>Mp4LargeFile</key>
            <true />
            <key>Mp4iPodCompatible</key>
            <false />
            <key>PictureAutoCrop</key>
            <true />
            <key>PictureBottomCrop</key>
            <integer>54</integer>
            <key>PictureDeblock</key>
            <integer>4</integer>
            <key>PictureDecomb</key>
            <integer>2</integer>
            <key>PictureDecombCustom</key>
            <string></string>
            <key>PictureDecombDeinterlace</key>
            <true />
            <key>PictureDeinterlace</key>
            <integer>0</integer>
            <key>PictureDeinterlaceCustom</key>
            <string></string>
            <key>PictureDenoise</key>
            <integer>0</integer>
            <key>PictureDenoiseCustom</key>
            <string></string>
            <key>PictureDetelecine</key>
            <integer>2</integer>
            <key>PictureDetelecineCustom</key>
            <string></string>
            <key>PictureKeepRatio</key>
            <true />
            <key>PictureLeftCrop</key>
            <integer>0</integer>
            <key>PictureLooseCrop</key>
            <true />
            <key>PictureModulus</key>
            <string>16</string>
            <key>PicturePAR</key>
            <string>2</string>
            <key>PicturePARHeight</key>
            <integer>27</integer>
            <key>PicturePARWidth</key>
            <integer>32</integer>
            <key>PictureRightCrop</key>
            <integer>0</integer>
            <key>PictureTopCrop</key>
            <integer>58</integer>
            <key>PresetBuildNumber</key>
            <integer>2013060799</integer>
            <key>PresetDescription</key>
            <string></string>
            <key>PresetName</key>
            <string>dvd_mkv</string>
            <key>SubtitleList</key>
            <array>
            </array>
            <key>Type</key>
            <integer>1</integer>
            <key>UsesPictureFilters</key>
            <integer>1</integer>
            <key>UsesPictureSettings</key>
            <integer>2</integer>
            <key>VideoAvgBitrate</key>
            <integer>2000</integer>
            <key>VideoEncoder</key>
            <string>H.264 (x264)</string>
            <key>VideoFramerate</key>
            <string>Same as source</string>
            <key>VideoFramerateMode</key>
            <string>vfr</string>
            <key>VideoGrayScale</key>
            <false />
            <key>VideoQualitySlider</key>
            <real>22</real>
            <key>VideoQualityType</key>
            <integer>2</integer>
            <key>VideoTargetSize</key>
            <integer>700</integer>
            <key>VideoTurboTwoPass</key>
            <true />
            <key>VideoTwoPass</key>
            <true />
            <key>lavcOption</key>
            <string></string>
            <key>x264Option</key>
            <string>bframes=8:b-adapt=2:direct=auto:me=umh:merange=24:partitions=all:rc-lookahead=60:ref=16:subme=10:trellis=2:analyse=all:no-fast-pskip=1:no-dct-decimate=1:filter=-2,-1</string>
        </dict>
    </array>
    </plist>
    ------------------------------------------------
    Quote Quote  
  2. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Search Comp PM
    Can you post the details from the mkv? Or are they also 720x480/576 with 16:9?
    Quote Quote  
  3. Hi,

    I'm guessing this is a really noob question, but: How do I actually answer that?

    When I rip'd the original to .mkv using Handbrake, I turned on:

    Auto Crop
    Loose Crop
    Anamorphic: Loose
    Alignment: 16

    and let it do it's thing. Iiuc, that means it did some resizing.

    I'm reading the Handrake docs right now, trying to figure out if there's a CLI cmd, or some other way, to 'extract' the answer to your question ...

    Ixy

    p.s. In case it's helpful, from my Handbrake GUI 'Summary' tab,

    Code:
    Summary:
    
    Source Picture Paramaters
        Source Codec:       mpeg2video
        Dimensions:         720x480
        Aspect:             16:9
        Frame Rate:         23.976
    
    Cropping
        Autocrop:           on
        Crop:               12.4:0.0
        Crop Dimensions:    720x464
    
    Scaling
        Scale Dimensions:   720x464
        Optimal for Source: On
        Anamorphic:         Loose
    
    Presentation Dimensions:  853x464
    Last edited by ixy; 14th Jun 2013 at 17:27.
    Quote Quote  
  4. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Search Comp PM
    You are cropping and resizing the mkv. You must then add black borders in ffmpeg. But I'm not sure how you do it. Never used it for dvd conversions. I think you should use the pad options.

    See http://ubuntuforums.org/archive/index.php/t-1010648.html


    edit: Or post the details from the mkv using Mediainfo. Not from handbrake. You might just have to use adjust the 16:9 flag in dvdauthor.
    Last edited by Baldrick; 15th Jun 2013 at 05:30.
    Quote Quote  
  5. You didn't specify in what format is the audio (use Mediainfo; correct should be AC3, MP2 or LPCM, and not AAC or MP3) but the video is exactly in DVD NTSC format. Hence the video doesn't need to be re-converted in Handbrake - you lose its original quality. Demux MKV or use copy function in ffmpeg / Handbreak for the video. The process will be also much quicker.
    Quote Quote  
  6. Thanks for the questions -- I'm reading up as I figure out WHAT to read up on!

    You are cropping and resizing the mkv. You must then add black borders in ffmpeg. But I'm not sure how you do it. Never used it for dvd conversions. I think you should use the pad options.

    See http://ubuntuforums.org/archive/index.php/t-1010648.html
    Thanks for the reference. I'll see what the pad options do for me. I have to determine what the target size *should* be.

    edit: Or post the details from the mkv using Mediainfo. Not from handbrake. You might just have to use adjust the 16:9 flag in dvdauthor.
    I hadn't used 'mediainfo' yet. Useful tool, thanks!

    Here's my output for the movie I'm working on:

    Code:
    mediainfo movie.mkv 
    
        General
        Unique ID                                : 25234872348725348723645028374592385297 (0x4D76E0338C2D5F8704A3987E667EE9A4)
        Complete name                            : movie.mkv
        Format                                   : Matroska
        Format version                           : Version 2
        File size                                : 1.17 GiB
        Duration                                 : 2h 3mn
        Overall bit rate                         : 1 166 Kbps
        Writing application                      : HandBrake rev4860
        Writing library                          : libmkv 0.6.5
    
        Video
        ID                                       : 1
        Format                                   : AVC
        Format/Info                              : Advanced Video Codec
        Format profile                           : High@L3.1
        Format settings, CABAC                   : Yes
        Format settings, ReFrames                : 16 frames
        Codec ID                                 : V_MPEG4/ISO/AVC
        Width                                    : 704 pixels
        Height                                   : 352 pixels
        Display aspect ratio                     : 2.35:1
        Original display aspect ratio            : 2.40:1
        Frame rate mode                          : Variable
        Color space                              : YUV
        Chroma subsampling                       : 4:2:0
        Bit depth                                : 8 bits
        Scan type                                : Progressive
        Writing library                          : x264 core 120
        Encoding settings                        : cabac=1 / ref=16 / deblock=1:-2:-1 / analyse=0x3:0x133 / me=umh / subme=10 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=24 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=0 / chroma_qp_offset=-2 / threads=6 / sliced_threads=0 / nr=0 / decimate=0 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=8 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=240 / keyint_min=24 / scenecut=40 / intra_refresh=0 / rc_lookahead=60 / rc=crf / mbtree=1 / crf=22.0 / qcomp=0.60 / qpmin=3 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
        Language                                 : English
        Default                                  : Yes
        Forced                                   : No
        Color primaries                          : BT.601 NTSC
        Transfer characteristics                 : BT.709
        Matrix coefficients                      : BT.601
    
        Audio #1
        ID                                       : 2
        Format                                   : AAC
        Format/Info                              : Advanced Audio Codec
        Format profile                           : LC
        Codec ID                                 : A_AAC
        Duration                                 : 2h 3mn
        Channel(s)                               : 2 channels
        Channel positions                        : Front: L R
        Sampling rate                            : 48.0 KHz
        Compression mode                         : Lossy
        Language                                 : English
        Default                                  : Yes
        Forced                                   : No
    
        Audio #2
        ID                                       : 3
        Format                                   : AC-3
        Format/Info                              : Audio Coding 3
        Mode extension                           : CM (complete main)
        Format settings, Endianness              : Big
        Codec ID                                 : A_AC3
        Duration                                 : 2h 23mn
        Bit rate mode                            : Constant
        Bit rate                                 : 448 Kbps
        Channel(s)                               : 6 channels
        Channel positions                        : Front: L C R, Side: L R, LFE
        Sampling rate                            : 48.0 KHz
        Bit depth                                : 16 bits
        Compression mode                         : Lossy
        Stream size                              : 459 MiB (38%)
        Language                                 : English
        Default                                  : No
        Forced                                   : No
    
        Menu
        00:00:00.000                             : Chapter  1
        ...
    [QUOTE]You didn't specify in what format is the audio (use Mediainfo; correct should be AC3, MP2 or LPCM, and not AAC or MP3) but the video is exactly in DVD NTSC format. Hence the video doesn't need to be re-converted in Handbrake - you lose its original quality. Demux MKV or use copy function in ffmpeg / Handbreak for the video. The process will be also much quicker.[QUOTE]

    I've got two audio tracks -- 2ch AAC & 6ch AC-3. I'd like to convert both to the VIDEO_TS, which is why Avidemux (current release) is not an option.

    I'm not sure about your comment to NOT re-convert ... The end result needs to be in .VOBs -- isn't that a reconversion?
    Quote Quote  
  7. Originally Posted by ixy View Post
    I'm not sure about your comment to NOT re-convert ... The end result needs to be in .VOBs -- isn't that a reconversion?
    Ignore my comment: the first info on your source video looked like it is in DVD format hence it would not need to be converted again to get a DVD - you would need to change container format only (mkv -> vob).

    The report from Mediainfo you posted shows that the video is not in MPEG2 (DVD) format hence it has to be converted. The same concerns audio: AAC to i.e. AC3.

    Have in mind that when you convert your mkvs to DVD you will degrade them, and the files will be much bigger.
    Quote Quote  
  8. to get a DVD - you would need to change container format only (mkv -> vob).
    Got it. The 1st step, mkv->ffmpeg->mpg, does the conversion to mpeg2video

    I did manage to get the size & padding correctly preserved ... adding to ffmpeg options:

    -vf pad="720:480:(ow-iw)/2:(oh-ih)/2"

    appears to work.

    Have in mind that when you convert your mkvs to DVD you will degrade them, and the files will be much bigger.
    In this exercise, the target will be a DVD-R, so as long as the VIDEO_TS fits on that (< 4.7GB), I'm fine.

    As for degrading, I just saw that effect.

    I'd rip'd from the oringinal source with Handbrake @ ConstantQuality = RF22.

    A conversion of the resulting .mkv back to a VIDEO_TS plays, but there's a visible quality degradation. A bit grainy to the eye, AND some ghosting, e.g. around actors' faces.

    I don't know if both of those are artifacts of the dual conversion. I'm trying a test with a higher-quality initial rip, at RF19, and will see what the mkv->ffmpeg->mpg->dvdauthor->video_ts quality looks like.

    Iiuc, the 2nd half of that, mpg->dvdauthor->video_ts, ends up being only a container conversion, since I *am* starting with the mpeg2video format.
    Quote Quote  



Similar Threads

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