VideoHelp Forum

Our website is made possible by displaying online advertisements to our visitors.
Please consider supporting us by disabling your ad blocker or buy PlayOn and record Netflix! :)
+ Reply to Thread
Results 1 to 9 of 9
  1. HI every one .
    This is how I convert videoes to flv but the quality is decreasing very much .
    passthru("$ffmpegpath -i uploads/$video_name -ar 22050 -ab 32k -f flv -s 480x800 uploads/vid.flv");
    How can I convert videos without any decrease of quality ?

    Quote Quote  
  2. If the source video uses compatible compression with FLV container (e.g. h.264, h.263, VP6), just stream copy the video . No quality loss
    -c:v copy

    Otherwise some quality loss is unavoidable in FLV container (it doesn't support lossless codecs - except lossless x264, which isn't supported by flash which I assume you are using this for - and they are huge in filesize anyways)

    You can minimze the loss by re-encoding using a better encoder like libx264
    -c:v libx264

    And/or by increasing the bitrate, or lowering the quantizer or crf values
    Last edited by poisondeathray; 12th Apr 2014 at 00:55.
    Quote Quote  
  3. Member
    Join Date
    Nov 2002
    United States
    Search Comp PM
    Here are a few batch files to convert FLV files. You'll need to place a copy of ffmpeg.exe and cmd.exe in the folder you want to convert. Copy each command in Notepad and save as .bat

    bat files

    for %%a in ("*.flv") do ffmpeg -i %%a -vcodec copy -acodec copy %%~na.mp4

    for %%a in ("*.flv") do ffmpeg -i %%a -vcodec copy -acodec ac3 -ac 2 -ar 48000 -ab 128k %%~na.mkv

    for %%a in ("*.flv") do ffmpeg -i %%a -vcodec h264 -vf "scale=512:-1" -acodec libmp3lame -qscale 0 %%~na.mkv

    for %%a in ("*.flv") do ffmpeg -i %%a -vcodec vn -acodec libmp3lame -qscale 0 %%~na.mp3

    for %%a in ("*.flv") do ffmpeg -i %%a -c:v libx264 -preset superfast -crf 24 -acodec libmp3lame %%~na.mkv

    for %%a in ("*.flv") do ffmpeg -i %%a -c:v libx264 -preset superfast -crf 24 -acodec copy %%~na.mkv

    cmd.exe will ignore files with spaces in filename so I use this replace-spaces-with-dashes.vbs file to remove spaces.

    vbs file - replace-spaces-with-dashes.vbs ( can easily change the pattern to "_" )

    dim objFileSys, file, folderName, folderObj, fileColl, objRegEx, newFile

    set objFileSys = CreateObject("Scripting.FileSystemObject")
    folderName = InputBox("Enter the full path where the files are located.", "Full path is required")

    set folderObj = objFileSys.GetFolder(folderName)
    set fileColl = folderObj.Files
    set objRegEx = new RegExp

    objRegEx.Pattern = " " ' the pattern is one space
    objRegEx.Global = true

    for each objFile in fileColl
    newFile = objRegEx.Replace(objFile.Name, "-") ' each pattern gets replaced with one dash

    objFileSys.MoveFile objFile, folderName & "\" & newFile

    EDIT: It's best to separate each type of FLV into it's own folder.

    Example: VP6, AVC/aac, Sorenson (nellymoser)
    Last edited by DarrellS; 12th Apr 2014 at 22:01.
    Quote Quote  
  4. all filenames should be in quotation and then there could be spaces in a file name or along the way in its path, for example: "%%~na.mp4" or even "%%a" if it is placed after DO
    Quote Quote  
  5. HI
    thanks for the replies .
    I told my server to upgrade to latest version of ffmpeg and they told me they did and I have the latest version that is 2.2.1 .
    I test several codes to convert a video to x264 , here is the one ;
    passthru("$ffmpegpath -i aatest/a.AVI -c:v libx264 -c:a libfaac -preset veryslow -qp 0 aatest/output.mp4 2>&1");
    now ,when I run the page, it shows me this error :

    FFmpeg version 0.6.5, Copyright (c) 2000-2010 the FFmpeg developers built on Jan 29 2012 17:52:15 with gcc 4.4.5 20110214 (Red Hat 4.4.5-6) configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --incdir=/usr/include --disable-avisynth --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fPIC' --enable-avfilter --enable-avfilter-lavf --enable-libdc1394 --enable-libdirac --enable-libfaac --enable-libfaad --enable-libfaadbin --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libx264 --enable-gpl --enable-nonfree --enable-postproc --enable-pthreads --enable-shared --enable-swscale --enable-vdpau --enable-version3 --enable-x11grab libavutil 50.15. 1 / 50.15. 1 libavcodec 52.72. 2 / 52.72. 2 libavformat 52.64. 2 / 52.64. 2 libavdevice 52. 2. 0 / 52. 2. 0 libavfilter 1.19. 0 / 1.19. 0 libswscale 0.11. 0 / 0.11. 0 libpostproc 51. 2. 0 / 51. 2. 0 [mpeg4 @ 0x1111960]Invalid and inefficient vfw-avi packed B frames detected [mpeg4 @ 0x1111960]frame skip 8 Input #0, avi, from 'aatest/a.AVI': Duration: 00:02:04.04, start: 0.000000, bitrate: 885 kb/s Stream #0.0: Video: mpeg4, yuv420p, 480x360 [PAR 4:3 DAR 16:9], 25 tbr, 25 tbn, 25 tbc Stream #0.1: Audio: mp3, 44100 Hz, 2 channels, s16, 128 kb/s Unrecognized option 'c:v'

    the last line says "Unrecognized option 'c:v'"

    What should I do ?
    Quote Quote  
  6. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date
    Aug 2000
    Search Comp PM
    You need a newer version. That is not version 2.2.1.
    Quote Quote  
  7. Member
    Join Date
    Nov 2002
    United States
    Search Comp PM
    Originally Posted by _Al_ View Post
    all filenames should be in quotation and then there could be spaces in a file name or along the way in its path, for example: "%%~na.mp4" or even "%%a" if it is placed after DO
    Can you show the complete command to convert the whole folder from x264/aac flv to x264/aac mp4? Not sure what you mean since ("*.flv") is already in quotes and it's cmd.exe's problem of not being able to read the file with spaces to open it.
    Quote Quote  
  8. for %%a in ("*.flv") do ffmpeg -i "%%a" -vcodec copy -acodec copy "%%~na.mp4"

    but I like those drag and drop batch files, you can build up on this, it creates functions basically, for example this one, that zip below, where typing this line (into cmd or another batch script):
    "flv to mp4.BAT" "your flv.flv"
    makes "your flv.mp4"

    And Windows 7 has that cool feature, that you just launch Cmd.exe, drop "flv to mp4.BAT" file in there from windows explorer, press "space bar" and drop "your flv.flv" file in there, it creates command line for you, you just run it pressing "enter" and done

    but this is off topic, not really php useful, that windows OS ... anyway, worth mentioning that dropping feature into cmd window, saves a lot
    Image Attached Files
    Last edited by _Al_; 13th Apr 2014 at 16:30.
    Quote Quote  
  9. Member
    Join Date
    Nov 2002
    United States
    Search Comp PM
    Thanks! Ya learn something every day. I just started using Windows 7 so I'll have to try those tricks also.
    Quote Quote