Getting "could not open the file" error when using a script

Started by tomer-k, April 16, 2022, 12:39:40 PM

Previous topic - Next topic

tomer-k

Hi,
Half a year ago, I used a script to transfer a series of videos from TS to MP4. When I am trying to use the script again nowadays, I get that error. Might anyone have a clue why?

This is what's written in the script:

set avidemux="C:\Program Files\Avidemux 2.8 VC++ 64bits\avidemux.exe"
set videocodec=x264
for %%f in (*.TS) do %avidemux% --video-codec x264 %videocodec% --audio-codec Copy --load "%%f" --output-format MP4 --save "%%~dpnf.MP4" --quit

You cannot view this attachment.

eumagga0x2a

Quote from: tomer-k on April 16, 2022, 12:39:40 PMfor %%f in (*.TS) do %avidemux% --video-codec x264 %videocodec% --audio-codec Copy --load "%%f" --output-format MP4 --save "%%~dpnf.MP4" --quit

You ask Avidemux to load file "x264" in current directory which of course doesn't exist. Apart from that, you should --load first and set codecs, container etc. second:

set avidemux="C:\Program Files\Avidemux 2.8 VC++ 64bits\avidemux.exe"
set videocodec=x264
for %%f in (*.TS) do %avidemux% --load "%%f" --video-codec %videocodec% --audio-codec Copy --output-format MP4 --save "%%~dpnf.MP4" --quit

Are you sure re-encoding the source with x264 into H.264 using default options is appropriate for the task? Because if the source is already H.264, you can use copy for video as well, but if it is e.g. MPEG-2, you will need a more targeted approach depending on the properties of the source MPEG transport stream file.

tomer-k

Thank you for trying to help me again. I actually don't understand much about the script. was trying to copy-paste your suggestion, but it still giving me the same error. Should I change the second line too? to what?


set avidemux="C:\Program Files\Avidemux 2.8 VC++ 64bits\avidemux.exe"
set videocodec=x264
for %%f in (*.TS) do %avidemux% --load "%%f" --video-codec %videocodec% --audio-codec Copy --output-format MP4 --save "%%~dpnf.MP4" --quit

eumagga0x2a

Quote from: tomer-k on April 17, 2022, 04:34:22 PMShould I change the second line too?

No, the second line is fine as has nothing to do with the error. Do you have write permissions in the directory the .ts files are located? If yes, please provide admlog.txt from %localappdata%\avidemux\ directory once you get the "Could not open the file" error (Avidemux cannot open MPEG transport streams from a read-only folder).

tomer-k

As you suggested, I tried to check the write permission, but as much as I understand, my Win10 user is also the administrator. I also tried to use the script on the same TS files, just using my old computer, with Avidemux V2.7, and it worked fine. So I think it might have to do something with the newer version. Anyway, I am uploading the file you requested.

eumagga0x2a

Thank you for the log, the fact is that Avidemux even doesn't try to probe the video file. I wonder whether this is related to non-ASCII characters in the file name. There was a regression a long time ago, which was quickly fixed, but the fix was never verified for Hebrew and MPEG-TS sources.

For starters, could you please try the latest available MinGW Avidemux 2.8.1 nightly from https://avidemux.org/nightly/win64/ (it is not very recent at the moment, but oh well...)

If the problem affects "win64" builds as well, please test with a directory containing TS files with file names consisting of ASCII characters only.

tomer-k

No, thank YOU, for helping so much. ;D
I installed the MinGW Avidemux 2.8.1, although I'm not sure what is that exactly. Hope you can tell in a few words here if you don't mind. Then I tried to check both options (only ASCII for the folder name and only ASCII for filename), and it seems that the problem has something to do just with the folder name in Hebrew. It would be great if you could look into it for the next version, please. Anyway, I shared the log file again as I'm not sure that I attached it right away after the failed procedure last time.
And one more thing, please - do you recommend saving the *.idx2 files? for what purpose? as much as I understand they are used for creating the *.MP4 from the *.TS files, so they become useless afterward.

eumagga0x2a

Quote from: tomer-k on April 24, 2022, 03:49:58 PMI installed the MinGW Avidemux 2.8.1, although I'm not sure what is that exactly. Hope you can tell in a few words here if you don't mind

MinGW and VC++ are compilers, the former is open source, runs on Linux and outputs binaries for Windows, the latter belongs to Microsoft Visual Studio (i.e. it is closed source), runs on Windows and also outputs binaries for Windows. Avidemux code has to deal with peculiarities of these very different compilers.

I'll try to reproduce the problem with Hebrew folder names once my current macOS related work is completed and I can reboot into Windows, thanks.

eumagga0x2a

Quote from: tomer-k on April 24, 2022, 03:49:58 PMdo you recommend saving the *.idx2 files? for what purpose?

If you delete the index files (*.idx2), created by Avidemux for MPEG-TS and MPEG-PS video files, Avidemux will have to re-index the streams next time you load the corresponsing MPEG-TS or -PS (.mpg) file, a time-consuming operation. Discarding old index files makes a lot of sense if they were created by an older version of Avidemux, however.