Linux.com

jaaf

jaaf

  • Linux.com Member
  • Posts: 7
  • Member Since: 15 Jan 12
  • Last Logged In: 17 Jan 12

Latest Posts

Posted by
Topic
Post Preview
Posted
  • jaaf
    RE: trouble with name increment
    Thank you for this. I think I understand. I just have a little problem understanding the letter g in %03g (I am not a computer scientist even if already wrote programms in Java and C++). . I think I have to read the c printf function quietly.
    Link to this post 17 Jan 12

    Thank you for this. I think I understand. I just have a little problem understanding the letter g in %03g (I am not a computer scientist even if already wrote programms in Java and C++). . I think I have to read the c printf function quietly.

  • jaaf
    RE: trouble with name increment
    I read a bit about it but I cannot pretend I master it. I am very interrested in learing more as I am a beginner with bash scipting A few examples would be welcome.
    Link to this post 17 Jan 12

    I read a bit about it but I cannot pretend I master it.
    I am very interrested in learing more as I am a beginner with bash scipting

    A few examples would be welcome.

  • jaaf
    RE: trouble with name increment
    Ok thank you again. For my problem instead of using an index, I'll use a date based extension to the name like this : [code]ffmpeg -f alsa -ac 1 -i hw:1,0 -acodec flac -f x11grab -s $LARGEUR"x"$HAUTEUR -i :0.0+$DECALAGE_FENETRE -r 15 -vcodec libx264 -vpre lossless_ultrafast -y video`date +%Y`.`date +%m`.`date +%H`.`date +%M`.`date +%S`.mkv &[/code]
    Link to this post 16 Jan 12

    Ok thank you again.
    For my problem instead of using an index, I'll use a date based extension to the name like this :

    ffmpeg -f alsa -ac 1 -i hw:1,0 -acodec flac -f x11grab -s $LARGEUR"x"$HAUTEUR -i :0.0+$DECALAGE_FENETRE -r 15 -vcodec libx264 -vpre lossless_ultrafast  -y video`date +%Y`.`date +%m`.`date +%H`.`date +%M`.`date +%S`.mkv &

  • jaaf
    RE: trouble with name increment
    I went a little further This works (removing double quotes) : [code]filename=~/Bureau/video index=1 mystring=${filename}${index}.mkv ffmpeg -f alsa -ac 1 -i hw:1,0 -acodec flac -f x11grab -s $LARGEUR"x"$HAUTEUR -i :0.0+$DECALAGE_FENETRE -r 15 -vcodec libx264 -vpre lossless_ultrafast -y ${mystring}[/code] but this doesn't (replacing ~ with /home/user) [code]filename=/home/jaaf/Bureau/video #I am jaaf index=1 mystring=${filename}${index}.mkv ffmpeg -f alsa -ac 1 -i hw:1,0 -acodec flac -f x11grab -s $LARGEUR"x"$HAUTEUR -i :0.0+$DECALAGE_FENETRE -r 15 -vcodec libx264 -vpre lossless_ultrafast -y ${mystring}[/code] How comes ?
    Link to this post 16 Jan 12

    I went a little further

    This works (removing double quotes) :


    filename=~/Bureau/video
    index=1
    mystring=${filename}${index}.mkv

    ffmpeg -f alsa -ac 1 -i hw:1,0 -acodec flac -f x11grab -s $LARGEUR"x"$HAUTEUR -i :0.0+$DECALAGE_FENETRE -r 15 -vcodec libx264 -vpre lossless_ultrafast -y ${mystring}


    but this doesn't (replacing ~ with /home/user)


    filename=/home/jaaf/Bureau/video #I am jaaf
    index=1
    mystring=${filename}${index}.mkv

    ffmpeg -f alsa -ac 1 -i hw:1,0 -acodec flac -f x11grab -s $LARGEUR"x"$HAUTEUR -i :0.0+$DECALAGE_FENETRE -r 15 -vcodec libx264 -vpre lossless_ultrafast -y ${mystring}

    How comes ?

  • jaaf
    RE: trouble with name increment
    here is the full script (my first one -adaptation - so be indulgent) [code]#!/bin/sh #la ligne précédente indique que c'est un script bash. IL ne doit y avoir aucun caractère ou espace avant. #Une ligne qui commence par un dièse est un commentaire. Comme cette ligne. #Nous informons l'utilisateur echo "\n Vous démarrez un enregistrement vidéo. Veuillez cliquer sur la fenêtre à enregistrer\n" #Nous demandons au système les informations sur la fenêtre cliquée INFO_FENETRE=$(xwininfo -frame) #la commande attend le clic #Nous affichons les informations echo "\n Information sur la fenêtre \n" $INFO_FENETRE+"\n\n" LARGEUR=$(echo $INFO_FENETRE | grep -oEe 'Width: [0-9]+' | grep -oEe '[0-9]+' ) echo "Largeur trouvée : "$LARGEUR LARGEUR=$(($LARGEUR/2)) LARGEUR=$(($LARGEUR*2)) echo "Largeur corrigée : "$LARGEUR HAUTEUR=$(echo $INFO_FENETRE | grep -oEe 'Height: [0-9]+' | grep -oEe '[0-9]+') echo "Hauteur trouvée : "$HAUTEUR HAUTEUR=$(($HAUTEUR/2)) HAUTEUR=$(($HAUTEUR*2)) echo "Hauteur corrigée : "$HAUTEUR DECALAGE_FENETRE=$( echo $INFO_FENETRE | grep -oEe 'Corners:\s+\+[0-9]+\+[0-9]+' | grep -oEe '[0-9]+\+[0-9]+' | sed -e 's/\+/,/' ) echo "Décalage fenêtre: "$DECALAGE_FENETRE"\n\n" #nous affichons la commande pour détection d'erreur s'il y a lieu. #echo "\n ffmpeg -f alsa -ac 1 -i hw:1,0 -acodec flac -f x11grab -s "$LARGEUR"x$HAUTEUR -i :0.0+$DECALAGE_FENETRE -r 10 -vcodec libx264 -vpre lossless_ultrafast ~/Bureau/essai.mkv "+"\n\n" #la commande proprement dite filename="~/Bureau/video" index=1 #will deal with index later mystring="${filename}${index}.mkv" echo "ffmpeg -f alsa -ac 1 -i hw:1,0 -acodec flac -f x11grab -s $LARGEUR"x"$HAUTEUR -i :0.0+$DECALAGE_FENETRE -r 15 -vcodec libx264 -vpre lossless_ultrafast -y ${mystring}" [/code] the output is [code]ffmpeg -f alsa -ac 1 -i hw:1,0 -acodec flac -f x11grab -s 1042x360 -i :0.0+ -r 15 -vcodec libx264 -vpre lossless_ultrafast -y ~/Bureau/video1.mkv[/code] and the output command works!
    Link to this post 16 Jan 12

    here is the full script (my first one -adaptation - so be indulgent)


    #!/bin/sh
    #la ligne précédente indique que c'est un script bash. IL ne doit y avoir aucun caractère ou espace avant.
    #Une ligne qui commence par un dièse est un commentaire. Comme cette ligne.
    #Nous informons l'utilisateur
    echo "\n Vous démarrez un enregistrement vidéo. Veuillez cliquer sur la fenêtre à enregistrer\n"
    #Nous demandons au système les informations sur la fenêtre cliquée
    INFO_FENETRE=$(xwininfo -frame)
    #la commande attend le clic
    #Nous affichons les informations
    echo "\n Information sur la fenêtre \n" $INFO_FENETRE+"\n\n"
    LARGEUR=$(echo $INFO_FENETRE | grep -oEe 'Width: [0-9]+' | grep -oEe '[0-9]+' )
    echo "Largeur trouvée : "$LARGEUR
    LARGEUR=$(($LARGEUR/2))
    LARGEUR=$(($LARGEUR*2))
    echo "Largeur corrigée : "$LARGEUR
    HAUTEUR=$(echo $INFO_FENETRE | grep -oEe 'Height: [0-9]+' | grep -oEe '[0-9]+')
    echo "Hauteur trouvée : "$HAUTEUR
    HAUTEUR=$(($HAUTEUR/2))
    HAUTEUR=$(($HAUTEUR*2))
    echo "Hauteur corrigée : "$HAUTEUR
    DECALAGE_FENETRE=$( echo $INFO_FENETRE | grep -oEe 'Corners:\s+\+[0-9]+\+[0-9]+' | grep -oEe '[0-9]+\+[0-9]+' | sed -e 's/\+/,/' )
    echo "Décalage fenêtre: "$DECALAGE_FENETRE"\n\n"
    #nous affichons la commande pour détection d'erreur s'il y a lieu.
    #echo "\n ffmpeg -f alsa -ac 1 -i hw:1,0 -acodec flac -f x11grab -s "$LARGEUR"x$HAUTEUR -i :0.0+$DECALAGE_FENETRE -r 10 -vcodec libx264 -vpre lossless_ultrafast ~/Bureau/essai.mkv "+"\n\n"
    #la commande proprement dite

    filename="~/Bureau/video"
    index=1 #will deal with index later
    mystring="${filename}${index}.mkv"
    echo "ffmpeg -f alsa -ac 1 -i hw:1,0 -acodec flac -f x11grab -s $LARGEUR"x"$HAUTEUR -i :0.0+$DECALAGE_FENETRE -r 15 -vcodec libx264 -vpre lossless_ultrafast -y ${mystring}"

    the output is

    ffmpeg -f alsa -ac 1 -i hw:1,0 -acodec flac -f x11grab -s 1042x360 -i :0.0+ -r 15 -vcodec libx264 -vpre lossless_ultrafast  -y ~/Bureau/video1.mkv

    and the output command works!

  • jaaf
    RE: trouble with name increment
    hi, thank you for your help. I did what you suggested and it works fine. But what to do after that ? I tried to put the last echo line between back tits but the error message is still the same. [quote]~/Bureau/video1.mkv: No such file or directory[/quote]
    Link to this post 16 Jan 12

    hi, thank you for your help.
    I did what you suggested and it works fine.

    But what to do after that ? I tried to put the last echo line between back tits but the error message is still the same.

    ~/Bureau/video1.mkv: No such file or directory

  • jaaf
    trouble with name increment
    Hi, I am trying to write a script that records a window on my screen. No pb with that. To go further I would like to choose an incremental fileName for output incrementing if the fileName already exist. I have trouble doing it so before dealing with the incrementation itself, I want to check I can substitute the calculated name in the ffmpeg command. [code] filename="~/Bureau/essai" index=1 #I will deal with the incrementation of index after this part works mystring="${fileName}${index}.mkv" #omce I have a proper index I concatenate the name with index and name extension echo ${mystring} # gives ~/Bureau/essai1.mkv seems to be what I expect ffmpeg -f alsa ..... -y ${mystring} [/code] I get this message [quote] ~/Bureau/essai1.mkv No such file or directory [/quote] despite -y to force overwriting However if I put the file name directly in the command like this [code]ffmpeg -f alsa ..... -y ~/Bureau/essai1.mkv[/code] it works perfectly. My question is : "What is wrong ?"
    Link to this post 15 Jan 12

    Hi,
    I am trying to write a script that records a window on my screen. No pb with that.
    To go further I would like to choose an incremental fileName for output incrementing if the fileName already exist.
    I have trouble doing it so before dealing with the incrementation itself, I want to check I can substitute the calculated name in the ffmpeg command.


    filename="~/Bureau/essai"

    index=1 #I will deal with the incrementation of index after this part works

    mystring="${fileName}${index}.mkv" #omce I have a proper index I concatenate the name with index and name extension

    echo ${mystring} # gives ~/Bureau/essai1.mkv seems to be what I expect

    ffmpeg -f alsa ..... -y ${mystring}

    I get this message

    ~/Bureau/essai1.mkv No such file or directory

    despite -y to force overwriting


    However if I put the file name directly in the command like this


    ffmpeg -f alsa .....  -y ~/Bureau/essai1.mkv

    it works perfectly. My question is : "What is wrong ?"

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board