Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: avconv mov to flv

  1. #1
    Join Date
    Oct 2010
    Location
    The United States
    Beans
    843
    Distro
    Ubuntu

    avconv mov to flv

    Hi Guys,

    I've been using ffmpeg to convert both .avi and .mov files to .flv files which I put on a website. (These are just home movies.)

    Today I noticed a blurb fly by after I entered the alias from my .Bash_aliases file into the terminal. The blurb said that I should use avconv, so I thought I'd give it a shot.

    Well I can convert .mp4 files just fine using:
    Code:
    avconv -i foo.mp4 -s 320x240 -ar 22050 bar.flv
    but if I use:
    Code:
    avconv -i foo.mov -s 320x240 -ar 22050 bar.flv
    with .mov files shot on an iPhone, the resulting flash video is elongated.

    so I tried
    Code:
    avconv -i foo.mov -ar 22050 bar.flv
    and the resulting flash video is jerky.

    Does anyone have any recommendations?

    I appreciate the help.
    Thank you,
    GG -----------

  2. #2
    Join Date
    Dec 2006
    Beans
    7,349

    Re: avconv mov to flv

    Can you post the full command and terminal output from the command that does not resize the video? As an aside I should mention that there would not be any problem using FFmpeg itself particularly if you used a modern version of it:

    Compile FFmpeg on Ubuntu
    https://ffmpeg.org/trac/ffmpeg/wiki/...mpilationGuide

    Highly recommended if you are a serious video converter...
    You think that's air you're breathing now?

  3. #3
    Join Date
    Oct 2010
    Location
    The United States
    Beans
    843
    Distro
    Ubuntu

    Question Re: avconv mov to flv

    I tried again going from a .mov file from the iPhone to Flash. Below is the command and terminal output:

    Code:
    $ avconv -i foo.mov -s 320x240 -ar 22050 bar.flv
    avconv version 0.8.4-4:0.8.4-0ubuntu0.12.04.1, Copyright (c) 2000-2012 the Libav developers
      built on Nov  6 2012 16:50:25 with gcc 4.6.3
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'foo.mov':
      Metadata:
        major_brand     : qt  
        minor_version   : 0
        compatible_brands: qt  
        creation_time   : 2012-12-31 13:19:43
      Duration: 00:00:38.80, start: 0.000000, bitrate: 5341 kb/s
        Stream #0.0(und): Video: h264 (Baseline), yuv420p, 960x540, 5235 kb/s, 30 fps, 30 tbr, 600 tbn, 1200 tbc
        Metadata:
          creation_time   : 2012-12-31 13:19:43
        Stream #0.1(und): Audio: aac, 44100 Hz, stereo, s16, 110 kb/s
        Metadata:
          creation_time   : 2012-12-31 13:19:43
    [buffer @ 0x8ed9160] w:960 h:540 pixfmt:yuv420p
    [scale @ 0x8ed5ee0] w:960 h:540 fmt:yuv420p -> w:320 h:240 fmt:yuv420p flags:0x4
    Output #0, flv, to 'bar.flv':
      Metadata:
        major_brand     : qt  
        minor_version   : 0
        compatible_brands: qt  
        creation_time   : 2012-12-31 13:19:43
        encoder         : Lavf53.21.0
        Stream #0.0(und): Video: flv, yuv420p, 320x240, q=2-31, 200 kb/s, 1k tbn, 30 tbc
        Metadata:
          creation_time   : 2012-12-31 13:19:43
        Stream #0.1(und): Audio: libmp3lame, 22050 Hz, stereo, s16, 200 kb/s
        Metadata:
          creation_time   : 2012-12-31 13:19:43
    Stream mapping:
      Stream #0:0 -> #0:0 (h264 -> flv)
      Stream #0:1 -> #0:1 (aac -> libmp3lame)
    Press ctrl-c to stop encoding
    frame= 1162 fps= 80 q=3.9 Lsize=    1910kB time=38.73 bitrate= 403.9kbits/s    
    video:1109kB audio:759kB global headers:0kB muxing overhead 2.238796%
    In the second test I removed the dimensions from the command.
    Code:
    $ avconv -i foo.mov -ar 22050 bar.flv
    avconv version 0.8.4-4:0.8.4-0ubuntu0.12.04.1, Copyright (c) 2000-2012 the Libav developers
      built on Nov  6 2012 16:50:25 with gcc 4.6.3
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'foo.mov':
      Metadata:
        major_brand     : qt  
        minor_version   : 0
        compatible_brands: qt  
        creation_time   : 2012-12-31 13:19:43
      Duration: 00:00:38.80, start: 0.000000, bitrate: 5341 kb/s
        Stream #0.0(und): Video: h264 (Baseline), yuv420p, 960x540, 5235 kb/s, 30 fps, 30 tbr, 600 tbn, 1200 tbc
        Metadata:
          creation_time   : 2012-12-31 13:19:43
        Stream #0.1(und): Audio: aac, 44100 Hz, stereo, s16, 110 kb/s
        Metadata:
          creation_time   : 2012-12-31 13:19:43
    [buffer @ 0x9789160] w:960 h:540 pixfmt:yuv420p
    Output #0, flv, to 'bar.flv':
      Metadata:
        major_brand     : qt  
        minor_version   : 0
        compatible_brands: qt  
        creation_time   : 2012-12-31 13:19:43
        encoder         : Lavf53.21.0
        Stream #0.0(und): Video: flv, yuv420p, 960x540, q=2-31, 200 kb/s, 1k tbn, 30 tbc
        Metadata:
          creation_time   : 2012-12-31 13:19:43
        Stream #0.1(und): Audio: libmp3lame, 22050 Hz, stereo, s16, 200 kb/s
        Metadata:
          creation_time   : 2012-12-31 13:19:43
    Stream mapping:
      Stream #0:0 -> #0:0 (h264 -> flv)
      Stream #0:1 -> #0:1 (aac -> libmp3lame)
    Press ctrl-c to stop encoding
    frame= 1162 fps= 57 q=31.0 Lsize=    5584kB time=38.73 bitrate=1181.0kbits/s    
    video:4783kB audio:759kB global headers:0kB muxing overhead 0.754517%
    Today in my short 38 second video test. The second Flash video doesn't seem jerky, so I guess it is OK.

    I'm curious why you would recommend FFmpeg over avconv? I'm not really a "serious" video converter, I'm not ripping DVDs. I am taking video from an iPhone and another digital camera and putting it on the web. The video is of our kids and I post them so both sets of Grandparents can view them.

    So, why not just use YouTube, you ask? Well, it seems that the Grandparents in Japan have had a really big problem with YouTube lagging and they say it's easier to view if I put the videos on my site. I've tried a few different formats and the flv that I'm using seems to load the quickest and has OK quality.

    I'm just flying by the seat of my pants here, so any advice from someone who actually knows what they are doing would be much appreciated.
    Thank you,
    GG -----------

  4. #4
    Join Date
    Dec 2006
    Beans
    7,349

    Re: avconv mov to flv

    There are much more skilled FFmpeg users on these Forums than myself but perhaps I can make a few observations:

    Firstly I note that your original file contains h264 video and aac audio both of which actually live quite comfortably in a flv container. When you accept the FFmpeg/avconv defaults you actually get flv video and mp3 sound in an flv container, not a great problem but just be aware that you could probably just transfer the existing codecs to a new container. I see from your post that you have already experimented a little with this and other containers.

    If your copy of avconv has access to the video filter scale perhaps try something like:

    Code:
    avconv -i foo.mov \
           -c:v flv -q:v 5 -vf scale=320:-1 \
           -c:a libmp3lame -q:a 3 \
           bar.flv
    and add any necessary embellishments to the commandline as required. This may be enough to get decent quality sound and video and certainly the syntax I have suggested with the scale filter should resize things nicely. (The -1 for height resizes as appropriate to maintain the aspect ratio.) Experiment a little with the video -q:v 5 setting until you are happy, a setting of 1 will be very high quality while a setting of 21 would be very low quality.

    As for suggesting FFmpeg there are several reasons:

    • A lot of the expert help on these Forums, and I do not include myself in this in this group of experts, comes from people using FFmpeg rather than avconv, including the maintainer of the guide I mentioned.
    • It is better to use a cutting edge copy of FFmpeg/avconv rather than the repository offering and there is only an FFmpeg guide for this purpose.
    • You and I would then be using the same version of FFmpeg and there would be no discrepance in terms of syntax, fiters etc.
    • When the big fork occurred I fell down on the FFmpeg side


    Let me know how you go with this, hopefully this will make the grandparents happy
    Last edited by andrew.46; January 1st, 2013 at 12:29 AM. Reason: Removed some unnecessary comments, apologies to all...
    You think that's air you're breathing now?

  5. #5
    Join Date
    Oct 2010
    Location
    The United States
    Beans
    843
    Distro
    Ubuntu

    Re: avconv mov to flv

    Quote Originally Posted by andrew.46 View Post

    As for suggesting FFmpeg there are several reasons:

    • A lot of the expert help on these Forums, and I do not include myself in this in this group of experts, comes from people using FFmpeg rather than avconv, including the maintainer of the guide I mentioned.
    • It is better to use a cutting edge copy of FFmpeg/avconv rather than the repository offering and there is only an FFmpeg guide for this purpose.
    • You and I would then be using the same version of FFmpeg and there would be no discrepance in terms of syntax, fiters etc.
    • When the big fork occurred I fell down on the FFmpeg side


    Let me know how you go with this, hopefully this will make the grandparents happy
    Alrighty then, those reasons make sense to me. Plus the guide is so well setup that even a hobbiest like myself can follow the steps to compile and install the dev version of ffmpeg.

    So if I want to go from .mov to .flv at 320x240 with audio at 22050. What would the command be?

    Also on another note, some of our video comes from a camera that shoots mpg files. I've been combining all the mpg files into one using the cat command.
    Code:
    cat video1.mpg video2.mpg > output.mpg
    I've noticed that in Movie Player the output.mpg only plays as far as the fisrt video in the sequence. In VLC, however, the entire output video will play, but it only displays time for the length of the first segment - thereafter the video continues to play as it should except the time has stopped moving forward.

    Is this normal?
    Thank you,
    GG -----------

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

    Re: avconv mov to flv

    Quote Originally Posted by GrouchyGaijin View Post
    So if I want to go from .mov to .flv at 320x240 with audio at 22050. What would the command be?
    Just add that into the audio line:

    Code:
    -c:a libmp3lame -q:a 3 -ar 22050
    Bear in mind that you only specify the width of the output image, avconv decides on the height while maintaining the aspect ratio.


    Also on another note, some of our video comes from a camera that shoots mpg files. I've been combining all the mpg files into one using the cat command.
    Code:
    cat video1.mpg video2.mpg > output.mpg
    I've noticed that in Movie Player the output.mpg only plays as far as the fisrt video in the sequence. In VLC, however, the entire output video will play, but it only displays time for the length of the first segment - thereafter the video continues to play as it should except the time has stopped moving forward.

    Is this normal?
    I have not had much to do with concatenating videos although it sounds from your example that there are some pitfalls . Have a look here for some guidance:

    3.14 How can I concatenate video files?
    http://ffmpeg.mplayerhq.hu/faq.html#...deo-files_003f

    I like the look of the new concat demuxer. Sorry I cannot be much help on this one...
    You think that's air you're breathing now?

  7. #7
    Join Date
    Oct 2010
    Location
    The United States
    Beans
    843
    Distro
    Ubuntu

    Re: avconv mov to flv

    Quote Originally Posted by andrew.46 View Post
    I like the look of the new concat demuxer. Sorry I cannot be much help on this one...
    Thanks, that brings up another question. What is demuxing? (What is the concat demuxer?)
    Thank you,
    GG -----------

  8. #8
    Join Date
    Dec 2006
    Beans
    7,349

    Re: avconv mov to flv

    Quote Originally Posted by GrouchyGaijin View Post
    Thanks, that brings up another question. What is demuxing? (What is the concat demuxer?)
    I am sorry, I suspect I am making things a little too complex . A demuxer (= demultiplexer) extracts individual streams and sends them for encoding. The concat demuxer looks like it really should not be needed in your case as mpg files should join with cat. In the case where file level concatenation can be used the docs suggest you still can use the concat protocol as follows:

    Code:
    ffmpeg -i concat:"intermediate1.mpg|intermediate2.mpg" -c copy intermediate_all.mpg
    Or perhaps simply reencode you final file with the faulty index and all will be well
    You think that's air you're breathing now?

  9. #9
    Join Date
    Sep 2006
    Beans
    3,713

    Re: avconv mov to flv

    I recommend using libx264 instead of flv1 for flv container if possible. flv1 is not great, and just about everyone these days uses H.264 instead. You can get decent results with flv1, but it will require more bitrate for a similar quality which means a larger file size.

    Your foo.mov contains AAC audio which can simply be copied into the flv file as Andrew mentioned. Same for the video stream, but a 25 MB video stream for a 38 second video may require re-encoding to get a more manageable size depending on your viewer's bandwidth.

  10. #10
    Join Date
    Oct 2010
    Location
    The United States
    Beans
    843
    Distro
    Ubuntu

    Re: avconv mov to flv

    Quote Originally Posted by FakeOutdoorsman View Post
    I recommend using libx264 instead of flv1 for flv container if possible. flv1 is not great, and just about everyone these days uses H.264 instead. You can get decent results with flv1, but it will require more bitrate for a similar quality which means a larger file size.

    Your foo.mov contains AAC audio which can simply be copied into the flv file as Andrew mentioned. Same for the video stream, but a 25 MB video stream for a 38 second video may require re-encoding to get a more manageable size depending on your viewer's bandwidth.
    Hey thanks!

    I just tried both:
    Code:
    ffmpeg -i IMG_1770.mov \
           -c:v flv -q:v 5 -vf scale=320:-1 \
           -c:a libmp3lame -q:a 3 \
           Mov-to-flv.flv
    and
    Code:
    ffmpeg -i IMG_1770.mov \
           -c:v libx264 -q:v 5 -vf scale=320:-1 \
           -c:a libmp3lame -q:a 3 \
           Mov-to-libx264.flv
    In my test of a 47 second clip the flv encoded file came in at 3.1 megabytes while the H.264 encoded file came in at 1.7 megabytes.

    You have given me some cool and truly useful advice!
    Thank you,
    GG -----------

Page 1 of 2 12 LastLast

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
  •