WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Media codecs - what's best for size and almost-loss-less?  (Read 1876 times)

Offline CentralWare

  • Administrator
  • Hero Member
  • *****
  • Posts: 1652
Media codecs - what's best for size and almost-loss-less?
« on: March 18, 2015, 02:22:32 PM »
I have a huge video collection ranging from VOB/ISO images to mpg/mp2/flv/3gp/etc. and I'm unsure which direction I should turn.
This entire library is about to be ripped into a singular encoding, but I'd love to hear everyone's experience as to what they prefer.

Goal(s):
1) Avoid "licensed" formats such as mpeg-2
2) As "lossless" as possible without adding exponentially to the file size
3) Something ffmpeg "knows" without tinkering with plug-ins
4) A format which XBMC also knows without further plug-ins
     (If XBMC supports it, then VLC will likely support it natively as well.)
5) Most importantly a codec which isn't known to botch audio/video sync from the originals.

I'm planning to script the conversions using ffmpeg; example command-lines are welcome and requested for things which are tried and tested! :)

Output: I'm aiming for 720p minimal, but would prefer to keep the source's original screen resolution unless it falls below 720.  (I used to have a few cameras/phones which recorded 640x480 video so those specific videos will be up-scaled.)  Audio does not need to be re-encoded unless the codec in question would need to have it done to keep the video and audio in sync.  Key frames...  no promises the sources have many, if any, in some instances.

TIA!
Over 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Offline coreplayer2

  • Hero Member
  • *****
  • Posts: 3020
Re: Media codecs - what's best for size and almost-loss-less?
« Reply #1 on: March 19, 2015, 10:33:32 PM »
You have some old video files there and honestly I advise against attempting to upscale any of the smaller resolution formats, especially the 3gp, flash, etc etc

If you insist on stitching together an old VOB collection into a single container then ok I understand that, but to recode an already encoded mpeg2 (ie not raw footage) of such low resolution (720p) and bit rate is not recommended, however if you must...   you can't do better than use x.264 encoder, today is the standard and most supported resulting H264 video.

low quality video will not thank you for re-encoding which looses quality and brightness in the process.  I would leave the resolution alone and standardize the container which is compatible with the intended movie players.   MKV and MP4 come to mind as the the commonly used therefore compatible with most modern players you choose to watch the movies with.

join the mp2 files together dumping their VOB container is a good plan, I'd recommend mp4 and/or MKV container (MKV for where you want to keep the dolby digital audio)

x.264 is an awesome video encoder if you're insistent on recoding, or are simply
downgrading resolution for small devices 

See wiki for ffmpeg encoding and lossless complications https://trac.ffmpeg.org/wiki/Encode/H.264
See VideoLan for x264 codec http://www.videolan.org/developers/x264.html
You might like Handbrake https://trac.handbrake.fr/wiki/HandBrakeGuide

We are limited by source files quality and destination players/monitors.   You'll need to decide on possible future equipment these videos will be stored on and ultimately played on before deciding on codec's and profiles to use.

MKV container would be the most compatible for your source files including multichannel audio.
however I would go for an mp4 container with H264 video, 30 frames per second (or 60 if compatible with your most modern hardware and players), High Profile level 4.2 with AAC-LC audio up to 160 Kbps, 48kHz, stereo audio being the most hardware and player compatible (even the ipad mini)..

Unless you have HD multichannel Audio that you'd like to preserve,  i'd go with aac for all your audio (btw aac also has multichannel and high bitrate profiles which you might try)..

I'd re-encode a few movies and try them on all possible playback devices before settling on containers and codecs

Your modern monitor likely up-scales for you but I'd never consider up-scaling during re-encoding, as a rule only downgrade resolution.

good luck




 
« Last Edit: March 19, 2015, 10:48:28 PM by coreplayer2 »

Offline CentralWare

  • Administrator
  • Hero Member
  • *****
  • Posts: 1652
Re: Media codecs - what's best for size and almost-loss-less?
« Reply #2 on: March 29, 2015, 01:34:44 PM »
@coreplayer2: The resolution I want to keep intact in "most" cases, so there's not a big issue there.

Devices: I'm considering RasPi, tablets (droid) and PCs.  VideoLan (VLC) plays most everything flawlessly on a PC, but isn't well supported on the other two platforms.  RasPi has hardware acceleration (if I'm reading correctly) built in for MP4 without special licensing, so I'm leaning in that direction.  Most of the tablets here have some means or another of software decoding for MP4 so we should be good there.

Sources: Most of the VOB based archive I either have backed up or burned, so the originals will be kept locked away allowing hit-or-miss trials.  The largest problem we've come across is with media players (such as the Lacie Mini HD) which seem to choke on MP4 shortly into the video where video and audio do not remain in sync.  (They START fine, just don't stay that way.)

The first set of tests (which should launch next week) will likely be set up with just using "copy" as video and audio settings, possibly/likely MP4 as the container and see how that pans out.  The majority of my FLV files are 720p or higher (FLV was chosen so they could easily be copied to a web server to serve to family, etc. such as my son's "graduation" ceremony from Pre-school...  what'll they think of next??)  The 3G files, though, are phone related, a little less quality (even for a 5mp camera) but it was my first "3D" camera, so the number of supported codecs on the HTC models of the time were limited.  The "3D" fad died quickly, so most of the videos are standard and those that were 3D have already been manually recorded to standard.

Goal: I want to put together a pair of DLNA servers (Twonky, MiniDLNA, etc.) where video files are separated between "home movies" (which will also contain entertainment flicks) and a machine for work related video files.  I just need to ensure that which ever direction is taken, the container/codec is also stream-friendly without having to be re-encoded on the fly.

If you see any sore spots in the details above, please elaborate!  Thanks!
Over 90% of all computer problems can be traced back to the interface between the keyboard and the chair