Results 1 to 9 of 9

Thread: video format conversion

  1. #1
    Join Date
    Apr 2009
    Location
    Spain
    Beans
    346
    Distro
    Lubuntu 14.04 Trusty Tahr

    video format conversion

    Hi,

    I am trying to convert an mp4 video to avi using mencoder and the following code:

    Code:
    mencoder <input.mp4> -ovc xvid -oac mp3lame -lameopts cbr:br=192 -xvidencopts pass=1 -o /dev/null
    mencoder <input.mp4> -ovc xvid -oac mp3lame -lameopts cbr:br=192 -xvidencopts pass=2:bitrate=-700000 -o <output.avi>
    found here: http://ubuntuguide.org/wiki/Video_Co...h_Xvid_.2F_MP3

    However, I am told:

    Code:
    robert@robert-desktop:~$ </home/robert/Videos/TheBigSleep.mp4> -ovc xvid -oac mp3lame -lameopts cbr:br=192 -xvidencopts pass=1 -o /dev/null
    No command 'xvid' found, did you mean:
     Command 'xvic' from package 'vice' (multiverse)
    xvid: command not found
    robert@robert-desktop:~$ mencoder </home/robert/Videos/TheBigSleep.mp4> -ovc xvid -oac mp3lame -lameopts cbr:br=192 -xvidencopts pass=1 -o /dev/null
    File not found: 'xvid'
    Failed to open xvid.
    Am I doing something wrong, or is there something wrong with the above commands?

    Many thanks.

  2. #2
    Join Date
    Jul 2006
    Location
    Lancashire
    Beans
    Hidden!
    Distro
    Ubuntu 11.04 Natty Narwhal

    Re: video format conversion

    Quote Originally Posted by rdh61 View Post
    Am I doing something wrong...
    Hi
    This part is wrong:-
    Code:
    </home/robert/Videos/TheBigSleep.mp4>
    Use "" quotes instead:-
    Code:
    "/home/robert/Videos/TheBigSleep.mp4"
    And here also:-
    Code:
    <output.avi>
    Code:
    "output.avi"
    Last edited by ron999; December 15th, 2012 at 03:43 PM.

  3. #3
    Join Date
    Dec 2006
    Beans
    6,984

    Smile Re: video format conversion

    I routinely convert mp4 videos, usually with h.264 and aac, to avi for my wife's TV. But FFmpeg does a better job and I use the following commandline with a recent git FFmpeg:

    Code:
    ffmpeg -y -i "input.mp4" -threads auto \
    -c:v mpeg4 -q:v 5 -vtag XVID -f avi -mbd rd -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2 -g 300 \
    -c:a libmp3lame -ac 2 -q:a 3 -ar 44100 \
    "output.avi"
    Obviously the input and output filenames need to be changed . Works nicely on her television and she is happy...
    You think that's air you're breathing now?

  4. #4
    Join Date
    Sep 2006
    Beans
    3,503

    Re: video format conversion

    I believe "-threads auto" is an old alias for "-threads 0", and I think those values may only work for libx264. I'm not sure if mpeg4 can use "-threads", but if it does you would probably have to manually declare a value. I think... I can't test now because I'm away from my computer and my graybeard laptop just retired.

  5. #5
    Join Date
    Dec 2006
    Beans
    6,984

    Re: video format conversion

    Thanks for that, I will experiment a little...
    You think that's air you're breathing now?

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

    Re: video format conversion

    I guess I was wrong. That's what happens when I rely on memory. However, I don't get a significant difference between using "-threads auto" and omitting it, and "-threads 1" is significantly slower, so maybe "-threads auto" is default for this encoder too.

    I didn't look at the code.

  7. #7
    Join Date
    Dec 2006
    Beans
    6,984

    Re: video format conversion

    Becomes a little academic for me anway at the moment as I am back on my little dual core laptop having again temporarily shelved the 8 core monster. But good to know with certainty anyway...
    You think that's air you're breathing now?

  8. #8
    Join Date
    Apr 2009
    Location
    Spain
    Beans
    346
    Distro
    Lubuntu 14.04 Trusty Tahr

    Re: video format conversion

    Thanks ron999. Now the conversion carries through successfully. (Thanks to others too). I'm marking the thread solved now.

  9. #9
    Join Date
    Dec 2006
    Beans
    6,984

    Re: video format conversion

    Like an old dog I am still worrying away at the -threads = xx bone . I used a 4.5gig dvd dump with mpeg2video and tested mpeg4 conversions using time (explanatory notes for time here). This is on my 8 core AMD 8350, FFmpeg achieved 280-290fps with each conversion, although -threads 4 dipped to 220fps:

    First with -threads auto:

    Code:
    time ffmpeg -y -i "fist.vob" -threads auto \
    -c:v mpeg4 -q:v 5 -vtag XVID -f avi -mbd rd -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2 -g 300 \
    -an \
    "test.avi"
    
    real	8m42.082s
    user	39m1.545s
    sys	0m19.407s
    Then with -threads 0:

    Code:
    time ffmpeg -y -i "fist.vob" -threads 0 \
    -c:v mpeg4 -q:v 5 -vtag XVID -f avi -mbd rd -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2 -g 300 \
    -an \
    "test.avi"
    
    real	8m43.592s
    user	38m51.965s
    sys	0m17.657s
    Then with -threads 8:

    Code:
    time ffmpeg -y -i "fist.vob" -threads 8 \
    -c:v mpeg4 -q:v 5 -vtag XVID -f avi -mbd rd -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2 -g 300 \
    -an \
    "test.avi
    
    real	9m13.346s
    user	38m21.514s
    sys	0m17.100s
    Then with -threads 4:

    Code:
    time ffmpeg -y -i "fist.vob" -threads 4 \
    -c:v mpeg4 -q:v 5 -vtag XVID -f avi -mbd rd -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2 -g 300 \
    -an \
    "test.avi"
    
    real	11m38.241s
    user	35m7.485s
    sys	0m15.309s
    This is good demonstration of a multi-core cpu at work (user and sys time greatly exceeding real time) and probably also shows that the -threads option does have some influence on encoding time with -threads auto being the most efficient. for this conversion, with these codecs and with my computer.... lots of variables there .

    Now to spend some time in the big blue room...
    Last edited by andrew.46; December 31st, 2012 at 11:03 PM.
    You think that's air you're breathing now?

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
  •