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?
+ Reply to Thread
Results 1 to 6 of 6
-
-
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.
-
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 -
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.264Last edited by poisondeathray; 1st Dec 2010 at 15:29.
-
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
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) -
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
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.
Similar Threads
-
Free software to split large MPEG-PS file into many small MPEG-PS files?
By videonewbie22 in forum Newbie / General discussionsReplies: 9Last Post: 5th Jul 2018, 19:16 -
How to convert just top/bot field of an interlaced mpeg-2 video to mpeg-1 ?
By vahid in forum Video ConversionReplies: 4Last Post: 19th Oct 2010, 02:26 -
No audio when saving .MPEG file from VOB stream using MPEG Streamclip?
By Bix in forum MacReplies: 3Last Post: 25th Jul 2010, 17:12 -
Stream an MPEG file over UDP as MPEG-TS and convert back to MPEG.
By Tengil123 in forum Video Streaming DownloadingReplies: 0Last Post: 27th Nov 2009, 04:40 -
Mpeg Streamclip and Final Cut Pro .mpeg...Only 1 hour clips?
By checksum in forum MacReplies: 10Last Post: 16th Dec 2008, 23:38