VideoHelp Forum
+ Reply to Thread
Page 1 of 2
1 2 LastLast
Results 1 to 30 of 34
Thread
  1. Hi all,
    I am new on videohelp, and have a problem to ask to you.

    Is there is a batch program to swap audio between Left and Right Channel for an AVI file?

    Cause in all my AVI file, 5% of those files have the voice channel at the left side. They are AVI Karaoke files.
    And it will be more convenient for me if I could have all of my AVI Karaoke files with the voice channel affected at the Right Channel.
    A Batch programm will really help me, cause I have an huge files in that case.

    Thank you in advance for all your helps.

    Noon.
    Quote Quote  
  2. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Search Comp PM
    I doubt you will find ONE software that does this.

    But you could use ffmpeg(demux and multiplex) and sox(swap channels) and write a custom batch file for this. They are command lines tools.

    Something like
    Code:
    ffmpeg -i video.avi -acodec copy audio.mp3
    sox audio.mp3 audioswap.mp3 swap 2 1
    ffmpeg -i video.avi -i audioswap.mp3 -vcodec copy -acodec copy newvideo.avi
    WHen you get that working you can make it in a batch/bat file.
    Quote Quote  
  3. Thank Baldrick. But I am not so good to write those code.
    Are those line there usable? or there is just a sample from you?

    I have seen the place to download there are static version, dev version which one I have to use, there are also 32 bits and 64 bits...
    I am a novice in high level computerize...
    Quote Quote  
  4. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Search Comp PM
    I guess it will work. If now the audio is in mp3 format. I have never tried the sox swap command though.

    You can try it. Put the ffmpeg.exe and sox.exe in for example c:\temp together with a video.avi file. Open a command prompt. Type cd c:\temp . Then copy and paste each command line and see what it says.
    Quote Quote  
  5. Thanks, I will try it and keep you update.
    Quote Quote  
  6. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Search Comp PM
    Try the 32 bit static versions for windows. It will work fine in both 32bit and 64bit systems.
    Quote Quote  
  7. After a first test I have an error for the second command line as below



    1. ffmpeg -i video.avi -acodec copy audio.mp3
    executed
    OK

    2. sox audio.mp3 audioswap.mp3 swap 2 1
    Executed
    Error The Application was unable to start correctly (0xc000007b)

    3. ffmpeg -i video.avi -i audioswap.mp3 -vcodec copy -acodec copy newvideo.avi
    Not yet test
    Quote Quote  
  8. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Search Comp PM
    Try just run sox without any commands. Just type sox

    You might need the entire sox folder.
    Quote Quote  
  9. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Search Comp PM
    You need a sox version with mp3 support also.

    Try
    Image Attached Files
    Quote Quote  
  10. I have copy all sox directory files to my temp1 directory, there is an message error as attached :

    41.jpg
    Image Attached Thumbnails Click image for larger version

Name:	41.jpg
Views:	1128
Size:	11.9 KB
ID:	16644  

    Quote Quote  
  11. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Search Comp PM
    Download the sox version I posted above. It works with a test mp3 I just tried.
    Quote Quote  
  12. Ok, I will uninstall and try the new version
    Quote Quote  
  13. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Search Comp PM
    You can just copy all the files in the version above to the temp folder.
    Quote Quote  
  14. After test with the new version
    Here is error message for 2. case
    "sox WARN swap: Invoking this effect with parameters is deprecatedl; use 'remis' instead."
    Quote Quote  
  15. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Search Comp PM
    That is just a warning and it should have made a newaudio.mp3. It can take some minutes.
    Quote Quote  
  16. In the 2. case line code I use Remix instead of SWAP It's works
    for MP3 new file is works, the voice is on the right channel (on the MP3 files)

    But the 3. case line command, after executed, the sound come back to the left side again.
    Quote Quote  
  17. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Search Comp PM
    I see. It doesn't use the new audio. It should look like

    Code:
    ffmpeg -i video.avi -i newaudio.mp3 -map 0 -map 1 -codec copy newvideo.avi
    Quote Quote  
  18. the swap MP3 filename is audioswap.mp3
    I have change it in your new command line, after executed.
    I have the same video from the beginning (voice on the left channel).
    But my audioswap.mp3 file play right (voice on the right channel)... we are nearly succeed...

    I think I know the problem, cause I hear the VOICE on boths channel, Left and Right.
    So the command line copy the newaudio.mp3 to the video.avi of the beginning.
    that already have VOICE on left channel.
    So we have VOICE on both channel with a delay created by the process.

    But I don't know who to write the command line for that.
    Perhaps it might have for command line.
    cause it is needed a video.avi without any sound.
    then mix with the newaudio.mp3 that have the right sound that I need.
    Last edited by noon; 7th Mar 2013 at 05:20.
    Quote Quote  
  19. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Search Comp PM
    Hmm...they have changed it a bit. Try

    Code:
    ffmpeg -i audioswap.mp3 -i video.avi -map 0.0 -map 1.0 -acodec copy -vcodec copy newvideo.avi
    (from http://cfc.kizzx2.com/index.php/muxing-audio-and-video-with-ffmpeg/ )
    Quote Quote  
  20. I have tried there is a message error "Invalide stream speficier: .0.


    But Baldrick, how about my idea to have a command line to create a video_unsound.avi file then mix with the audioswap.mp3 file that is what I really need?
    Quote Quote  
  21. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Search Comp PM
    Try then

    ffmpeg -i video.avi -vcodec copy -an video_unsound.avi

    and

    ffmpeg -i video_unsound.avi -i audioswap.mp3 -vcodec copy -acodec copy newvideo.avi
    Quote Quote  
  22. Yes, GREAAAAAAAAAAAAT!
    It works Baldrick.
    I can have it with all your helps. Thank you soooooo MUCH!
    It is the first time that I am member of videohelp, you are so kind and helpfull to me. Thank you, thank you.
    Quote Quote  
  23. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Search Comp PM
    You can now make a .bat batch for that to fix all avi files. I can help write it also.
    Last edited by Baldrick; 7th Mar 2013 at 05:50.
    Quote Quote  
  24. Thank you in advance for that.
    I have just send you a private message for a Web Media player, just in case...
    Quote Quote  
  25. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Search Comp PM
    Code:
    FOR %%f IN (*.avi) DO (
    ffmpeg -i %%~nf.avi -acodec copy %%~nf.mp3
    ffmpeg -i %%~nf.avi -vcodec copy -an %%~nf_unsound.avi
    sox %%~nf.mp3 %%~nf-swap.mp3 swap 2 1
    ffmpeg -i  %%~nf_unsound.avi -i %%~nf-swap.mp3 -vcodec copy -acodec copy c:\temp\newfolder\%%~nf-new.avi
    )
    Make a folder named newfolder in c:\temp
    Make a file called swap.bat in the c:\temp folder and open in notepad. Copy and paste the code above. Save.
    Run the swap.bat file from the command line and you will see if you get any errors.
    If it creates a video-new.avi in the folder it works.
    Copy some more avi files to the c:\temp folder and test run the swap.bat.
    Quote Quote  
  26. for 3rd line I replace SWAP by REMIX, it works (sox %%~nf.mp3 %%~nf-swap.mp3 remix 2 1)
    There is an error on 4th Line (final step). But I don't know where?


    Here is the one that work by manual for mix video and audio swapped.


    ffmpeg -i video_unsound.avi -i audioswap.mp3 -vcodec copy -acodec copy newvideo.avi
    Last edited by noon; 7th Mar 2013 at 07:53.
    Quote Quote  
  27. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Search Comp PM
    Does it look like

    ffmpeg -i %%~nf_unsound.avi -i %%~nf-swap.mp3 -vcodec copy -acodec copy c:\temp\newfolder\%%~nf-new.avi

    and you have the correct folder path?
    Quote Quote  
  28. Yes now it works.
    The mistake from my side was : new folder (per default windows create it with a space).

    You are a Master with the bath code Baldrick
    Now I will try with few avi in one time
    Quote Quote  
  29. Well Mr.Baldrick, you have just created for me a bath to swap Audio for AVI for me. It works good.
    I will save time in front of my computer.
    Thank you so much...
    Wishing helping all of those people like me always.
    Wishing a good luck and a good heath for such kindness you give to other people like me.

    Have a nice day.


    Noon.
    Quote Quote  
  30. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Search Comp PM
    Great!


    If anyone else finds this thread it might be good to know that you could also swap channels directly when you play, in for example vlc media player, audio->audio channels->reverse stereo. But you have do it manually for each file then.
    Quote Quote  



Similar Threads

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