VideoHelp Forum
+ Reply to Thread
Results 1 to 22 of 22
Thread
  1. Hi.

    Linux user here (Linux Lite 4.2)

    I have a folder with multiple sound files in with .aac extension. I opt to use them to play on a car stereo, and this car player is very picky on aac files (it accept less than half of aac files in a normal day)

    So I found out using ffmpeg to clean out any unused metadata and possible other non-auditible information using this command:
    ffmpeg -i 'input.aac' -vn -c:a copy 'output.aac'

    I want to do this for several files. According to this thread in unix.stackexchange forum, it should be easilly done by using the find command.

    However - I have tried several variation of the command (using the example from unix.stackexchange forum), but without any success. This is the commands I have tried so far:
    Code:
    find . -name "*.aac" -exec ffmpeg -i {}  -vn -c:a copy 2_{}
    find . -name "*.aac" -exec ffmpeg -i {}  -vn -c:a copy 2_{} \;
    find . -name "*.aac" -exec ffmpeg -i {}  -vn -c:a copy NEW{} \;
    find . -name "*.aac" -exec ffmpeg -i {}  -vn -c:a copy NEW{}\;
    find . -name "*.aac" -exec ffmpeg -i {}  -vn -c:a copy NEW{} \;
    find . -name "*.aac" -exec ffmpeg -i '{}'  -vn -c:a copy 'NEW{}'\;
    I usually got an error message like this (for every file):
    NEW./input-file-name.aac: No such file or directory

    I wonder that there may be some issues because the forum is written for unis and I'm using Linux Lite (Ubuntu based)
    Last edited by Prototype v1.0; 7th Aug 2019 at 12:43. Reason: solved
    Quote Quote  
  2. That doesn't mention multiple files.
    Quote Quote  
  3. Originally Posted by Prototype v1.0 View Post
    That doesn't mention multiple files.
    How to convert multiple files:
    https://forum.videohelp.com/threads/356314-How-to-batch-convert-multiplex-any-files-with-ffmpeg

    Your problem may be related with aac bitstream format - consider to use ffmpeg bitstream filter https://ffmpeg.org/ffmpeg-bitstream-filters.html#aac_005fadtstoasc (not tested so consider my advise as humble suggestion - ADTS should be supported by HW players but...).
    Quote Quote  
  4. Thanks, pandy.
    I read the thread you linked to, but the discussion was mostly about Windows commands.

    My fault : I see I haven't mentioned I use Linux only. Anyway, that thread should cover that too.
    I going to put in that information in first post / topic (hope that is not too rude of me . . )

    So if I don't find a solution for one-line command I can run in Terminal, I guess I have to find out how to make a .sh schript to process many files.
    Quote Quote  
  5. Member
    Join Date
    Feb 2006
    Location
    United States
    Search Comp PM
    there is also the ffmpeg documentation - https://ffmpeg.org/ffmpeg.html
    Quote Quote  
  6. Update:

    I have got help on a workaround on a local forum. I didn't end up with a solution that I could enter directly in Terminal, but I got help with a sample shell script that I managed to:
    • Run ffmpeg on all files in current dir
    • Using touch command to set tate for converted files similar to the original file
    • Renaming files so that the original files change the name.
    Code: [Select]

    Code:
    #!/bin/bash
    for i in *.aac
    do
        echo ""
        ffmpeg -i "$i" -vn -c:a copy "NEW_$i"
        touch -cm --reference="$i" "NEW_$i"
        mv "$i" "OLD $i"
        mv "NEW_$i" "$i"
        echo ""
    done
    This solves the problem for me
    Quote Quote  
  7. Originally Posted by Prototype v1.0 View Post
    Update:

    I have got help on a workaround on a local forum. I didn't end up with a solution that I could enter directly in Terminal, but I got help with a sample shell script that I managed to:
    • Run ffmpeg on all files in current dir
    • Using touch command to set tate for converted files similar to the original file
    • Renaming files so that the original files change the name.
    Code: [Select]

    Code:
    #!/bin/bash
    for i in *.aac
    do
        echo ""
        ffmpeg -i "$i" -vn -c:a copy "NEW_$i"
        touch -cm --reference="$i" "NEW_$i"
        mv "$i" "OLD $i"
        mv "NEW_$i" "$i"
        echo ""
    done
    This solves the problem for me
    Good!, Consider to provide your solution also in "Windows" topic, not many Videohelp users use ffmpeg but i think it is highly welcomed any solution that solve people problems - as bash is way more advanced than simple Windows CLI then normally Linux users can process data more efficiently.
    Quote Quote  
  8. [QUOTE=pandy;2556965]
    Originally Posted by Prototype v1.0 View Post
    Good!, Consider to provide your solution also in "Windows" topic, not many Videohelp users use ffmpeg but i think it is highly welcomed any solution that solve people problems - as bash is way more advanced than simple Windows CLI then normally Linux users can process data more efficiently.
    Well, that is a bit hard as I'm not getting to buy more Windows licenses when Windows 7 is not supported anymore.

    If I was using Windows however, I would prefer to use Autohotkey over a bat file to solve that.
    Quote Quote  
  9. Your original problem is the wildcard '*', it probably worked once but then failed on subsequent files because they had already been recognized. The solution as you found out is to loop through each file name it finds and automatically apply the action to them individually.

    If you save the code as 'something.sh' and make it executable it will work as a command line instruction in the way you originally wanted.

    Brian.
    Quote Quote  
  10. There's a long thread here with many ffmpeg for Windows examples:

    https://forum.videohelp.com/threads/356314-How-to-batch-convert-multiplex-any-files-with-ffmpeg

    I don't know how to "touch" the new file with the old file's dates and times, but otherwise the equivalent of the OP's final script:
    Code:
    for %%F in (*.aac) do (
        ffmpeg -i %%~nxF -vn -c:a copy "NEW_%%~nxF"
        REM equivalent of touch goes here
        ren %%~nxF "OLD %%~nxF"
        ren "NEW_%%~nxF" %%~nxF
    )
    Quote Quote  
  11. You don't have "touch" in Windows, it's a Linux/BSD command.

    But then again : I prefer Autohotkey over .bat also for that reason.
    Quote Quote  
  12. Originally Posted by Prototype v1.0 View Post
    Well, that is a bit hard as I'm not getting to buy more Windows licenses when Windows 7 is not supported anymore.
    Windows 7 is officially supported till 2020 and both OS's (Windows and Linux) are impacted by some limitations - i use currently both, have more experience with Windows on PC and Unix like on non-PC - biggest Linux limitations for today is lack of decent HW acceleration - this limit seriously Linux community.
    Quote Quote  
  13. Member
    Join Date
    Feb 2006
    Location
    United States
    Search Comp PM
    Originally Posted by Prototype v1.0 View Post
    You don't have "touch" in Windows, it's a Linux/BSD command.

    But then again : I prefer Autohotkey over .bat also for that reason.

    can you not use WINE to run windows programs ??
    Quote Quote  
  14. Thank you for your interrest, mr october - but I've settled in to Linux now, the problem is solved, and I have no reason for using windows programs
    Quote Quote  
  15. Originally Posted by Prototype v1.0 View Post
    Thank you for your interrest, mr october - but I've settled in to Linux now, the problem is solved, and I have no reason for using windows programs
    If I understood correctly: Pandy was suggesting you post the Windows equivalent so that you might help Windows users, not for your benefit. That's why I posted the example.
    Quote Quote  
  16. Originally Posted by jagabo View Post
    If I understood correctly: Pandy was suggesting you post the Windows equivalent so that you might help Windows users, not for your benefit. That's why I posted the example.
    I understood it different, because Wine is usually something you install on Linux/BSD to be able to run windows program. You won't install Wine on Windows.

    I would like to have a Windows solution too. Problem for me is I don't have any Windows computer at home (yes I'm one of those guys that cannot effort licence money) so I cannot practice to make a working bat file.
    Also, Windows - as far I know - doesn't have an alternative too for touch (can set date on files), so that obviously won't work either.

    I wonder - If a phyton script file would be working on any OS (requires ffmpec command line rules being the same for windows and Linux/BSD builds). But I haven't learned phyton
    Quote Quote  
  17. Originally Posted by Prototype v1.0 View Post
    Originally Posted by jagabo View Post
    If I understood correctly: Pandy was suggesting you post the Windows equivalent so that you might help Windows users, not for your benefit. That's why I posted the example.
    I understood it different, because Wine is usually something you install on Linux/BSD to be able to run windows program. You won't install Wine on Windows.
    Pandy never mentioned wine.

    Originally Posted by Prototype v1.0 View Post
    Also, Windows - as far I know - doesn't have an alternative too for touch (can set date on files), so that obviously won't work either.
    There are Windows equivalents for many *nix/bsd utilities. I have a very old version of touch for DOS. But it doesn't run on 64 bit Windows. And it can only apply the current time/date to the file(s), not copy them from another file.
    Quote Quote  
  18. Originally Posted by Prototype v1.0 View Post
    I wonder - If a phyton script file would be working on any OS (requires ffmpec command line rules being the same for windows and Linux/BSD builds).
    Python works, It is even pre-installed, like on Ubuntu. It is nice to have something for Windows done in a code and then just using it on Linux as well. Usually there are some errors or outcome not as expected, because there are Linux-Windows differences, but googling usually gets you on the track to fix it. Basic code usually works right away on both systems. (reminds me scenarios for tuning up php code for windows explorer and rest of browsers )

    Using ffmpeg you need to use subprocess, for example for ffmpeg something like that:
    https://forum.videohelp.com/threads/393606-Add-a-variable-to-a-python-file-running-ffm...eg#post2554268
    encoding files to mp4 from directory and log it with custom input

    sure, not one line commands it gets more elaborate, but as python you go modules and use those for different tasks or calling one another.
    Instead of subprocess modul, older os.system can be used. It outputs in terminal as if you ran just command line, but you cannot do much more elaborate stuff further controlling output, logs etc.
    Quote Quote  
  19. Member
    Join Date
    Feb 2006
    Location
    United States
    Search Comp PM
    Originally Posted by Prototype v1.0 View Post
    Originally Posted by jagabo View Post
    If I understood correctly: Pandy was suggesting you post the Windows equivalent so that you might help Windows users, not for your benefit. That's why I posted the example.
    I understood it different, because Wine is usually something you install on Linux/BSD to be able to run windows program. You won't install Wine on Windows.

    I would like to have a Windows solution too. Problem for me is I don't have any Windows computer at home (yes I'm one of those guys that cannot effort licence money) so I cannot practice to make a working bat file.
    Also, Windows - as far I know - doesn't have an alternative too for touch (can set date on files), so that obviously won't work either.

    I wonder - If a phyton script file would be working on any OS (requires ffmpec command line rules being the same for windows and Linux/BSD builds). But I haven't learned phyton
    you can run windows from a flash drive, same way you can run LINUX from a flash drive
    Quote Quote  
  20. Ok - I give it at try, but I do certainly not guarantee it will work.

    There is two things to check: First, I'm not sure the for loop syntax is all correct. Second, this assumes that the ffmpeg have same syntax on Windows.

    Code:
    For /R %%G in (*.aac)  DO (
      ffmpeg -i "%%G" -vn -c:a copy "NEW_%%G"
      ren  "%%G" "OLD_%%G"
      ren  "NEW_%%G" "%%G"
      REM Here I should add a command to update date of files, but
      REM you probably have to find some tool online to do that.
     Echo "" )
    Quote Quote  
  21. Member
    Join Date
    Feb 2006
    Location
    United States
    Search Comp PM
    Originally Posted by Prototype v1.0 View Post
    Ok - I give it at try, but I do certainly not guarantee it will work.

    There is two things to check: First, I'm not sure the for loop syntax is all correct. Second, this assumes that the ffmpeg have same syntax on Windows.

    Code:
    For /R %%G in (*.aac)  DO (
      ffmpeg -i "%%G" -vn -c:a copy "NEW_%%G"
      ren  "%%G" "OLD_%%G"
      ren  "NEW_%%G" "%%G"
      REM Here I should add a command to update date of files, but
      REM you probably have to find some tool online to do that.
     Echo "" )
    try this - https://askubuntu.com/questions/62492/how-can-i-change-the-date-modified-created-of-a-file
    Quote Quote  



Similar Threads

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