Author Topic: Trying to write a batch script for 100%-same copy, can't seem to figure out ...  (Read 575 times)

timoteo

  • Newbie
  • *
  • Posts: 5
Hi:

I just want to take a bunch of MP4 files and have them re-saved (through AVIDEMUX) as the almost the same exact MP4 files.  I do this in AVIDEMUX simply by choosing "Copy" for both Video and Audio and I set the OUTPUT to "MP4 Muxer" OR LATELY "MP4v2 Muxer", as it seems to make the files more compatible and leaves just about everything else within the original container/codec the same.

I tried reading the bat scripting help page, and using an example file, but I keep getting AVI files (with an MP4 extension).  I tried using the word "copy" for the codecs, but that just produces a video with sound only.  I then tried x264, but get the aforementioned AVI.

Here is what I tried:

"set avidemux="C:\Program Files\Avidemux 2.6 - 64bits\avidemux.exe"
set videocodec=x264
set audiocodec=
for %%f in (*.mp4) do %avidemux% --video-codec %videocodec% --audio-codec %audiocodec% --force-alt-h264 --load "%%f" --save "%%f fixed.MP4" --quit"

Any help with this would be GREATLY appreciated!

Thanks,
Tim

eumagga0x2a

  • Hero Member
  • *****
  • Posts: 1462
You might try to add

--output-format MP4V2

command line option or use a project file.

timoteo

  • Newbie
  • *
  • Posts: 5
Thanks! I'll give that a try.

And to use a project file I would just enter the load project file command into the batch file along with the name of the project, is that correct?

timoteo

  • Newbie
  • *
  • Posts: 5
Worked like a charm!  Although I just had to remove the "x264" from the videocodec line ... otherwise it would keep rendering as an AVI and re-compressing.  Once that was removed it made a (QUICK) copy.

I don't why, but MP4 files from my Canon XA-25 suddenly stopped working in After Effects.  Older files recorded exactly the same still work, but newer files keep causing an error.  The files will play in literally everything else.  However, when I run the files through AVIDEMUX (same-in same-out), they work just fine in AE afterwards.

Any idea why?  (Maybe need to do a separate post.)  Looking at the properties they are nearly identical.  Really weird.  Just glad I found a solution.

eumagga0x2a

  • Hero Member
  • *****
  • Posts: 1462
If remuxing without reencoding allows the video files to be loaded successfully, the most probable cause of incompatibility would be some metadata the camera writes to the container.

timoteo

  • Newbie
  • *
  • Posts: 5
Thanks, eumagga ... that's what I was thinking as well.  But the perplexing thing is ... why would the camera start writing corrupt (or incompatible) metadata to the MP4's out of the clear blue. 

The only other thing I can think of is a portion of the SD card was slightly corrupted, and so as it started to fill up, the region with the corruption started getting written to with the later MP4's, and thus they were semi-corrupted.  I know ... pretty thin, but I can't think of anything else.  (Guess it's possible the camera just started screwing up the MP4's, but seems improbable.)

-Tim

mean

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 10946
you should test your sdcard
There is a tool for that, used mostly to detect fake sdcard
(i.e. a 8 GB that pretends to be 64 GB and wrap around as soon as you exceed 8 GB)

dosdan

  • Jr. Member
  • **
  • Posts: 61
you should test your sdcard
There is a tool for that, used mostly to detect fake sdcard
(i.e. a 8 GB that pretends to be 64 GB and wrap around as soon as you exceed 8 GB)

H2TESTW is a small handy tool to test for this (and to measure R/W transfer speeds with large 1GB files). For Windows. Can be switched between German & English language:

https://www.heise.de/download/product/h2testw-50539

Dan.



« Last Edit: August 14, 2017, 10:31:13 PM by dosdan »

Jan Gruuthuse

  • Hero Member
  • *****
  • Posts: 5593
or
- SD card is to slow to save the video recording, HD or higher resolution, in your (photo)camera.
- SD card needs formatting in (photo)camera. from time to time some recommend to reformat sd card
- You are processing video on SD card, always transfer source video to hard disk for editing (never on usb, sd, ...)
- Batteries in (photo)camera getting to hot. Can't cope with the power drain in video mode.
- ...


timoteo

  • Newbie
  • *
  • Posts: 5
Thanks, Mean and Dosdan!  I'll give that a check ... very cool tool indeed.  I switched to recording AVCHD.  AE doesn't seem to have any problems with MTS files.  And MTS are much better for editing anyway I remembered.

or
1- SD card is to slow to save the video recording, HD or higher resolution, in your (photo)camera.
2- SD card needs formatting in (photo)camera. from time to time some recommend to reformat sd card
3- You are processing video on SD card, always transfer source video to hard disk for editing (never on usb, sd, ...)
4- Batteries in (photo)camera getting to hot. Can't cope with the power drain in video mode.
- ...

Thanks, Jan, however ...

1 -  Card(s) is/are plenty fast enough ... easily exceed many times the required speed.
2 - Could be this.  I did reformat the card as a precaution, even though I switched to MTS files.
3 - No!  I would never do that, lol!  Transferred to a RAID0 array immediately when I get back to my system.
4 - Nope ... not using batteries.  But good thinking!

Thanks again!

-Tim