[olug] Video conversion question.

Dan Linder dan at linder.org
Wed Dec 1 22:07:24 UTC 2010


Ok, that conversion seems to have worked!  The kids can now watch the video
using the Roku!  Yay!

As a second test, I needed to convert some other videos (mpeg4 video, and
pcm_s16le audio) so I wrote this script:
    #!/bin/sh
    FILE=$1
    BASENAME=$( echo $FILE | perl -ne 's/(.*)\.//g; print $1' )
    ffmpeg -i ${FILE} -vcodec libx264 -vpre default -crf 22 -acodec libfaac
-ab 128k ${BASENAME}-AAC.m4v

I got a lot of hints from this site:
  http://rob.opendot.cl/index.php/useful-stuff/ffmpeg-x264-encoding-guide/

The "BASENAME" line just strips off the "extension"; the real magic happens
on the ffmpeg line.

Question:
 * My test videos I've converted are all 720x480 (standard def) videos.
 Using the "-vpre default" seems ok, but will it have a detrimental effect
on any videos that are 16:9 or other aspect ratios?

Here's the libx264-default.ffpreset in my ~/.ffmpeg directory:
cat -n /home/linder/.ffmpeg/libx264-default.ffpreset
     1  coder=1
     2  flags=+loop
     3  cmp=+chroma
     4  partitions=+parti8x8+parti4x4+partp8x8+partb8x8
     5  me_method=hex
     6  subq=7
     7  me_range=16
     8  g=250
     9  keyint_min=25
    10  sc_threshold=40
    11  i_qfactor=0.71
    12  b_strategy=1
    13  qcomp=0.6
    14  qmin=10
    15  qmax=51
    16  qdiff=4
    17  bf=3
    18  refs=3
    19  directpred=1
    20  trellis=1
    21  flags2=+mixed_refs+wpred+dct8x8+fastpskip+mbtree
    22  wpredp=2

Thanks,
Dan

On Wed, Dec 1, 2010 at 13:57, Dan Linder <dan at linder.org> wrote:

> Aahh, I think I answered my own question.  After some searching I found
> that I needed the Medibuntu repository as documented in this URL:
>     http://ubuntuforums.org/showthread.php?t=1117283
>
> <http://ubuntuforums.org/showthread.php?t=1117283>Then I had to change the
> encoder to use from "aac" to "libfaac" like this:
>     ffmpeg -i Schoolhouse_Rock_Disc1.m4v -vcodec copy -acodec libfaac -ab
> 128k Schoolhouse_Rock_Disc-AAC.m4v
>
> It's currently encoding it - here's what ffmpeg says about this new file:
> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Schoolhouse_Rock_Disc-AAC.m4v':
>   Duration: 00:19:46.36, start: 0.000000, bitrate: 2905 kb/s
>     Stream #0.0(und): Video: h264, yuv420p, 704x480, 29.97 tbr, 90k tbn,
> 180k tbc
>     Stream #0.1(eng): Audio: aac, 48000 Hz, stereo, s16
>
> I'll re-encode and see what the file sounds like...that'll be a while. :-)
>
> Dan
>
> On Wed, Dec 1, 2010 at 11:29, Dan Linder <dan at linder.org> wrote:
>
>> I think that's close, but when I run this command:
>>
>> ffmpeg -i Schoolhouse_Rock_Disc1.m4v -vcodec copy -acodec aac -ab 128k
>> Schoolhouse_Rock_Disc-AAC.m4v
>>
>> I get this output:
>> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Schoolhouse_Rock_Disc1.m4v':
>>   Duration: 02:19:07.43, start: 0.-66733, bitrate: 2986 kb/s
>>     Stream #0.0(und): Video: h264, yuv420p, 704x480, PAR 57:64 DAR
>> 209:160, 29.97 tbr, 90k tbn, 180k tbc
>>     Stream #0.1(eng): Audio: aac, 48000 Hz, stereo, s16
>>     Stream #0.2(eng): Audio: ac3, 48000 Hz, stereo, s16
>>     Stream #0.3(und): Subtitle: text / 0x74786574
>> Unknown encoder 'aac'
>>
>> Note the last line: Unknown encoder 'aac'
>>
>> Am I missing something else?  I've installed libfaac0, faac, faad, and
>> libfaad0 but still get the Unknown encoder error.  I'm running Ubuntu 10.04.
>>
>> Dan
>>
>> On Wed, Dec 1, 2010 at 10:29, Phil Brutsche <phil at brutsche.us> wrote:
>>
>>> Hypothetically ffmpeg can do everything you ask. I've not used it in
>>> exactly the way you want, but I've used it to transcode MP3s into AACs
>>> (aka M4A).
>>>
>>> Something like this might work:
>>>
>>> ffmpeg -i <input file> -vcodec copy -acodec aac -ab 128k <output file>
>>>
>>> On 12/1/2010 10:13 AM, Dan Linder wrote:
>>> > I've been working on converting my DVDs to Mpeg4 video files for quite
>>> a
>>> > while.  I recently bought a Roku box to play with, and installed the
>>> > community "MyMedia" app (channel) - this allows the Roku to access a
>>> server
>>> > via a Python-based web server and play media.  The Roku is picky, and
>>> only
>>> > likes H264 video, and the "AAC (faac)" audio (not AC3 or MP3), but I
>>> finally
>>> > got Handbrake to rip and save this combination.
>>> >
>>> > My question is this:
>>> > Is there a command line tool I can use to re-encode just the audio
>>> portion
>>> > into AAC?  I think some of my past encodings had multiple audiotracks
>>> > encoded, so it may be a matter of just re-ordering the audio or
>>> stripping
>>> > out the AC3/MP3 stream so the Roku box can see it.
>>>
>>> --
>>>
>>> Phil Brutsche
>>> phil at brutsche.us
>>> _______________________________________________
>>> OLUG mailing list
>>> OLUG at olug.org
>>> https://lists.olug.org/mailman/listinfo/olug
>>>
>>
>>
>>
>> --
>> ***************** ************* *********** ******* ***** *** **
>> "Quis custodiet ipsos custodes?"
>>     (Who can watch the watchmen?)
>>     -- from the Satires of Juvenal
>> "I do not fear computers, I fear the lack of them."
>>     -- Isaac Asimov (Author)
>> ** *** ***** ******* *********** ************* *****************
>>
>
>
>
> --
> ***************** ************* *********** ******* ***** *** **
> "Quis custodiet ipsos custodes?"
>     (Who can watch the watchmen?)
>     -- from the Satires of Juvenal
> "I do not fear computers, I fear the lack of them."
>     -- Isaac Asimov (Author)
> ** *** ***** ******* *********** ************* *****************
>



-- 
***************** ************* *********** ******* ***** *** **
"Quis custodiet ipsos custodes?"
    (Who can watch the watchmen?)
    -- from the Satires of Juvenal
"I do not fear computers, I fear the lack of them."
    -- Isaac Asimov (Author)
** *** ***** ******* *********** ************* *****************



More information about the OLUG mailing list