VideoHelp Forum




+ Reply to Thread
Results 1 to 6 of 6
  1. I have several years worth of standard definition videos which ffmpeg -i tells me have the following charactaristics:

    Input #0, avi, from '<file name>.avi':
    Duration: 00:48:06.08, start: 0.000000, bitrate: 30336 kb/s
    Stream #0.0: Video: dvvideo, yuv420p, 720x576, 28800 kb/s, PAR 59:54 DAR 295:216, 25 tbr, 25 tbn, 25 tbc
    Stream #0.1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s

    On Centos, mplayer plays these fine (although vlc doesn't). I've recently bought a WD Media layer that plays my newer HD m2t files, but won't play these SD files. So, I thought, I just need to recode the files to some sort of mpeg format. Well, that sort of works, but the quality is very poor - much poorer than just watching the videos with mplayer.

    I've read loads, and understood very little of the process. A simple use of ffmpeg produces a very poor result:

    ffmpeg -i <filename>.avi <filename>.mpg

    Sadly I've not been able to improve on this with mencoder either.

    Any suggestions as to what I should be doing?
    Quote Quote  
  2. Always Watching guns1inger's Avatar
    Join Date
    Apr 2004
    Location
    Miskatonic U
    Search Comp PM
    As you have a WDTV, I would suggest H264 instead of mpeg. You will get better quality for lower file sizes. Xvid4PSP 5.37 or Xmedia Recode should be able to do this easily. If you want to go for MPEG then I would suggest AVStoDVD, but output to a program stream (MPG file) instead of an authored DVD.
    Read my blog here.
    Quote Quote  
  3. Member
    Join Date
    Oct 2010
    Location
    England
    Search Comp PM
    Originally Posted by kakapodoesvideo View Post
    I've read loads, and understood very little of the process. A simple use of ffmpeg produces a very poor result:

    ffmpeg -i <filename>.avi <filename>.mpg
    Although Western Digital list the supported video formats here:
    WD HD Media Players compatible media types
    They don't go into much detail about the options/parameters for specific codecs.

    This should give a decent quality (h264 video, aac audio):
    ffmpeg -i input.avi -acodec aac -ab 256 -vcodec libx264 -vpre slower -crf 16 output.mp4
    Experiment on a short video clip to check for compatibility and quality.

    The only option you should need to change is -crf:
    - A lower value will give better quality and higher bitrate
    - A higher value gives worse quality and a lower bitrate.

    Experiment with the values until you reach a quality/bitrate compromise that you're happy with.

    This guide gives information about the various x264 parameters for ffmpeg:
    http://sites.google.com/site/linuxencoding/x264-ffmpeg-mapping
    Quote Quote  
  4. he's starting with dv - shouldn't you deinterlace/bob or flag interlaced encoding if you want to keep it interlaced? (not sure if wdtv deinterlaces h.264 streams, but it should support interlaced mpeg2, and I think you're not limited to dvd bitrates)

    I think some newer ffmpeg precompiled builds have yadif support if you wanted to deinterlace


    If you wanted to preserve interlace for mpeg2: e.g.:

    ffmpeg -i input.avi -vcodec mpeg2video -b <video_bitrate> -flags +ildct+ilme -acodec ac3 -ab 384k -f vob output.mpg

    instead of -b you can use quantizer encoding eg. -qscale 2 (or some other value, lower is better quality, bigger filesize) . I would actually do it this way unless you needed a specific file size

    -top 1 would indicate top field first, but DV is always bottom field first, so I think you can leave it out


    Not sure how to do it for x264 with ffmpeg, in the CLI version --bff would enable interlaced encoding (and bottom field first) . That guide in the link above says --interlaced but I'm not sure how to flag field order for x264 with ffmpeg or if even wdtv supports interlaced h.264
    Last edited by poisondeathray; 1st Dec 2010 at 15:29.
    Quote Quote  
  5. Member
    Join Date
    Oct 2010
    Location
    England
    Search Comp PM
    Originally Posted by poisondeathray View Post
    he's starting with dv - shouldn't you deinterlace/bob or flag interlaced encoding if you want to keep it interlaced?
    You're right, '-flags +ildct' needs to be added to encode x264 as interlaced. However, I can't see a way to specify the field order, so the feature might not be properly implemented. I think x264 supports different field orders, but there isn't a way to set it from ffmpeg.
    The video should probably be deinterlaced when encoding to x264 with ffmpeg.

    Originally Posted by poisondeathray
    I think some newer ffmpeg precompiled builds have yadif support if you wanted to deinterlace
    That's correct, although I noticed differences between mplayer's yadif and ffmpeg's implementation; the latter showed slight aliasing around sharp areas of the image. Not sure if it's a bug, or a deliberate design decision.

    ffmpeg -i input.avi -acodec libmp3lame -ab 256 -vcodec libx264 -vf yadif=0 -vpre slower -crf 16 output.mp4
    *also, aac audio brings up an error for me - so I've switched to libmp3lame.

    (not sure if wdtv deinterlaces h.264 streams, but it should support interlaced mpeg2, and I think you're not limited to dvd bitrates)
    mpeg2 might be a better option for now.
    Quote Quote  
  6. Originally Posted by intracube View Post
    Originally Posted by poisondeathray View Post
    he's starting with dv - shouldn't you deinterlace/bob or flag interlaced encoding if you want to keep it interlaced?
    You're right, '-flags +ildct' needs to be added to encode x264 as interlaced. However, I can't see a way to specify the field order, so the feature might not be properly implemented. I think x264 supports different field orders, but there isn't a way to set it from ffmpeg.
    The video should probably be deinterlaced when encoding to x264 with ffmpeg.
    I edited my post above, it's --bff or --tff in the x264 CLI version , I don't know if it's the same in the ffmpeg x264 version

    For HD MPEG2 encoding with batch scripts with ffmpeg, I used -top 1 for TFF so -top 0 should be BFF (or leave it out I think would default) (HD streams are almost always TFF, but DV-AVI almost always BFF)

    Originally Posted by poisondeathray
    I think some newer ffmpeg precompiled builds have yadif support if you wanted to deinterlace
    That's correct, although I noticed differences between mplayer's yadif and ffmpeg's implementation; the latter showed slight aliasing around sharp areas of the image. Not sure if it's a bug, or a deliberate design decision.

    ffmpeg -i input.avi -acodec libmp3lame -ab 256 -vcodec libx264 -vf yadif=0 -vpre slower -crf 16 output.mp4
    *also, aac audio brings up an error for me - so I've switched to libmp3lame.
    AAC was removed from precompiled builds about a year ago (licensing issues)
    Quote Quote  



Similar Threads

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