Page 2 of 2 FirstFirst 12
Results 11 to 18 of 18

Thread: Automating video conversion for a beginner

  1. #11
    Join Date
    May 2007
    Beans
    601

    Re: Automating video conversion for a beginner

    See my edited post.

  2. #12
    Join Date
    Mar 2009
    Location
    The Moon
    Beans
    130
    Distro
    Ubuntu

    Talking Re: Automating video conversion for a beginner

    Quote Originally Posted by xzero1 View Post
    See my edited post.

    thanks I noticed !

    back to figuring out more features to add maybe mysql the output to database and have php read from that database and display with vlc plugin !

    i'm getting closer to a video ubuntu sharing bash script lol
    sudo -s

  3. #13
    Join Date
    Sep 2006
    Beans
    3,610

    Re: Automating video conversion for a beginner

    Quote Originally Posted by mysoogal View Post
    hope you don't mind but i taken a liking to this script you wrote and updated it to my needs

    grabs image,convert to h264 and thats it lol


    Code:
    #!/bin/bash
    # ffmpeg and mencoder script
    # Grab thumb from avi, start encoding to ITU h264 using mencoder, ffmpeg is doing thumb processing
    
    # Bash script for operating system Ubuntu 8.10 
    # packages used : FFMPEG, MENCODER ,MPLAYER ENCODING ENGINE
    # VIDEO CODEC ITU H264 AUDIO MP3
    
    
    # Written by FakeOutdoorsman and updated by mysoogal
    # Attribution-Noncommercial 3.0 Unported
    # http://creativecommons.org/licenses/by-nc/3.0/deed.en
    # trackback http://ubuntuforums.org/showthread.php?t=960627
    
    # Location of source videos READ this !!! add your user name !
    sourcelocation="/home/ your user name goes here /Videos/"
    # Extension of source videos
    sourceext="avi"
    
    # grab thumbs hehehe ! yahhoo hope this works!
    find ${sourcelocation} -iname "*${sourceext}" -exec ffmpeg -v 0 -y -i {} -vframes 1 -ss 90 -vcodec mjpeg -f rawvideo -s 286x160 -aspect 16:9 {}.jpg \;
    # Check to see if videos were encoded, then delete source vids and shutdown
    if [ -e "${sourcelocation}/*.avi" ] && [ -e "${sourcelocation}/*.jpg" ]; then
    	# Delete videos	
    	rm ${sourcelocation}/*.dv
    	# Sleep for 10 seconds before shutting down
    	sleep 10
    	# Shutdown computer
    	# sudo shutdown -h now
    else
    	echo "Encoding FAILED"
    fi
    
    
    # Convert all video clips to ITU H264 OGM video container
    find ${sourcelocation} -iname "*${sourceext}" -exec mencoder {} -o {}.ogm -af volume=10 -aspect 16:9 -of avi -noodml -ovc x264 -x264encopts bitrate=300:level_idc=41:bframes=3:frameref=2: nopsnr: nossim: pass=1: threads=auto -oac mp3lame \;
    
    
    
    exit
    You can remove the text I colored red because you are not using .dv files and you commented out the shutdown command that the original poster wanted.

  4. #14
    Join Date
    May 2007
    Beans
    601

    Re: Automating video conversion for a beginner

    You have reminded me to post my own recording script. You may be interested in some of the code. See my post http://ubuntuforums.org/showthread.php?t=1169204

  5. #15
    Join Date
    Mar 2009
    Location
    The Moon
    Beans
    130
    Distro
    Ubuntu

    Smile Re: Automating video conversion for a beginner

    it seems that cron job only encoding one video. and doesn't get jpg :O and misses the other videos. I've figured to test it with 15 mints which I did, so the same thing happens encodes the video everything OK but no jpg

    I've set the bash to
    Code:
    chmod u+x h264
    and set the cron like this

    crontab - e

    Code:
    */1 * * * * /usr/bin/h264
    I'm wondering is this because I moved the thumb code above the encoding code ?

    I also uncommented Delete , it also doesn't seem to be deleting the .avi source file
    .


    sorry that part I like it to stay there, since its a little different script that deals with avi not dv like the original I've changed that dv into avi instead. hopefully things should run smooth but if its not working. it will be removed and replaced with something that works.

    so far CronTab is not working fully with this bash script. maybe due to permission issues. will ask some more on irc



    / i see, maybe i should run the ffmpeg and mencoder with SUDOERS instead, maybe this is why script only encodes 1 video and doesnt get jpg
    Last edited by mysoogal; May 25th, 2009 at 04:36 AM.
    sudo -s

  6. #16
    Join Date
    May 2007
    Beans
    601

    Re: Automating video conversion for a beginner

    Using exec causes problems in some scripts you might check that.

  7. #17
    Join Date
    Mar 2009
    Location
    The Moon
    Beans
    130
    Distro
    Ubuntu

    Smile Re: Automating video conversion for a beginner

    Quote Originally Posted by xzero1 View Post
    Using exec causes problems in some scripts you might check that.
    -exec /usr/local/bin/ffmpeg
    fixed it it seems.

    found this perfect crontab GUI called

    sudo Install Gnome-schedule
    it runs very well with this script just make new recurrent with every hour and script path.

    /usr/bin/scriptname
    it encoded every video and grabbed thumbs. now have to figure out why its not deleting the input file after encoding finished


    next features maybe move the encoded videos to somewhere else and input that information to sql and a simple php file to view the videos.
    sudo -s

  8. #18
    Join Date
    Jul 2011
    Beans
    2

    Re: Automating video conversion for a beginner

    Hi,

    i didnt want all the videos downloaded from say youtube using either "get_flash_videos" or "minitube" split into all those pesky parts...

    (i think there are gui based automated ways of doing this, but wheres the fun in that :s)

    having read part of the ffmpeg man http://www.ffmpeg.org/faq.html#How-c...deo-files_003f i also didnt want to have to do run the commands...

    ffmpeg -i input1.avi -same_quant intermediate1.mpg ffmpeg -i input2.avi -same_quant intermediate2.mpg cat intermediate1.mpg intermediate2.mpg > intermediate_all.mpg ffmpeg -i intermediate_all.mpg -same_quant output.avi

    (if there are a lot of files, id be waiting around a long time... (damb not just being able to cat > *.mp4 files) so I found this thread!)

    here is my edited version of whats been done here....
    as you can see i have very, very limited knowledge of bash scripting and almost as little with knowing the tools like grep, cat, rm! lol

    Code:
     #!/bin/bash
    # Location of source videos
    sourcelocation="/home/me/Videos/convo"
    # Extension of source videos
    sourceext="mp4"
    # Extention of temp converted files
    conversionext="mpg"
    
    # Convert all video clips to mpg video container (so can be joined to one file)
    find ${sourcelocation} -iname "*.${sourceext}" -exec /usr/local/bin/ffmpeg -i {} -same_quant {}.mpg \;
    
    # join to one file
    find ${sourcelocation} -iname "*.mpg" | cat *.mpg > $file.mpg
    
    # converting back from mpg to mp4
    /usr/local/bin/ffmpeg -i ${sourcelocation}/$file.mpg -same_quant $file.mp4
    
    # remove temp mpg containers created for joining files together
    grep "*.$conversionext" $sourcelocation | rm *.$conversionext
    My question here appart from the obvious "How can i make this better!?"

    where i need to "join to one file"
    find ${sourcelocation} -iname "*.mpg" | cat *.mpg > $file.mpg
    what other commands can i use to name the newly created $file.mpg

    sed?

    i would like to use the original filename minus the part_1 part_2 etc.. so that i could grep and move that to another dir at the end, so that all the contents of the convo folder can be del after....

    an obvious limitation to this script is that the folder can contain only the one film for example. otherwise it would join lots of different shows/films together. Again, if i knew a good way - rather than just using wildcards - i think that would solve it.

    Thanks

Page 2 of 2 FirstFirst 12

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
  •