VideoHelp Forum




+ Reply to Thread
Results 1 to 7 of 7
  1. Hey guys, so I have a folder of videos that have a H.264 codec, but contain an AVI wrapper. I decided I want to convert them all to have a MP4 wrapper.

    I noticed initially using this code:

    @ECHO OFF
    for %%a in (*.avi) do ffmpeg -i "%%a" -vcodec copy -acodec copy -f mp4 -y "%%~na".mp4

    Some files will convert just fine, however, others will stay at 1KB and it will simply move to the next file. So, upon scrolling, I also tried this code:

    @ECHO OFF
    for %%a in (*.avi) do ffmpeg -i "%%a" -vcodec copy -f mp4 -y "%%~na".mp4


    With this code, all my files converted successfully. I did notice however that the original bit rate of the audio of the AVI wrapped files were 192kb. However, the audio of the MP4's are only 131KB. Thus, I'm not sure if I'm now losing audio quality.

    Is there a way to add to this code, or is it because it is recompiling the audio in the second code that is causing the issue?
    Quote Quote  
  2. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Search Comp PM
    What is the audio codec in the files that doesn't work with the first command? Check the avi with for example MediaInfo.


    You can add
    Code:
    -b:a 192k
    to set the bitrate

    And if you want to set the audio codec use aac audio
    Code:
    -c:a libfdk_aac
    Examples: https://trac.ffmpeg.org/wiki/Encode/AAC https://trac.ffmpeg.org/wiki/Encode/H.264
    Last edited by Baldrick; 31st May 2016 at 02:19.
    Quote Quote  
  3. I think I figured out the issue for the code not working for all the files. For the files that worked with this code, they had the MPEG Audio (MP3) codec. The ones that stayed at 1KB, had this audio codec: AC-3.

    Could you show me where I would add the bit rate code: -b:a 192k in this code, and what if I want to have all the files have the MPEG Audio (MP3) codec? Is there a way to do that as well.

    Code:
    @ECHO OFF
    for %%a in (*.avi) do ffmpeg -i "%%a" -vcodec copy -acodec copy -f mp4 -y "%%~na".mp4
    Quote Quote  
  4. Originally Posted by Jdan93 View Post

    Could you show me where I would add the bit rate code: -b:a 192k in this code, and what if I want to have all the files have the MPEG Audio (MP3) codec? Is there a way to do that as well.

    Code:
    @ECHO OFF
    for %%a in (*.avi) do ffmpeg -i "%%a" -vcodec copy -acodec copy -f mp4 -y "%%~na".mp4
    Instead of "-acodec copy", use "-acodec libmp3lame -b:a 192k"

    Code:
    @ECHO OFF
    for %%a in (*.avi) do ffmpeg -i "%%a" -vcodec copy -acodec libmp3lame -b:a 192k -f mp4 -y "%%~na".mp4
    Quote Quote  
  5. Awesome, thank you so much for your help!
    Quote Quote  
  6. DECEASED
    Join Date
    Jun 2009
    Location
    Heaven
    Search Comp PM
    Originally Posted by Jdan93 View Post
    ......

    The ones that stayed at 1KB, had this audio codec: AC-3.
    Then there is (yet another) bug in FFmpeg. Because AC3 in the MP4 container is valid and possible "since ages ago"
    Quote Quote  
  7. Originally Posted by El Heggunte View Post
    Originally Posted by Jdan93 View Post
    ......

    The ones that stayed at 1KB, had this audio codec: AC-3.
    Then there is (yet another) bug in FFmpeg. Because AC3 in the MP4 container is valid and possible "since ages ago"
    This has been fixed in ffmpeg ages ago too - possibly the OP is using an old binary ?

    But AC3 in MP4 still gives some devices problems with playback
    Quote Quote  



Similar Threads

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