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:
I usually got an error message like this (for every file):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{}'\;
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)
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays!
+ Reply to Thread
Results 1 to 22 of 22
Thread
-
Last edited by Prototype v1.0; 7th Aug 2019 at 11:43. Reason: solved
-
-
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...). -
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. -
there is also the ffmpeg documentation - https://ffmpeg.org/ffmpeg.html
-
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:#!/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
-
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.
-
-
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. -
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 )
-
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. -
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.
-
-
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
-
-
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 -
Pandy never mentioned wine.
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. -
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. -
-
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 "" )
Similar Threads
-
ffmpeg - How to batch screen grab from multiple video files?
By Gameshow Host in forum Newbie / General discussionsReplies: 4Last Post: 2nd May 2019, 07:04 -
how to extract lossless audio from an MKV file - ffmpeg fails
By batemanj in forum Newbie / General discussionsReplies: 2Last Post: 17th Apr 2019, 07:50 -
running multiple files in sequence possible with ffmpeg?
By sommers in forum Newbie / General discussionsReplies: 6Last Post: 4th Jun 2017, 09:19 -
Using ffmpeg to extract frames from mts file fails
By Prototype v1.0 in forum Video ConversionReplies: 30Last Post: 1st May 2015, 00:39 -
How do I use FFMPEG to output an MPEG-TS file with multiple programs?
By Videogamer555 in forum Video ConversionReplies: 13Last Post: 31st Aug 2014, 05:45