Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: [SOLVED] avi widescreen to mpg (w/ffmpeg) = squished screen

  1. #1
    Join Date
    Sep 2006
    Location
    U.S. citizen in Taiwan
    Beans
    114
    Distro
    Ubuntu

    [SOLVED] avi widescreen to mpg (w/ffmpeg) = squished screen

    I have an avi that is widescreen which I need in mpg to make an iso and burn to dvd.
    Problem is, the result is a squished screen for the mpg. Any advice would be appreciated.

    here is the code I used for conversion.

    ffmpeg -i out.avi -y -target ntsc-dvd -sameq -aspect 16:9 out.mpg

    Here is my video info:

    $ ffmpeg -i out.avi
    ...
    Seems stream 0 codec frame rate differs from container frame rate: 23.98 (65535/2733) -> 23.98 (2997/125)
    Input #0, avi, from 'out.avi':
    Duration: 01:53:04.8, start: 0.000000, bitrate: 856 kb/s
    Stream #0.0: Video: mpeg4, yuv420p, 640x272, 23.98 fps(r)
    Stream #0.1: Audio: mp3, 48000 Hz, stereo, 96 kb/s
    Must supply at least one output file

  2. #2
    Join Date
    Sep 2006
    Location
    U.S. citizen in Taiwan
    Beans
    114
    Distro
    Ubuntu

    Re: avi widescreen to mpg (w/ffmpeg) = squished screen

    Okay, I scavenged the net and found nothing to help me.

    I didn't want to have to play around with the settings to
    "experiment," as it takes more than an hour and a half to do the conversion, and that's a painfully slow process.
    However, I took a chance and simply added padding to the ffmpeg command (see below), and I got really very close to a normal picture. Good enough to watch, however, I'm going to try just one more time by setting top and bottom padding to 64 next time. (I haven't actually converted it to an iso and burned it yet)

    Here's what I did
    Code:
    ffmpeg -i out.avi -padtop 60 -padbottom 60 -y -target ntsc-dvd -sameq -aspect 16:9 out2.mpg
    Last edited by ClarkePeters; December 14th, 2008 at 12:59 PM.

  3. #3
    Join Date
    Sep 2006
    Location
    U.S. citizen in Taiwan
    Beans
    114
    Distro
    Ubuntu

    Re: avi widescreen to mpg (w/ffmpeg) = squished screen

    Okay, that was a no go, my dvd player wouldn't read the dvd after I burned it.

    Any advice?

  4. #4
    Join Date
    Nov 2006
    Beans
    1,134

    Re: avi widescreen to mpg (w/ffmpeg) = squished screen

    If your DVD player has MPEG4 + MP3 playback capability (most recent players do), you need not convert anything at all. Just burn the AVI to DVD or CD.

    However, if you want to create a "true" DVD, there are a lot more things to consider besides aspect ratio. Your video must be scaled to 720x480, telecined to 29.97fps and encoded to MPEG-2 (.vob), not MPEG-1 (.mpg). You also have to set up the proper file/folder structure expected by DVD players. This is complex stuff, so I recommend using a DVD authoring tool.

  5. #5
    Join Date
    Sep 2006
    Location
    U.S. citizen in Taiwan
    Beans
    114
    Distro
    Ubuntu

    Re: avi widescreen to mpg (w/ffmpeg) = squished screen

    My DVD doesn't support MPEG-4 or MP3 playback

    I've tried using DVD authoring tools before--the last one being DeVeDe, but it always hangs and others have failed me too (maybe a radeon videocard problem, not sure).

    I've suceeded in the past in making a very basic DVD by simply converting my avi like so:

    Code:
    step1: 
    mencoder -o out.avi -noidx -oac copy -ovc copy /home/rex/in.avi
    
    step2: 
    ffmpeg -i out.avi -y -target ntsc-dvd -sameq -aspect 16:9 out.mpg
    
    step3: 
    dvdauthor --title -o dvd -f out.mpg
    
    step4: 
    dvdauthor -o dvd -T
    
    step5: 
    mkisofs -dvd-video -o /home/rex/dvd/MickeyCC.iso /home/rex/dvd
    
    step6:
    burn iso to dvd (right click the iso file and choose "write to disk")
    It's really easy and never fails. I've just been lucky in the past because my avi's have always scaled well. This it the first time I've tried to burn one of those widescreen avi versions. So at the end of the conversion, the movie works great except every one has a long face and all things appear stretched or squished. If someone could direct me on how to get the right size scaled and the right padding that a standard DVD will accept, then I'd be good to go.

    thanks.

  6. #6
    Join Date
    Sep 2006
    Beans
    3,713

    Re: avi widescreen to mpg (w/ffmpeg) = squished screen

    Try this:
    Code:
    ffmpeg -y -i input.avi -target ntsc-dvd -padtop 104 -padbottom 104 -s 720x272 out.mpg
    I'm not sure if it will work. If you want to keep testing without needing to encode the whole video then use the vframes option. For example "-vframes 300" will encode just the first 300 frames. I also don't think you need sameq with the target option.

  7. #7
    Join Date
    Sep 2006
    Location
    U.S. citizen in Taiwan
    Beans
    114
    Distro
    Ubuntu

    Re: avi widescreen to mpg (w/ffmpeg) = squished screen

    thanks for the heads up on the -vframes options.
    That will save oodles of time.

    I'll give it a try (but now, it's 5am in Taiwan, so I'm heading to bed after an all-nighter of computer programming). Will get back as soon as I can.

  8. #8
    Join Date
    Sep 2006
    Location
    U.S. citizen in Taiwan
    Beans
    114
    Distro
    Ubuntu

    Re: avi widescreen to mpg (w/ffmpeg) = squished screen

    [as I changed to a different avi, the resolution that applies to my information below was 608x256 for the avi file]

    Thanks again to FakeOutdoorsman for the -vframes suggestion. I also discovered that I could do -ss and -t options to compile a specific segment, this way I avoid the opening credits and get straight to the movie at some specific place. For example, to view 60 seconds of movie starting at four minutes into the movie do:
    Code:
     ffmpeg ...  -ss 00:4:00:00  -t 60 ... out.mpg
    After testing, I settled on:

    Code:
    ffmpeg -y -i ScroogeFinney.avi -target ntsc-dvd -s 720x440 -padbottom 20 -padtop 20 out.mpg
    I basically offset the the standard NTSC DVD size (720x480) by the number of pixels in my padding (480-20-20=440) for a 720x440 size. This worked perfectly for my dvd player on the computer but was a little off on the final burn and on my DVD machine (explained later below).

    After the ffmpeg conversion, when I did dvdauthor, it gave me a mass of warnings about frame rate being off or something, and then nothing seemed to be happening but after a bit, it finished up doing it's job. Then I did the final step of the dvdauthor as outlined in the previous post, and then I did mkisofs to make an iso, and then I burned it.

    It almost worked. The adjustment made automatically by dvdauthor made the images automatically cropped left and right on the DVD machine, and the images were still only slightly stretchy, so I think my padding should have been somewhere between 30 and 40 pixels. I'll give it one more shot at around 34 or 36 padding and see how that finally translates. It should be just fine. Actually, the final DVD was watchable, I mean, my wife, who's pretty picky, said the stretching was only slight enough I didn't need to try again, but since this is my favorite movie, I want to get it more precise.

  9. #9
    Join Date
    Sep 2006
    Beans
    3,713

    Re: avi widescreen to mpg (w/ffmpeg) = squished screen

    Try this:
    Code:
    ffmpeg -y -i ScroogeFinney.avi -target ntsc-dvd -s 684x256 -padbottom 112 -padtop 112 -padleft 18 -padright 18 out.mpg
    The video doesn't stretch to 720 because then the vertical resolution would be a fractional value. I suppose you could add the croptop (cropleft, etc) options to get it to properly stretch to 720, but my arithmatic skills suck. You could also just round to the nearest number and hope it looks good:
    Code:
    ffmpeg -y -i ScroogeFinney.avi -target ntsc-dvd -s 720x269 -padbottom 106 -padtop 105 out.mpg

  10. #10
    Join Date
    Sep 2006
    Location
    U.S. citizen in Taiwan
    Beans
    114
    Distro
    Ubuntu

    Re: avi widescreen to mpg (w/ffmpeg) = squished screen

    thanks FakeOutdoorsman.

    I settled on padding top and bottom at 36. I don't mind losing the outside edges of the movie. It plays just fine.

    Code:
    ffmpeg -y -i ScroogeFinney.avi -target ntsc-dvd -s 720x410 -padbottom 36 -padtop 34 out.mpg

    thanks again.

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •