VideoHelp Forum




+ Reply to Thread
Results 1 to 6 of 6
  1. Member
    Join Date
    Nov 2012
    Location
    Lombardy. Italy
    Search Comp PM
    Hello fellows,
    I'd like to know if there's some way to convert an .avi file video to a .mp4 file with ffmpeg withe ~ the same quality.

    Now, the .avi file which I'd like to convert is mpeg4 encoded not Divx or Xvid and I think this would make things easier.
    Anyway these are the specification of the file:

    Code:
     Metadata:
        encoder         : Some super fast AVI muxer 
      Duration: 00:21:11.78, start: 0.000000, bitrate: 1154 kb/s
        Stream #0.0: Video: mpeg4, yuv420p, 624x352 [PAR 1:1 DAR 39:22], 23.98 tbr, 23.98 tbn, 23.98 tbc
        Stream #0.1: Audio: mp3, 48000 Hz, stereo, s16, 160 kb/s
    I'd like to re-encode it in H264 with ACC sound while keeping approximately the same video quality although the file size will certainly increase.
    Thank you for your time!
    Quote Quote  
  2. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Search Comp PM
    I would try convert with x264(=h264 encoder) constant rate/quality/quantizer factor with around 20(decrease for better quality/bigger file size) and 128k aac audio.

    Code:
    ffmpeg -i input.avi -c:v libx264 -preset slow -crf 22 -c:a libfaac -b:a 128k output.mp4

    See http://ffmpeg.org/trac/ffmpeg/wiki/x264EncodingGuide for more examples.


    But do you really have to convert? Many devices supports avi divx/xvid/mpeg4 fine.
    Last edited by Baldrick; 8th Nov 2012 at 14:29.
    Quote Quote  
  3. Member
    Join Date
    Nov 2012
    Location
    Lombardy. Italy
    Search Comp PM
    Thank you for your answer Baldrick.

    I've tried your solution but it returns me:
    Code:
    Unrecognized option 'c:v'
    Also, I think I don't have installed the libfaac and I don't know how to retrieve it.

    But do you really have to convert? Many devices supports avi divx/xvid/mpeg4 fine.
    Well, although is not necessary for me to convert in order to play this kind of video, I like to keep all my video files organized with metadata which I can only include in a .mp4 file container.

    Any other suggestion? thanks again!
    Quote Quote  
  4. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Search Comp PM
    YOu could just try remux to a mp4 with ffmpeg. No reconversion.

    Code:
    ffmpeg -i input.avi -acodec copy -vcodec copy output.mp4

    And for the c:v options I guess you need a newer ffmpeg version, http://ffmpeg.zeranoe.com/builds/ . But just the remux with acodec vcodec should work your current ffmpeg version.
    Quote Quote  
  5. Member
    Join Date
    Nov 2012
    Location
    Lombardy. Italy
    Search Comp PM
    Originally Posted by Baldrick View Post
    YOu could just try remux to a mp4 with ffmpeg. No reconversion.

    Code:
    ffmpeg -i input.avi -acodec copy -vcodec copy output.mp4

    And for the c:v options I guess you need a newer ffmpeg version, http://ffmpeg.zeranoe.com/builds/ . But just the remux with acodec vcodec should work your current ffmpeg version.
    Thank you again.
    My version of ffmpeg is the 0.07.13 installed via MacPorts on OSX Lion.

    It seems to be the most updated version for OSX systems.
    I've tried to convert my file with your suggested command but all I have is an .mp4 with lower fps and no sound...

    I think another solution could be use Hanbrake using ~ the same average bitrate.
    Is there other solutions to convert an .avi file to .mp4 maintaining ~ the same quality other than that?

    Thanks!
    Quote Quote  
  6. Here is the deal. If for example you were to specify a target video size you could on average specify something 40% smaller than than avi for the video portion and get the same subjective visual quality. So lets say your avi had a video bit rate of 1200 kbs. You might try re-encoding the video to 720 kbs. The problem is both mpeg4 and h264 are lossy compressions. Meaning the number of artifacts add. The 60% reduction only works if you can go back to the original source. If you already have mpeg4 encoded video layer, then any re-encoding will only make it worse. So you options are you pick a high enough quality factor that you don't notice the additional problems, or you don't re-encode. A quality factor of 20 tends to work well, as that is a level well most people don't notice the artifacts introduced by compression. Thus when you convert your video you will only notice the original mpeg4 defects.
    Quote Quote  



Similar Threads

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