Page 1 of 1

Preparation before concatenation

Posted: 14 May 2019 02:22
by Sebastian42
I have one hundred and twenty m3u8 files that I want to combine into one. Each (?) individual file will open and play in VLC, so I want to make ONE video file from them.
The files are numbered in the extension, instead of in the filename : *.m3u81, *.m3u82, *.m3u83, *.m3u84 etc It seems to me I first need to move the varying digit out of the extension and into the filename : *1.m3u8, *2.m3u8, *3m3u8, *4.m3u8 before I can concatenate them. Am I right ? and if so, is there a BATCH method (or some other better one), rather than a manual one ?

Re: Preparation before concatenation

Posted: 15 May 2019 03:29
by miskox
If file format allows this then you could use

Code: Select all

copy *.m3u* new_file.m3u
Saso

Re: Preparation before concatenation

Posted: 15 May 2019 05:47
by Sebastian42
The very thing - thanks so much.

Re: Preparation before concatenation

Posted: 15 May 2019 06:56
by Sebastian42
Spoke too soon. Not knowing the components, I incorrectly assumed that because there was a result, it was a good result. So I am back to the request for a batch file to convert filename.ext1 to filename1.ext; filename.ext2 to filename2.ext; filename.ext3 to filename3.ext and so on 120 times. Once that is done, I know how to do the concatination/joining/merging.

Re: Preparation before concatenation

Posted: 15 May 2019 09:43
by aGerman
You could try that loop ...

Code: Select all

for /f "delims=" %%i in ('dir /a-d /b *.m3u8*') do (
  set "name=%%~ni"
  set "ext=%%~xi"
  setlocal EnableDelayedExpansion
  move /y "!name!!ext!" "!name!!ext:~5!.m3u8"
  endlocal
)
... but I'm afraid this will still not be the solution you are after, depending on how you proceed to merge these files.
Also try ...

Code: Select all

for /f "delims=" %%i in ('dir /a-d /b *.m3u8*') do (
  set "name=%%~ni"
  set "ext=%%~xi"
  setlocal EnableDelayedExpansion
  set /a "n=10000+!ext:~5!"
  move /y "!name!!ext!" "!name!!n:~-4!.m3u8"
  endlocal
)
Steffen

Re: Preparation before concatenation

Posted: 15 May 2019 22:17
by Sebastian42
The first set of commands did EXACTLY what I asked for. However, whereas Movie Maker joins many file types, it wont join m3u8. But that is a different kind of problem from what I came to this forum for. Thank you very much. I will try other joiners.

Else I will need a batch file that replaces ext1 with ext2, 120 times.

And I have that from a previous attempt at this :
copy /b *.m3u8 fullmovie.m3u8

That gives one long playable movie containing the 120 components - problem solved.

Re: Preparation before concatenation

Posted: 16 May 2019 10:02
by aGerman
What about that:

Code: Select all

for /f "delims=" %%i in ('dir /a-d /b *.m3u8*') do (
  set "name=%%~ni"
  set "ext=%%~xi"
  setlocal EnableDelayedExpansion
  set /a "n=10000+!ext:~5!"
  move /y "!name!!ext!" "!name!!n:~-4!.m3u8"
  endlocal
)

>"fullmovie.m3u8" type nul
for /f "delims=" %%i in ('dir /a-d /b /on *.m3u8') do (
  copy /b "fullmovie.m3u8" + "%%i"
)
Steffen

Re: Preparation before concatenation

Posted: 16 May 2019 13:50
by Sebastian42
I did need to convert M3U8 so that it would play faultlessly in VLC - and I found that in ONLY Xilisoft Video Converter, so the job is done.

Thank you for yet another another batch file - I understand even less of that than the previous ones, but will keep it handy in the unlikely case such a situation arises again.