Write to a file which is already opened by another program on Windows.
Thanks for this great tool!
I do the following in Colab:
!git clone -qqq https://github.com/nu774/mp4fpsmod.git > /dev/null
!sudo apt-get update -y -qqq --fix-missing && apt-get install -y -qqq autoconf libtool > /dev/null
%cd mp4fpsmod
!./bootstrap.sh
!./configure
All the above commands were done successfully but when I run make I get into a loop:
!make
make all-recursive
make[1]: Entering directory '/content/mp4fpsmod'
Making all in mp4v2
make[2]: Entering directory '/content/mp4fpsmod/mp4v2'
/bin/bash ./libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I./include -I./include -I. -I. -Wall -Wformat -g -O2 -fvisibility=hidden -c -o src/3gp.lo src/3gp.cpp
libtool: compile: g++ -DHAVE_CONFIG_H -I./include -I./include -I. -I. -Wall -Wformat -g -O2 -fvisibility=hidden -c src/3gp.cpp -o src/3gp.o
In file included from ./src/src.h:28:0,
from ./src/impl.h:6,
from src/3gp.cpp:28:
./src/mp4util.h:36:33: warning: invalid suffix on literal; C++11 requires a space between literal and string macro [-Wliteral-suffix]
throw new Exception("assert failure: "LIBMPV42_STRINGIFY((expr)), __FILE__, __LINE__, __FUNCTION__ ); \
^
/bin/bash ./libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I./include -I./include -I. -I. -Wall -Wformat -g -O2 -fvisibility=hidden -c -o src/atom_ac3.lo src/atom_ac3.cpp
libtool: compile: g++ -DHAVE_CONFIG_H -I./include -I./include -I. -I. -Wall -Wformat -g -O2 -fvisibility=hidden -c src/atom_ac3.cpp -o src/atom_ac3.o
In file included from ./src/src.h:28:0,
from ./src/impl.h:6,
from src/atom_ac3.cpp:24:
./src/mp4util.h:36:33: warning: invalid suffix on literal; C++11 requires a space between literal and string macro [-Wliteral-suffix]
throw new Exception("assert failure: "LIBMPV42_STRINGIFY((expr)), __FILE__, __LINE__, __FUNCTION__ ); \
How can I fix it?
And a small question. When I try to run it on Windows:
mp4fpsmod --fps 0:60 video.mp4 --inplace
and the video file is open in mpc-hc I see the error:
Reading MP4 stream...
libmp4v2: mp4v2::impl::MP4File::Open: open(C:\video.mp4) failed (..\..\mp4v2\src\mp4file.cpp,371)
How can I make mp4fpsmod work even when the video file is already open?
As for warning about "invalid suffix on literal; C++11 requires a space between literal and string macro [-Wliteral-suffix]", it's just a non-critical compiler warning (not an error), so you can ignore it.
As for the latter, simply, NO. You are using --inplace, which means that mp4fpsmod will rewrite video.mp4 destructively. Just reading from video.mp4 without --inplace should be OK.
Unfortunately, reading from movie_file_path_tmp and saving to another file also does not work if movie_file_path is opened in another program (mpc-hc).
fix_timestamps_process = subprocess.Popen([
mp4fpsmod_file_path,
'--fps', '0:' + str(60),
'--timescale', '15360',
movie_file_path_tmp, '-o', movie_file_path
])
Reading MP4 stream...
Done reading
Saving MP4 stream...
libmp4v2: mp4v2::impl::MP4File::Open: open(C:\movie_file_path.mp4) failed (..\..\mp4v2\src\mp4file.cpp,371)
At the same time ffmpeg can write to movie_file_path even when it's opened in mpc-hc.
I don't understand why you want/have to write to a file which is already opened by another program. On Linux, m4fpsmod will happily write to a existing file which is already opened, but the file will be destructively be overwritten by mp4fpsmod, so that another program (video player) cannot continue to play it anyway. The same goes for true when creating new file by mp4fpsmod and opening it by another program. The MP4 file is not playable until it is finalized.
On windows, it's because StandardFileProvider::open() in File_win32.cpp of libmp4v2 explicitly sets share mode to none when writing to a file, and I don't think better to change that behavior.
I don't understand why you want/have to write to a file which is already opened by another program.
It is very convenient. When I create a video I render it to the same file multiple times and see what the changes I made look like. When I have to close mpc-hc every time it's annoying.
(video player) cannot continue to play it anyway.
It does not have to continue. It's perfectly fine if a video player reopens the new file from the beginning.
Again, ffmpeg does this by default with -y command.
I strongly recommend to allow writing to already opened file.
It does not have to continue. It's perfectly fine if a video player reopens the new file from the beginning.
Actually, players such as vlc or mpv will immediately quit when the file is overwritten by ffmpeg -y and they cannot continue the playback. mpc-hc might be an exception, but your usage and needs seem very specific to you, and honestly I'm not interested at all.