News:

--

Main Menu

How to append 500 mp4 files into single video?

Started by avilon, January 30, 2021, 08:04:32 PM

Previous topic - Next topic

avilon

Avidemux 2.7.5

I have 1645 dash camera mp4 clips 60 sec. each, named sequentially GRMN0010 - GRMN1655.
How to append these in 300-400 files in batches (by trip days).?
Drag and drop likely isn't reliable as there is no easy way to check result.

Thanks for help.

butterw

1. you should put your file batches in separate folders.
2. you should then run a .py script (project) which loads all .mp4 file in a folder

what processing if any do you intend to do ?
 

avilon

I must rotate 180 degrees and perhaps experiment decreasing bit rate total 90GB of footage.
But I'd leave this as a second step.

I have some unsuccessful experiences with .py script.
I thought there might some easier solution, like loading from text file list in correct order.

butterw

It's easy as pie ;), I'll post the loading script in the patch submission subforum.
You can do the rest of the processing manually.

I would recommend you save your project settings when you've processed your first folder, so you can apply it to the other folders.
 


eumagga0x2a

#5
If it is preferable to append without pre-sorting files into different directories, then the following should do it with some graphical configuration:

# set a few important variables
ext = "mp4"
sep = "\\"
prefix = "GRMN"
# instantiate
adm = Avidemux()
gui = Gui()
# choose input directory
src = gui.dirSelect("Select the source folder")
if src is None:
    return 0
# create a list of all files with extension ext there
list = get_folder_content(src,ext)
if list is None:
    gui.displayError("Error","No " + ext + " files found in \"" + src + "\"")
    return 0
# create configuration dialog
spinStart = DFInteger("Start at file no.",0,9999)
spinStart.value = 10
spinNumber = DFInteger("Number of files to process:",1,500)
spinNumber.value = 300
dialog = DialogFactory("Multi-Append Setup")
dialog.addControl(spinStart)
dialog.addControl(spinNumber)
if 1 != dialog.show():
    return 0
# is there a sane method to format a string in tinyPy?
start = spinStart.value
number = spinNumber.value
appended = 0
for i in range(start,start+number):
    filename = prefix
    if i < 10:
        filename += "000"
    elif i < 100:
        filename += "00"
    elif i < 1000:
        filename += "0"
    filename += str(i) + "." + ext
    for e in list:
        if filename == basename(e):
            if not appended:
                if not adm.loadVideo(src + sep + filename):
                    gui.displayError("Error","Cannot load \"" + filename + "\"")
                    return 0
            elif not adm.appendVideo(src + sep + filename):
                gui.displayError("Error","Cannot append \"" + filename + "\"")
                return 0
            appended += 1
# done
if not appended:
    gui.displayError("Error","No files loaded")
    return 0
gui.displayInfo("The End",str(appended) + " files appended")
return 1

Important: please ensure hw accelerated decoding (on Windows: DXVA2) is disabled prior to appending a large number of files.

butterw

#6
There will be limit to what you can load and edit confortably in a single batch (>5 hours footage per day, huge filesize), so it may be necessary to break it down further and select the starting file and the number of files which will be processed in a folder. Start low for testing, save your project and don't delete the source files.
The issue with splitting the processing is that you have to keep track of the starting file for each run, and have to deal with split time.

butterw

#7
if not adm.appendVideo(fname): raise("! Cannot append ")

!!! On Win10, testing append with mp4 h264 with non-compatible dimensions, the TinyPy raise causes a crash here:
After the tinyPy exception is displayed, I get a Unknown runtime error.. Occurs with both DXVA2 and OpenGL

 

eumagga0x2a


butterw

#9
Quote from: eumagga0x2a on January 31, 2021, 05:16:10 PMWhat does admlog.txt say?

[Script] Tinypy INFO -

[Script] Tinypy INFO - import_fname
[Script] Tinypy INFO -
 
[Script] Tinypy INFO -     exec(code,g)
[Script] Tinypy INFO -

[Script] Tinypy INFO - ?
[Script] Tinypy INFO -
 
[Script] Tinypy INFO - if not adm.appendVideo("B:/mpc/a.mp4"): raise("Cannot append")
[Script] Tinypy INFO -

[Script] Tinypy INFO -
Exception:

[Script] Tinypy INFO - Cannot append
[Script] Tinypy INFO -

[draw] 19:19:28-929 D3D : Draw!
[refresh] 19:19:28-929 Refresh**
[draw] 19:19:28-952 D3D : Draw!
[refresh] 19:19:28-952 Refresh**
Saving crash file to B:\mpc\avidemux_64\settings\crash.py
Scripting video streams
Scripting segments
Scripting markers
Scripting post-processing
Scripting video encoder
Scripting video filters
Scripting audio tracks
Scripting muxer
RAX: 67204939  RBX: C0000028  RCX: 00000000  RDX: 028C9CB0  RSI: 008A9278  RDI: 6A8A3928  RSP: 008A8B40  RBP: 008A8C40
R8: 00000001  R9: 00000000  R10: 00000000  R11: 0040041E  R12: 6A820000  R13: 008A9820  R14: 6A891A2A  R15: 008A97C0
RIP: 6C6E2B10  EFlags: 00000202

UNKNOWN
RtlRaiseStatus  [ntdll.dll]
Crash Dump for ExceptionFilter
UNKNOWN
RtlRaiseStatus  [ntdll.dll]
ADM_setCrashHook  [libADM_core6.dll]
ADM_setCrashHook  [libADM_core6.dll]
ADM_setCrashHook  [libADM_core6.dll]
UnhandledExceptionFilter  [KERNELBASE.dll]
memset  [ntdll.dll]
_C_specific_handler  [ntdll.dll]
_chkstk  [ntdll.dll]
RtlWalkFrameChain  [ntdll.dll]
RtlRaiseStatus  [ntdll.dll]
memset  [ntdll.dll]
setjmpex  [msvcrt.dll]
unknown function  [libADM_script_tinyPy.dll]
unknown function  [libADM_script_tinyPy.dll]
unknown function  [libADM_script_tinyPy.dll]
unknown function  [libADM_script_tinyPy.dll]
unknown function  [libADM_script_tinyPy.dll]
unknown function  [libADM_script_tinyPy.dll]
unknown function  [libADM_script_tinyPy.dll]
unknown function  [libADM_script_tinyPy.dll]
unknown function  [libADM_script_tinyPy.dll]
unknown function  [libADM_script_tinyPy.dll]
unknown function  [libADM_script_tinyPy.dll]
unknown function  [libADM_script_tinyPy.dll]
unknown function  [libADM_script_tinyPy.dll]
createEngine  [libADM_script_tinyPy.dll]
A_appendVideo(char const*)  [avidemux_portable.exe]
MainWindow::scriptFileActionHandler()  [avidemux_portable.exe]
MainWindow::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)  [avidemux_portable.exe]
QMimeType::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)  [Qt5Core.dll]
QAction::activate(QAction::ActionEvent)  [Qt5Widgets.dll]
QMenu::setIcon(QIcon const&)  [Qt5Widgets.dll]
QMenu::leaveEvent(QEvent*)  [Qt5Widgets.dll]
QMenu::mouseReleaseEvent(QMouseEvent*)  [Qt5Widgets.dll]
QWidget::event(QEvent*)  [Qt5Widgets.dll]
QMenu::event(QEvent*)  [Qt5Widgets.dll]
QApplicationPrivate::notify_helper(QObject*, QEvent*)  [Qt5Widgets.dll]
QApplication::notify(QObject*, QEvent*)  [Qt5Widgets.dll]
QCoreApplication::sendSpontaneousEvent(QObject*, QEvent*)  [Qt5Core.dll]
QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool)  [Qt5Widgets.dll]
QDesktopWidget::qt_metacall(QMetaObject::Call, int, void**)  [Qt5Widgets.dll]
QDesktopWidget::qt_metacall(QMetaObject::Call, int, void**)  [Qt5Widgets.dll]
QApplicationPrivate::notify_helper(QObject*, QEvent*)  [Qt5Widgets.dll]
QApplication::notify(QObject*, QEvent*)  [Qt5Widgets.dll]
QCoreApplication::sendSpontaneousEvent(QObject*, QEvent*)  [Qt5Core.dll]
QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*)  [Qt5Gui.dll]
QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*)  [Qt5Gui.dll]
QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>)  [Qt5Gui.dll]
QEventDispatcherWin32::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)  [Qt5Core.dll]
qt_plugin_instance  [qwindows.dll]
QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>)  [Qt5Core.dll]
QCoreApplication::exec()  [Qt5Core.dll]
UI_RunApp()  [avidemux_portable.exe]
startAvidemux(int, char**)  [avidemux_portable.exe]
SDL_main  [avidemux_portable.exe]
ms2timedisplay(unsigned int)  [avidemux_portable.exe]
unknown function  [avidemux_portable.exe]
unknown function  [avidemux_portable.exe]
BaseThreadInitThunk  [KERNEL32.DLL]
RtlUserThreadStart  [ntdll.dll]

EDIT: Doesn't crash in v2.7.1 x64 VC++, which doesn't display the error message about incompatible dimensions on append.

EDIT2: adm.appendVideo(fname) doesn't crash, the issue seems to be with raise.

eumagga0x2a

Please let me have a look at the part of the log file reflecting the steps leading to the crash, not just the record of the aftermath.

createEngine, the last call before the first error, is normally used only during the init of the GUI, so that I cannot tell from this info what is going on here and also cannot reproduce such a crash on Linux. You got the error message about size mismatch, didn't you?

edit: just saw your EDIT2. Looks plausible.

eumagga0x2a

Cannot reproduce on Windows 10 using any of the latest nightlies.

butterw

#12
I've added the log chunk before, but I doubt there is anything useful.
I get the 2 normal error messages: size mismatch error, followed by append error.
If raise is used here, I then get the tinyPy Exception followed by the crash messages.

adm = Avidemux()
if not adm.loadVideo("B:/mpc/1.mp4"): raise("Cannot load")
if not adm.appendVideo("B:/mpc/a.mp4"): raise("Cannot append")
# 1 is 1280x720, a is 1302x704

EDIT: reproducible with other mismatched files.

eumagga0x2a

Thanks, does

raise("panic"")
alone trigger the crash on your system (it doesn't on mine)? Are you sure you didn't mix different builds or such?

butterw

#14
Quote from: eumagga0x2a on January 31, 2021, 07:54:29 PMalone trigger the crash on your system (it doesn't on mine)? Are you sure you didn't mix different builds or such?

EDIT: raise("panic") doesn't crash on it's own, but it does quite easily crash. Ex after the append size mismatch error message, but not only:

adm = Avidemux()
adm.loadVideo("B:/mpc/1.mp4")
raise("panic")

EDIT2: the issue isn't present with 2.7.1 VC++ where there wasn't the TinyPy exception popup, but is with both latest Vc++ and mingw x64 win 2.7.7 dev builds.