Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 39

Thread: Trying to convert .flv to .mp4

  1. #21
    Join Date
    May 2009
    Location
    Courtenay, BC, Canada
    Beans
    1,661

    Re: Trying to convert .flv to .mp4

    here's the script I made for converting videos
    Code:
    #!/bin/bash
    if [ -z "$rate" ]; then
     rate="29.985"
    fi
    echo rate="$rate"
    
    if [ -z "$flags" ]; then
     flags="+aic+mv4"
    fi
    echo flags="$flags"
    
    # new file name
    F="converted/${1%.*}.mp4"
    if [ ! -d "converted" ]; then
     mkdir converted
    fi
    
    if [ ! -f "$F" ]; then    
     ffmpeg -i "$1" -r "$rate" -acodec libvo_aacenc -b 128k -vcodec mpeg4 -b 1200k -flags "$flags" "$F"
    fi
    make a new folder called Scripts in your home folder, then save it as '2mp4' (with no extension) in that folder. open a terminal and paste the following into it:
    Code:
    cd Scripts; chmod +x 2mp4; echo "PATH=$PATH:$HOME/Scripts" >> $HOME/.bashrc
    then when you want to convrrt a file, simply type
    Code:
    2mp4 <file>
    from the same folder and the .mp4 will be in the 'converted' folder. if you want to specify a framerate, then prefix the command, like so
    Code:
    rate=25 2mp4 <file>
    when I want to convert an entire foldrr, I do this (which is why it outputs to a 'converted' folder)
    Code:
    while read -r f; do 2mp4 "$f"; done< <(ls)
    Last edited by HiImTye; May 25th, 2013 at 11:07 AM. Reason: uppercase RATE won't do anything, corrected

  2. #22
    Join Date
    Jun 2010
    Location
    San Jose, CA
    Beans
    42
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Trying to convert .flv to .mp4

    Quote Originally Posted by HiImTye View Post
    here's the script I made for converting videos
    Code:
    #!/bin/bash
    if [ -z "$rate" ]; then
     rate="29.985"
    fi
    echo rate="$rate"
    
    if [ -z "$flags" ]; then
     flags="+aic+mv4"
    fi
    echo flags="$flags"
    
    # new file name
    F="converted/${1%.*}.mp4"
    if [ ! -d "converted" ]; then
     mkdir converted
    fi
    
    if [ ! -f "$F" ]; then    
     ffmpeg -i "$1" -r "$rate" -acodec libvo_aacenc -b 128k -vcodec mpeg4 -b 1200k -flags "$flags" "$F"
    fi
    make a new folder called Scripts in your home folder, then save it as '2mp4' (with no extension) in that folder. open a terminal and paste the following into it:
    Code:
    cd Scripts; chmod +x 2mp4; echo "PATH=$PATH:$HOME/Scripts" >> $HOME/.bashrc
    then when you want to convrrt a file, simply type
    Code:
    2mp4 <file>
    from the same folder and the .mp4 will be in the 'converted' folder. if you want to specify a framerate, then prefix the command, like so
    Code:
    rate=25 2mp4 <file>
    when I want to convert an entire foldrr, I do this (which is why it outputs to a 'converted' folder)
    Code:
    while read -r f; do 2mp4 "$f"; done< <(ls)


    I'm not sure how to get the scripts in the home folder. I made folder (scripts) in the home folder but right now stuck on how to get it in da folder.

  3. #23
    Join Date
    Sep 2006
    Beans
    3,489

    Re: Trying to convert .flv to .mp4

    Quote Originally Posted by HiImTye View Post
    here's the script I made for converting videos
    Code:
    ffmpeg -i "$1" -r "$rate" -acodec libvo_aacenc -b 128k -vcodec mpeg4 -b 1200k -flags "$flags" "$F"
    Some thoughts:
    • -b is shown twice and ffmpeg may ignore one. It is recommended to explicitly tell ffmpeg which bitrate goes where with -b:a (audio) or -b:v (video), or with -vb and -ab with ancient ffmpeg.
    • Consider using -qscale:v (or -qscale with ancient ffmpeg) instead of -b:v for this encoder (mpeg4). A good range is 2-5 where 2 is probably going to be visually lossless or close to it.
    • libvo_aacenc is probably the worst, in terms of quality per bitrate, of the four AAC-LC encoders usable by ffmpeg. Unfortunately most are "non-free" and you will have to compile ffmpeg to take advantage of better encoders. See Compile FFmpeg on Ubuntu and FFmpeg and AAC Encoding Guide.
    • These days H.264 video is usually preferred for MP4 container. See the FFmpeg and x264 Encoding Guide.

  4. #24
    Join Date
    Jun 2010
    Location
    San Jose, CA
    Beans
    42
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Trying to convert .flv to .mp4

    Quote Originally Posted by FakeOutdoorsman View Post
    Some thoughts:
    • -b is shown twice and ffmpeg may ignore one. It is recommended to explicitly tell ffmpeg which bitrate goes where with -b:a (audio) or -b:v (video), or with -vb and -ab with ancient ffmpeg.
    • Consider using -qscale:v (or -qscale with ancient ffmpeg) instead of -b:v for this encoder (mpeg4). A good range is 2-5 where 2 is probably going to be visually lossless or close to it.
    • libvo_aacenc is probably the worst, in terms of quality per bitrate, of the four AAC-LC encoders usable by ffmpeg. Unfortunately most are "non-free" and you will have to compile ffmpeg to take advantage of better encoders. See Compile FFmpeg on Ubuntu and FFmpeg and AAC Encoding Guide.
    • These days H.264 video is usually preferred for MP4 container. See the FFmpeg and x264 Encoding Guide.
    Hi FakeOutDoor, I did go and to the Ubuntu Compilation page and follow everything on da page and have files on my home folder, understand I don't know how to compile or anything like that so i have the ffmpeg, yasm, and lame folders sitting in my home folder and don't what to do with them, at a complete loss here.

  5. #25
    Join Date
    May 2009
    Location
    Courtenay, BC, Canada
    Beans
    1,661

    Re: Trying to convert .flv to .mp4

    @FakeOutdoorsmen, -b is specified after each outout type and works fine as a result, the script is meant to work on as many ffmpeg versions as possible, from the repos, requiring only adding restricted extras and ffmpeg to simplify getting it to work relatively simply, as it's only written to play on devices that don't support .avi, etc.

    @dre3, either use gedit (text editor) and save it in the folder, or go to the foldrr in the terminal, type
    Code:
    nano 2mp4
    paste (shift+ins, or just middle click into the terminal window with it highlighted in thid window)and save the file (using the key combination shown at the bottom - ^ means ctrl), then run the script above to make it executable and add Scripts to your PATH making it executable from any folder. also, thebfolder should be called 'Scripts' (with an uppercase S) or you'll need to modify the script before you run it
    Last edited by HiImTye; May 25th, 2013 at 09:11 PM.

  6. #26
    Join Date
    Jun 2010
    Location
    San Jose, CA
    Beans
    42
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Trying to convert .flv to .mp4

    Quote Originally Posted by HiImTye View Post
    @FakeOutdoorsmen, -b is specified after each outout type and works fine as a result, the script is meant to work on as many ffmpeg versions as possible, from the repos, requiring only adding restricted extras and ffmpeg to simplify getting it to work relatively simply, as it's only written to play on devices that don't support .avi, etc. @dre3, either use gedit (text editor) and save it in the folder, or go to the foldrr in the terminal, type
    Code:
    nano 2mp4
    paste (shift+ins, or just middle click into the terminal window with it highlighted in thid window)and save the file (using the key combination shown at the bottom - ^ means ctrl), then run the script above to make it executable and add Scripts to your PATH making it executable from any folder. also, thebfolder should be called 'Scripts' (with an uppercase S) or you'll need to modify the script before you run it
    Ok i have the Scripts folder with the 2mp4 exe in it, i just try to convert a .flv file and got this ajohn@johnson-laptop:~$ 2mp4 file:///home/ajohn/Videos/.SWH/1947709_Monters.flv rate=29.985 flags=+aic+mv4 ffmpeg version git-2012-03-29-282ec72 Copyright (c) 2000-2012 the FFmpeg developers built on Mar 29 2012 10:16:20 with gcc 4.4.3 configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-version3 --enable-x11grab libavutil 51. 44.100 / 51. 44.100 libavcodec 54. 12.100 / 54. 12.100 libavformat 54. 3.100 / 54. 3.100 libavdevice 53. 4.100 / 53. 4.100 libavfilter 2. 66.101 / 2. 66.101 libswscale 2. 1.100 / 2. 1.100 libswresample 0. 10.100 / 0. 10.100 libpostproc 52. 0.100 / 52. 0.100 Input #0, flv, from 'file:///home/ajohn/Videos/.SWH/1947709_Monters.flv': Metadata: audiosize : 8778481 canSeekToEnd : true datasize : 85624965 hasAudio : true hasCuePoints : false hasKeyframes : true hasMetadata : true hasVideo : true lasttimestamp : 1177 metadatacreator : flvtool++ (Facebook, Motion project, dweatherford) totalframes : 35290 videosize : 75517391 Duration: 00:19:37.40, start: 0.033000, bitrate: 581 kb/s Stream #0:0: Video: h264 (High), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 525 kb/s, 29.97 tbr, 1k tbn, 59.94 tbc Stream #0:1: Audio: aac, 44100 Hz, stereo, s16, 61 kb/s Please use -b:a or -b:v, -b is ambiguous Last message repeated 1 times Unknown encoder 'libvo_aacenc' ajohn@johnson-laptop:~$ Don't know if in the right direction or still way off? Thanks with all the help so far.

  7. #27
    Join Date
    May 2009
    Location
    Courtenay, BC, Canada
    Beans
    1,661

    Re: Trying to convert .flv to .mp4

    you're not using ffmpeg from the repos, you'll have to change the file to match the git vrrsions format requirements, in this case, run in the terminal
    Code:
     sed -ie 's|b 128k|b:a 128k|;s|b 1200k|b:v 1200k|' $HOME/Scripts/2mp4
    this should fix it

    edit: you'll also need to change the audio encoder, as you don't have 'libvo_aacenc'
    run this command and look for one with a capital E at the start
    Code:
    ffmpeg -codec | grep aac
    you'll need to substitude this codec in this script:
    Code:
    sed -ie 's|libvo_aacenc|CodecGoesHere|' $HOME/Scripts/2mp4
    Last edited by HiImTye; May 25th, 2013 at 10:16 PM.

  8. #28
    Join Date
    Jun 2010
    Location
    San Jose, CA
    Beans
    42
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Trying to convert .flv to .mp4

    Quote Originally Posted by HiImTye View Post
    you're not using ffmpeg from the repos, you'll have to change the file to match the git vrrsions format requirements, in this case, run in the terminal
    Code:
     sed -ie 's|b 128k|b:a 128k|;s|b 1200k|b:v 1200k|' $HOME/Scripts/2mp4
    this should fix it edit: you'll also need to change the audio encoder, as you don't have 'libvo_aacenc' run this command and look for one with a capital E at the start
    Code:
    ffmpeg -codec | grep aac
    you'll need to substitude this codec in this script:
    Code:
    sed -ie 's|libvo_aacenc|CodecGoesHere|' $HOME/Scripts/2mp4
    I ran the command didnt see anything with a capital E, this is what i got: ajohn@johnson-laptop:~$ ffmpeg -codec | grep aac ffmpeg version git-2012-03-29-282ec72 Copyright (c) 2000-2012 the FFmpeg developers built on Mar 29 2012 10:16:20 with gcc 4.4.3 configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-version3 --enable-x11grab libavutil 51. 44.100 / 51. 44.100 libavcodec 54. 12.100 / 54. 12.100 libavformat 54. 3.100 / 54. 3.100 libavdevice 53. 4.100 / 53. 4.100 libavfilter 2. 66.101 / 2. 66.101 libswscale 2. 1.100 / 2. 1.100 libswresample 0. 10.100 / 0. 10.100 libpostproc 52. 0.100 / 52. 0.100 Missing argument for option 'code

  9. #29
    Join Date
    May 2009
    Location
    Courtenay, BC, Canada
    Beans
    1,661

    Re: Trying to convert .flv to .mp4

    whoops, that should be
    Code:
    ffmpeg -codecs | grep aac

  10. #30
    Join Date
    Dec 2006
    Beans
    6,934

    Re: Trying to convert .flv to .mp4

    Syntax has changed for the most recent FFmpeg:

    Code:
    andrew@skamandros~$ ffmpeg -encoders 2>/dev/null | grep aac
     A..X.. aac                  AAC (Advanced Audio Coding)
     A..... libfaac              libfaac AAC (Advanced Audio Coding) (codec aac)
     A..... libfdk_aac           Fraunhofer FDK AAC (codec aac)
    The key for the letters at the beginning:


    Code:
    Encoders:
     V..... = Video
     A..... = Audio
     S..... = Subtitle
     .F.... = Frame-level multithreading
     ..S... = Slice-level multithreading
     ...X.. = Codec is experimental
     ....B. = Supports draw_horiz_band
     .....D = Supports direct rendering method 1
    This is of course if you decide to go with FakeOutdoorsman's wiki page...
    Last edited by andrew.46; May 25th, 2013 at 10:46 PM.
    You think that's air you're breathing now?

Page 3 of 4 FirstFirst 1234 LastLast

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
  •