VideoHelp Forum
+ Reply to Thread
Results 1 to 17 of 17
Thread
  1. Member
    Join Date
    Nov 2007
    Location
    Europe
    Search Comp PM
    Hello,

    I'm trying to write application for my website which will convert videos, uploaded to my site, to FLV1 format for using in YouTube. My server is a Linux server.

    I need to:
    - scale (not just resize) uploaded video to 448x336. Mencoder can do that, but it seems FFMPEG can't.

    - add watermark. FFmpeg can do that, but Mencoder can't.

    - add another video and encode to FLV. Mencoder can do that, FFmpeg can't (it creates broken videos when I join few files).

    Of course, I could run process 3 times, but I guess it will kill my Celeron server.

    I wonder, is there any way to add watermark (logo) with Mencoder OR is there any way to scale video with FFmpeg, so I could use 2 processes instead of 3.
    Quote Quote  
  2. Always Watching guns1inger's Avatar
    Join Date
    Apr 2004
    Location
    Miskatonic U
    Search Comp PM
    Why not learn a little avisynth scripting and let it join, resize and watermark for you ? Then you can use menocder or ffmpeg for encoding and not worry about the rest of it.
    Read my blog here.
    Quote Quote  
  3. Member
    Join Date
    Dec 2004
    Location
    Triptonia
    Search Comp PM
    Originally Posted by ApplePro
    I need to:
    - scale (not just resize) uploaded video to 448x336. Mencoder can do that, but it seems FFMPEG can't.

    - add watermark. FFmpeg can do that, but Mencoder can't.
    Scale=resize
    I suppose you like the calculating features.

    mencoder can add image with
    -vf bomvl
    which is said to be crap though, not as good as vhook.
    somewhere out there is an old hacked version of bmovl to increase it's capabilities

    gl
    Quote Quote  
  4. Member
    Join Date
    Nov 2007
    Location
    Europe
    Search Comp PM
    Originally Posted by guns1inger
    Why not learn a little avisynth scripting and let it join, resize and watermark for you ? Then you can use menocder or ffmpeg for encoding and not worry about the rest of it.
    I used Avisynth a lot on Windows. But my server is Linux.

    Avisynth needs Wine to run on Linux to emulate windows enviroment. It's too complicated for me.

    Originally Posted by 45tripp
    Scale=resize
    I suppose you like the calculating features.
    When I use resize in FFmpeg, it doesn't keep aspect ratio and faces of actors looks really unnatural (too long). But with mencoder's scale I get proper video. I thouht these are different features.

    mencoder can add image with
    -vf bomvl
    which is said to be crap though, not as good as vhook.
    somewhere out there is an old hacked version of bmovl to increase it's capabilities

    gl
    I've googled for bomvl, but found nothing. Can you give me an example of usage please? All I need is to add small logo to a movie.
    Quote Quote  
  5. Member mats.hogberg's Avatar
    Join Date
    Jul 2002
    Location
    Sweden (PAL)
    Search Comp PM
    For resizing; is there no way to get the dimensions of the original video, and then calculate what to resize to, with ffmpeg, without distorting the AR?
    As a principle, I'd agree on there's a difference between resizing and scaling. The former may change AR while the latter wont.

    /Mats
    Quote Quote  
  6. Member
    Join Date
    Nov 2007
    Location
    Europe
    Search Comp PM
    mencoder can add image with
    -vf bomvl
    which is said to be crap though, not as good as vhook.
    somewhere out there is an old hacked version of bmovl to increase it's capabilities
    I've just found documentation. I will try it. Thanks.
    Quote Quote  
  7. Member
    Join Date
    Nov 2007
    Location
    Europe
    Search Comp PM
    Ok, I'm trying to use bmovl, but I can't understand how does it work.

    I've read mencoder's manual (for bmovl) and also found few usage examples.

    I've created bitmap image with this:

    convert logo.gif logo.rgb

    Then I need to do something like this to use logo in mencoder:

    mkfifo logo
    echo "RGB24 120 20 0 0 0 0" > logo
    cat logo.rgb > logo

    But when I'm running 2nd command (echo....) or 3rd (cat....), it countinues running and doesn't return anything. I can only interrupt it by Ctrl + C.

    What am I doing wrong?
    Quote Quote  
  8. Member
    Join Date
    Dec 2004
    Location
    Triptonia
    Search Comp PM
    Originally Posted by ApplePro
    When I use resize in FFmpeg, it doesn't keep aspect ratio and faces of actors looks really unnatural (too long).
    source info, commandline, output?


    I've never worked linux, or bmovl before so I actually have no idea,
    but where's the mencoder command?

    convert logo.gif logo.rgb
    mkfifo logo
    mencoder -vf bmovl=0:1:./logo .....
    echo "RGB24 120 20 0 0 0 0" > logo
    cat logo.rgb > logo

    here's the hacked version of bmovl btw
    http://sault.org/mebox/downloads.php

    gl
    Quote Quote  
  9. Member
    Join Date
    Nov 2007
    Location
    Europe
    Search Comp PM
    Originally Posted by 45tripp
    Originally Posted by ApplePro
    When I use resize in FFmpeg, it doesn't keep aspect ratio and faces of actors looks really unnatural (too long).
    source info, commandline, output?
    FFmpeg shows this:

    Seems stream 0 codec frame rate differs from container frame rate: 1000.00 (1000/1) -> 23.98 (24000/1001)
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'testbig.mov':
    Duration: 00:02:30.1, start: 0.000000, bitrate: 3371 kb/s
    Stream #0.0(eng): Video: mpeg4, yuv420p, 720x480 [PAR 1:1 DAR 3:2], 23.98 fps(r)

    Command line:

    mencoder -vf scale=448:-3,expand=448:336 -sws 9 -of lavf -ovc lavc -lavcopts vcodec=flv:vbitrate=400 -frames 200 -ofps 15 -nososund -o test2.flv testbig.mov

    ffmpeg -i testbig.mov -vcodec flv -r 15 -b 320k -s 448x336 -g 160 -cmp 3 -subcmp 3 -mbd 2 -flags aic+cbp+mv0+mv4+trell -acodec libmp3lame -ab 128k -y test1.flv
    I've never worked linux, or bmovl before so I actually have no idea,
    but where's the mencoder command?
    Command line:

    mencoder -vf scale=448:-3,expand=448:336,bmovl=0:0:logo -sws 9 -of lavf -ovc lavc -lavcopts vcodec=flv:vbitrate=400 -frames 200 -ofps 15 -o test2.flv testbig.mov
    convert logo.gif logo.rgb
    mkfifo logo
    mencoder -vf bmovl=0:1:./logo .....
    echo "RGB24 120 20 0 0 0 0" > logo
    cat logo.rgb > logo
    Do I really should run mencoder before echo and cat?

    I've tried to run it, but I get movie in 2-3 seconds. Movie is without logo.


    here's the hacked version of bmovl btw
    http://sault.org/mebox/downloads.php

    gl
    Thanks. But I'm not Linux programmer guru and I don't know how to install such stuff. It's big piece of C code that should be inserted somewhere. It's too coplicated for newbie.

    Also, if I get it correctly, it's same as bmovl, but with features that I don't really need (all I need is to put logo to a video).
    Quote Quote  
  10. Member
    Join Date
    Dec 2004
    Location
    Triptonia
    Search Comp PM
    I really doubt it's 3:2,
    probably previously botched. (or just ffmpeg misreporting, certainly possible with mov container)

    I knew it was the autoscaling you were referring to
    this should give the same as mencoder (assuming mencoder sees what ffmpeg sees):
    Code:
    ffmpeg  -i testbig.mov -vframes 200 -vcodec flv -r 15 -b 320k -s 448x304 -padtop 16 -padbottom 16  -g 160 -cmp 3 -subcmp 3 -mbd 2 -flags aic+cbp+mv0+mv4+trell -acodec libmp3lame -ab 128k -y test1.flv
    Of course I'd think this would actually be correct (can't tell without source):
    Code:
    ffmpeg  -i testbig.mov -vframes 200 -vcodec flv -r 15 -b 320k -s 448x256 -padtop 40 -padbottom 40  -g 160 -cmp 3 -subcmp 3 -mbd 2 -flags aic+cbp+mv0+mv4+trell -acodec libmp3lame -ab 128k -y test1.flv
    Originally Posted by ApplePro
    Do I really should run mencoder before echo and cat?
    I saw it somewhere.
    I don't know though.
    Maybe try running mencoder from a second console.
    You'll have to search around or find someone who has actually used it.

    Originally Posted by ApplePro
    Thanks. But I'm not Linux programmer guru and I don't know how to install such stuff. It's big piece of C code that should be inserted somewhere. It's too coplicated for newbie.
    I know it's above me,
    but you never know.

    gl
    Quote Quote  
  11. Member
    Join Date
    Nov 2007
    Location
    Europe
    Search Comp PM
    Originally Posted by 45tripp
    I really doubt it's 3:2,
    probably previously botched. (or just ffmpeg misreporting, certainly possible with mov container)
    I will try another sources.

    I saw it somewhere.
    I don't know though.
    Maybe try running mencoder from a second console.
    You'll have to search around or find someone who has actually used it.
    I've tried to run echo/cat first from two consoles and mencoder from third one. When I run mencoder, echo and cat return command line back. I get movie without logo. Thanks for advices anyway.

    2all
    Maybe someone used mencoder to add logo to a video?
    Quote Quote  
  12. Member
    Join Date
    Nov 2007
    Location
    Europe
    Search Comp PM
    I have tried another source (DV 16:9 exported from iMovie 08) with FFmpeg. Still, picture resized incorrectly (faces are too long):

    ffmpeg -i testbig.avi -r 15 -vcodec huffyuv -s 448x336 -acodec pcm_s16le -y -sameq temp2.avi
    Output:

    FFmpeg version SVN-r11000, Copyright (c) 2000-2007 Fabrice Bellard, et al.
    configuration: --enable-libxvid --enable-libmp3lame --enable-gpl --enable-libx264 --enable-static --enable-gpl
    libavutil version: 49.5.0
    libavcodec version: 51.48.0
    libavformat version: 51.19.0
    built on Nov 11 2007 06:24:49, gcc: 4.1.2 20070626 (Red Hat 4.1.2-13)
    Input #0, avi, from 'testbig.avi':
    Duration: 00:00:15.6, start: 0.000000, bitrate: 35978 kb/s
    Stream #0.0: Video: dvvideo, yuv420p, 720x576 [PAR 0:1 DAR 0:1], 30.00 fps(r)
    Stream #0.1: Audio: pcm_s16le, 44100 Hz, stereo, 1411 kb/s
    PIX_FMT_YUV420P will be used as an intermediate format for rescaling
    Output #0, avi, to 'temp2.avi':
    Stream #0.0: Video: huffyuv, yuv422p, 448x336 [PAR 0:1 DAR 0:1], q=2-31, 200 kb/s, 15.00 fps(c)
    Stream #0.1: Audio: pcm_s16le, 44100 Hz, stereo, 1411 kb/s
    Stream mapping:
    Stream #0.0 -> #0.0
    Stream #0.1 -> #0.1
    [huffyuv @ 0xae2320]using huffyuv 2.2.0 or newer interlacing flag
    Press [q] to stop encoding
    frame= 237 fps= 19 q=0.0 Lsize= 41887kB time=15.6 bitrate=21927.4kbits/s
    video:38923kB audio:2696kB global headers:0kB muxing overhead 0.644667%
    Quote Quote  
  13. Member
    Join Date
    Dec 2004
    Location
    Triptonia
    Search Comp PM
    it's not resizing incorrectly,
    you are

    Code:
    ffmpeg -i testbig.avi -r 15 -vcodec huffyuv -s 448x256 -padtop 40 -padbottom 40 -acodec pcm_s16le -y -sameq temp2.avi
    gl
    Quote Quote  
  14. Member
    Join Date
    Nov 2007
    Location
    Europe
    Search Comp PM
    Originally Posted by 45tripp
    it's not resizing incorrectly,
    you are

    Code:
    ffmpeg -i testbig.avi -r 15 -vcodec huffyuv -s 448x256 -padtop 40 -padbottom 40 -acodec pcm_s16le -y -sameq temp2.avi
    Thanks. But the thing is Mencoder resizes automatically. How can I get -padtopand -padbottom values automatically with FFmpeg? Or maybe there is another command line tool to do that? Or is there tools that will extract aspect ratio of the pixel, height and width of the movie and returns it (to PHP, for example)?

    I'm askingthis because I need to create script that will resize movies automatically.
    Quote Quote  
  15. Member
    Join Date
    Dec 2004
    Location
    Triptonia
    Search Comp PM
    Originally Posted by ApplePro
    Thanks. But the thing is Mencoder resizes automatically. How can I get -padtopand -padbottom values automatically with FFmpeg?
    no,

    you'll have to get the values with some app (ffprobe ,mplayer) and create your own script to
    autocalculate the correct values.
    check this maybe for an idea
    http://www.xs4all.nl/~carlo17/howto/encode.html

    I do things manually...

    gl


    p.s
    ffprobe
    http://sourceforge.net/projects/ffprobe
    Quote Quote  
  16. Member
    Join Date
    Nov 2007
    Location
    Europe
    Search Comp PM
    Thanks.

    But I can't find whereto download ffprobe and installation info for it. It seems it's very rare software.
    Quote Quote  
  17. Member
    Join Date
    Dec 2004
    Location
    Triptonia
    Search Comp PM
    you need to checkout through svn,
    then compile

    You also need gnu autotools.

    No I've not compiled it myself,
    and I don't know how good it is.

    By the way, mplayers autoscale is not magic,
    mplayer doesn't always correctly detect aspect ratio.

    mediainfo is probably the best you can do,
    (doesn't always detect correctly either)
    http://linux.softpedia.com/get/Multimedia/Video/MediaInfo-31053.shtml

    I suppose you'll have to check against your input sources.

    gl
    Quote Quote  



Similar Threads

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