VideoHelp Forum




+ Reply to Thread
Results 1 to 10 of 10
  1. Member
    Join Date
    Oct 2007
    Location
    United States
    Search Comp PM
    I have 480x360 PNG image and a 128Kbps MP3 file as sources. I need to make FLV (Sorenson h263) video with PNG image as a static video (1fps, keyframes every 5 frames), and with mp3 as a soundtrack. how can i do such in ffmpeg/mencoder/or maybe other cli tool? i'm writing a php script that would take user's png/mp3 and output flv for download. file size doesnt matter, max quality is the key here.

    here are the source file just in case:
    http://golosmira.com/sources.rar

    Thanks in advance!


    PS: directly muxing mp3 audio into flv without re-encoding would be a definite plus
    Quote Quote  
  2. Member
    Join Date
    Dec 2004
    Location
    Triptonia
    Search Comp PM
    couldn't do it in a single step nicely with ffmpeg.
    could be my version

    Code:
    ffmpeg -loop_input -i video.png -r 1 -i audio.mp3 -acodec copy -vcodec flv -qscale 2 -ab 128k -g 5 -cmp 3 -subcmp 3 -mbd 2 -flags trell frifox.avi -shortest
    
    ffmpeg -i frifox.avi -vcodec copy -acodec copy frifox1.flv
    
    del frifox.avi
    and mencoder
    Code:
    mencoder mf://video.png -mf fps=1/45:type=png -audiofile audio.mp3 -ovc lavc -oac copy -vf harddup -lavcopts vcodec=flv:vqscale=2:keyint=5 -ofps 1 -of lavf -o Fri.flv
    gl
    Quote Quote  
  3. Member
    Join Date
    Oct 2007
    Location
    United States
    Search Comp PM
    woah, it works perfect!! thanks a lot!

    during my experiments i found that ffmpeg (didnt play much with mencoder since i heard it uses ffmpeg's libraries) produces better quality vids than Sorenson Squeeze, a $500 program!!!!
    Quote Quote  
  4. Member
    Join Date
    Oct 2007
    Location
    United States
    Search Comp PM
    btw here's resulting video produced by ffmpeg script above. imho its as perfect as anyone can get it...

    Lossless upload:
    http://www.youtube.com/watch?v=ZhCwOyvMcSw

    and

    Lossless 320Kbps VBR MP3 + 480x360 hifi pic:
    http://www.youtube.com/watch?v=i7DM3wMViMA
    Quote Quote  
  5. Member
    Join Date
    Oct 2007
    Location
    United States
    Search Comp PM
    Originally Posted by 45tripp
    couldn't do it in a single step nicely with ffmpeg.
    could be my version

    Code:
    ffmpeg -loop_input -i video.png -r 1 -i audio.mp3 -acodec copy -vcodec flv -qscale 2 -ab 128k -g 5 -cmp 3 -subcmp 3 -mbd 2 -flags trell frifox.avi -shortest
    
    ffmpeg -i frifox.avi -vcodec copy -acodec copy frifox1.flv
    
    del frifox.avi
    i noticed there is "-ab 128k" in the command, but doesnt -ab switch specifies Audio Bitrate, which is not necessary when copying the audio from mp3 without re-encoding?
    Quote Quote  
  6. Member
    Join Date
    Dec 2004
    Location
    Triptonia
    Search Comp PM
    true,
    it got left over from a previous commandline.
    Quote Quote  
  7. Member
    Join Date
    Oct 2007
    Location
    United States
    Search Comp PM
    so far ffmpeg is doing a very good job, here is the command that i was using:
    Code:
    ffmpeg -loop_input -f image2 -i pic.png -r 1 -vcodec flv -i audio.mp3 -acodec copy -qscale 2 -g 5 -cmp 3 -subcmp 3 -mbd 2 -flags trell temp.avi -shortest
    
    ffmpeg -i temp.avi -vcodec copy -acodec copy video.flv
    lately i've been having some issues with some mp3 files.. there were couple of mp3 files which ffmpeg couldnt handle, it would simply crash with no warning. so i tried mencoder, and it processed all those mp3's without any hiccups!

    so my question is, how to accomplish the above with MENCODER (aka, mux 1 PNG file with an MP3 file)?


    here's what i've been trying with mencoder. my goal is to loop png file along the duration of the mp3 file., but currently mencoder just cuts everything off @ 1 second
    Code:
    mencoder mf://video.png -mf type=png:fps=1 -ovc lavc -lavcopts vcodec=flv:vqscale=2:keyint=5 -oac copy -audiofile audio.mp3 -vf harddup -ofps 1 -o video.flv

    Thanks for the help!
    Quote Quote  
  8. Member
    Join Date
    Dec 2004
    Location
    Triptonia
    Search Comp PM
    I already showed it to you in mencoder:

    Originally Posted by 45tripp
    and mencoder
    Code:
    mencoder mf://video.png -mf fps=1/45:type=png -audiofile audio.mp3 -ovc lavc -oac copy -vf harddup -lavcopts vcodec=flv:vqscale=2:keyint=5 -ofps 1 -of lavf -o Fri.flv

    you need to know the clip duration though,
    you don't have ffmpeg looping,
    so 45 sec was the duration of the first audio clip you provided.

    change that number to the duration of each clip in seconds.


    there were couple of mp3 files which ffmpeg couldnt handle, it would simply crash with no warning.
    sample please.


    tripp
    Quote Quote  
  9. Member
    Join Date
    Oct 2007
    Location
    United States
    Search Comp PM
    Originally Posted by 45tripp
    there were couple of mp3 files which ffmpeg couldnt handle, it would simply crash with no warning.
    sample please.
    wow, i updated my ffmpeg to SVN-r12572 and the crashing problem is gone! i guess they fixed the bug :P


    Originally Posted by 45tripp
    I already showed it to you in mencoder:
    Originally Posted by 45tripp
    and mencoder
    Code:
    mencoder mf://video.png -mf fps=1/45:type=png -audiofile audio.mp3 -ovc lavc -oac copy -vf harddup -lavcopts vcodec=flv:vqscale=2:keyint=5 -ofps 1 -of lavf -o Fri.flv

    you need to know the clip duration though,
    you don't have ffmpeg looping,
    so 45 sec was the duration of the first audio clip you provided.
    ffmpeg just loops the input image until audio ends ("-shortest" argument), and as you say, mencoder cant do that... if thats true, then i guess mencoder doesnt fit my needs...
    Quote Quote  
  10. Member
    Join Date
    Dec 2004
    Location
    Triptonia
    Search Comp PM
    you can use mencoder if you want.
    just got to be a bit inventive.

    Code:
    @echo off
    
    mp3info -p "%%S" v.mp3 > t.txt
    
    set /p d= <t.txt
    
    mencoder mf://video.png -mf fps=1/%d%:type=png -audiofile v.mp3 -ovc lavc -oac 
    copy -vf harddup -lavcopts vcodec=flv:vqscale=2:keyint=5 -ofps 1 -of lavf -o Fri.flv
    mp3info
    http://www.ibiblio.org/mp3info/

    not gonna look for the other thread,
    but you can do autoscaling with ffmpeg if you plan the calc externally and use an aiding program or two
    probably better to use some other language than dos batch
    but there's the basic stucture of something like that here:
    https://forum.videohelp.com/topic349222.html#1836387


    tripp
    Quote Quote  



Similar Threads

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