Profile picture for Admin

A few months ago I’ve faced up with a task converting audio track in video file to another format in Windows. There are not much simple programs to do this task. The task is simple: convert any audio track to mp3 without converting video track. All programs that were tested propose to convert video and audio track without any options to copy video stream. This case increase a time of converting a lot and was dismissed by default.

I decided to use ffmpeg program. In Linux it’s easy to write the converter script, but in Windows I never faced up with such task.


  • convert audio stream to mp3,
  • copy video stream,
  • script cmd for Windows
  • batch converter


@echo off

ECHO =========================

setlocal enabledelayedexpansion

set argCount=0
for %%x in (%*) do (
   set /A argCount+=1
   set "argVec[!argCount!]=%%~x"
   set "argFex[!argCount!]=%%~nxx"

echo Number of files to process: %argCount%

for /L %%i in (1,1,%argCount%) do (
  echo Processfile !argVec[%%i]!
  cmd /k C:\ffmpeg.exe -i "!argVec[%%i]!"  -c:v copy -c:a libmp3lame "C:\convert\!argFex[%%i]!"
  echo File saved at C:\convert\!argFex[%%i]! 

explorer.exe C:\convert

ECHO =========================



First loop check arguments and write them to array. In the second loop the call of ffmpeg initiated with needed parameters for converting video file.

At the end of the process folder with converted files opened.

Add new comment

The content of this field is kept private and will not be shown publicly.
  • No HTML tags allowed.
  888888ba    88888888b  dP     dP   dP     dP   888888ba  
88 `8b 88 88 88 88 88 88 `8b
a88aaaa8P' a88aaaa 88aaaaa88a 88aaaaa88a 88 88
88 `8b. 88 88 88 88 88 88 88
88 88 88 88 88 88 88 88 .8P
dP dP 88888888P dP dP dP dP 8888888P

Enter the code depicted in ASCII art style.