VideoHelp Forum




+ Reply to Thread
Results 1 to 9 of 9
  1. Assume I want (have to) re-encode (wiht MP3) the audio part of an original video. I can do it by flags like:

    ffmpeg -i .... -acodec mp3 -ab 128 ...

    or

    ffmpeg -i .... libmp3lame -aq 5 ....

    Ok, but this way I define the output quality independently from the existing audio quality.
    Is there a way to tell ffmpeg:

    "Hey ffmpeg, I don't know the exact audio source quality but find out by yourself and auto-adjust
    the target audio quality by yourself so that the quality loss is minimal" ?

    As far as I know there was a flag like "-sameq" in the past but this seems to be deprecated/removed in newer versions of ffmpeg.

    Is there a corresponding new flag for that?

    Is there a corresponding new flag for video part (Xvid codec) as well?

    Thank you
    Peter
    Quote Quote  
  2. Member AlanHK's Avatar
    Join Date
    Apr 2006
    Location
    Hong Kong
    Search Comp PM
    May not be what you mean, but you can use the "copy" codec to have ffmpeg extract the audio from a video, basically just demuxing it, no conversion made.
    e.g., (assuming the video uses AAC audio)
    Code:
    ffmpeg -i %1 -vn -acodec copy %1.aac
    But if you're changing the audio codec, you do need to specify a bitrate, as there isn't a universal rule for equivalent bitrates in different codecs.
    Quote Quote  
  3. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Search Comp PM
    Sameq was just same quantizers if you converted between same codecs, see http://ffmpeg.org/trac/ffmpeg/wiki/Option%20'-sameq'%20does%20NOT%20mean%20'same%20quality''
    Quote Quote  
  4. Member
    Join Date
    Mar 2013
    Location
    Slovakia, Modra
    Search Comp PM
    I did ffmpeg -i Ramble_On__It_Might_Get_Loud.flv -vn -acodec Ramble_On__It_Might_Get_Loud.mp3 and it says I must specify at least one output file???? when I put copy after -acodec terminal says: Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
    Quote Quote  
  5. Member AlanHK's Avatar
    Join Date
    Apr 2006
    Location
    Hong Kong
    Search Comp PM
    Originally Posted by roberto32 View Post
    I did ffmpeg -i Ramble_On__It_Might_Get_Loud.flv -vn -acodec Ramble_On__It_Might_Get_Loud.mp3 and it says I must specify at least one output file???? when I put copy after -acodec terminal says: Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
    You specify the audio codec by: "-acodec XXX".
    In your original line line the XXX is "Ramble_On__It_Might_Get_Loud.mp3" which of course isn't a codec, and so then there is no output file either.
    -acodec copy
    is the same as the input.
    Are you sure your flv is MP3 audio?
    A lot are AAC.

    Do just
    ffmpeg -i Ramble_On__It_Might_Get_Loud.flv
    and it will tell you what video and audio codecs the file has.
    Quote Quote  
  6. Member
    Join Date
    Mar 2013
    Location
    Slovakia, Modra
    Search Comp PM
    yeah thanks it's aac, so i'll convert it into aac but is there an option to convert aac-mp3 with "same" bitrate or like the mp3 eqivalent of particular aac
    Quote Quote  
  7. Member
    Join Date
    Mar 2013
    Location
    Slovakia, Modra
    Search Comp PM
    I did ffmpeg -i $f -acodec copy $f.mp3 , it creates file but that file won't play and amarok says it's null....
    Quote Quote  
  8. Member
    Join Date
    Mar 2013
    Location
    Slovakia, Modra
    Search Comp PM
    Code:
    cd /media/data/robert/Videos/nekonvert
    while IFS= read -r line; do  ## line is stored in $line .. len nepozna -r =recursive 
    
    fname="${line%.*}" 
    e="${line##*.}" #extension
    echo "$fname"
    echo "$e"
    
    case "$e" in 
    mp4)
    ffmpeg -i $line -vn -acodec copy $fname.mp3
    #ffmpeg -i $line -vn -acodec $fname.mp3
    ;;   #konci moznost pre mp4
    
    flv) 
    ffmpeg -i $line -vn -acodec copy $fname.aac
    #ffmpeg -i $line -vn -acodec $fname.aac
    
    esac #case ends
    
    done < /media/data/robert/Videos/nekonvert/obsah.txt
    it creates an mp3/aac file with same name but won't play and amarok says it's null. I read output of that script and files were converting it looks OK. Original files are in nekonvert folder, and the fielnames are in obsah.txt
    Quote Quote  
  9. Member AlanHK's Avatar
    Join Date
    Apr 2006
    Location
    Hong Kong
    Search Comp PM
    Originally Posted by roberto32 View Post
    I did ffmpeg -i $f -acodec copy $f.mp3 , it creates file but that file won't play and amarok says it's null....
    I think you're using a Unix shell script, so I can't test it directly.
    But it looks like it assumes that mp4 all have mp3 audio, which is not true.

    That will create a file with the extension mp3, but won't make any conversion, it will just copy the original codec. So if it wasn't already MP3, it won't work.
    Last edited by AlanHK; 16th Oct 2013 at 21:12.
    Quote Quote  



Similar Threads

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