devoncrawford / video-editing-automation Goto Github PK
View Code? Open in Web Editor NEWToolkit of algorithms to automate the video editing process
License: GNU General Public License v3.0
Toolkit of algorithms to automate the video editing process
License: GNU General Public License v3.0
At least do a where you at video.
It would be extremely useful (especially for multicam editors) to have a paltform-indipendent library - in order to be used by open source DAW/NLEs - able to automatically synch multiple audio (and therefore also videos) tracks between them.
I found some interesting resources that may help to build it:
Hope that inspires.
I built the ffmpeg library successfully on Mac OSX and I was trying to build your Video Automation project. I got the following linker error. Has anyone else run into this issue and know a solution?
cc bin/examples/ffmpeg/demuxing_decoding.o -o bin/examples/ffmpeg/demuxing_decoding
Undefined symbols for architecture x86_64:
"_av_dict_set", referenced from:
_open_codec_context in demuxing_decoding.o
"_av_dump_format", referenced from:
_main in demuxing_decoding.o
"_av_find_best_stream", referenced from:
_open_codec_context in demuxing_decoding.o
"_av_frame_alloc", referenced from:
_main in demuxing_decoding.o
"_av_frame_free", referenced from:
_main in demuxing_decoding.o
"_av_frame_unref", referenced from:
_decode_packet in demuxing_decoding.o
"_av_free", referenced from:
_main in demuxing_decoding.o
"_av_get_bytes_per_sample", referenced from:
_decode_packet in demuxing_decoding.o
"_av_get_media_type_string", referenced from:
_open_codec_context in demuxing_decoding.o
"_av_get_packed_sample_fmt", referenced from:
_main in demuxing_decoding.o
"_av_get_pix_fmt_name", referenced from:
_main in demuxing_decoding.o
_decode_packet in demuxing_decoding.o
"_av_get_sample_fmt_name", referenced from:
_main in demuxing_decoding.o
_get_format_from_sample_fmt in demuxing_decoding.o
"_av_image_alloc", referenced from:
_main in demuxing_decoding.o
"_av_image_copy", referenced from:
_decode_packet in demuxing_decoding.o
"_av_init_packet", referenced from:
_main in demuxing_decoding.o
"_av_packet_unref", referenced from:
_main in demuxing_decoding.o
"_av_read_frame", referenced from:
_main in demuxing_decoding.o
"_av_sample_fmt_is_planar", referenced from:
_main in demuxing_decoding.o
"_av_seek_frame", referenced from:
_main in demuxing_decoding.o
"_av_strerror", referenced from:
_av_make_error_string in demuxing_decoding.o
"_avcodec_alloc_context3", referenced from:
_open_codec_context in demuxing_decoding.o
"_avcodec_decode_audio4", referenced from:
_decode_packet in demuxing_decoding.o
"_avcodec_decode_video2", referenced from:
_decode_packet in demuxing_decoding.o
"_avcodec_find_decoder", referenced from:
_open_codec_context in demuxing_decoding.o
"_avcodec_free_context", referenced from:
_main in demuxing_decoding.o
"_avcodec_open2", referenced from:
_open_codec_context in demuxing_decoding.o
"_avcodec_parameters_to_context", referenced from:
_open_codec_context in demuxing_decoding.o
"_avformat_close_input", referenced from:
_main in demuxing_decoding.o
"_avformat_find_stream_info", referenced from:
_main in demuxing_decoding.o
"_avformat_open_input", referenced from:
_main in demuxing_decoding.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [bin/examples/ffmpeg/demuxing_decoding] Error 1
Why not?
It would be better, maybe as a second option to edit the video.
Like skipping silent moments.
Or even comparing the start frame and the ending frame based on the duration and see whether it was changed or not if so you could have option like fast forwarding if there was no audio.
And so on..
Just a note: i didn't read the source code, maybe you're doing that already idk
In file src/Sequence.c
at line 567 a stack buffer overflow can occur due to the fact that there's no length check on the buf
local variable.
/**
* get sequence string
* @param seq Sequence to get data
* @return string allocated on heap, to be freed by caller
*/
char *print_sequence(Sequence *seq) {
// (...)
char buf[4096];
// (...)
for(int i = 0; currNode != NULL; i++) {
// Here it is!!
sprintf(buf, "Clip [%d]\nurl: %s\nstart_pts: %ld\nend_pts: %ld\norig_start_pts: %ld\norig_end_pts: %ld\nvid_ctx: %p\n",
i, c->vid_ctx->url, c->start_pts, c->end_pts, c->orig_start_pts, c->orig_end_pts, c->vid_ctx);
}
return str;
}
This can lead to a crash or to arbitrary code execution.
I wrote a POC for showing this:
/**
* This is a proof of concept of a possible buffer overflow
* in src/Sequence.c -> print_sequence() -> line: 567
*
* A buffer overflow can occur by trying to print a sequence
* with a large enough path.
*
* In UNIX, the maximun size of a path is 4096 bytes, so in this
* POC we still handle realistic sizes.
*/
#include "Timebase.h"
#include "Sequence.h"
#include "OutputContext.h"
int main(int argc, char **argv) {
Sequence seq;
init_sequence(&seq, 30, 48000);
char *large_buffer = (char *)malloc(4096);
for (uint64_t i = 0; i < 4096; i++){
*(large_buffer+i) = 'A';
}
Clip *clip = malloc(sizeof(Clip));
init_clip(clip, large_buffer);
open_clip(clip);
set_clip_bounds(clip, 53, 61);
sequence_append_clip(&seq, clip);
char *str = print_sequence(&seq);
printf("Sequence:\n%s\n", str);
free(str);
str = NULL;
free_sequence(&seq);
return 0;
}
And here's the crash log:
Could not open source file AAAAAAAAAAAA(skipped...)AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
open_clip() error: Failed to open VideoContext for clip[AAAAAAAAAAAAAAAAA(skipped...)AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA]
Video stream does not exist
sequence add clip [AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA(skipped...)AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA], start_pts: 0
Failed to get video time_base: clip[AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA(skipped...)AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA] is not open
*** stack smashing detected ***: <unknown> terminated
Aborted (core dumped)
As the maximum size of a UNIX path is 4096 bytes, my idea for fixing this is pretty simple:
buf
bigger so that it can fit a 4096 bytes path.I would like to point out that identifiers like “_CLIP_API_
” and “_VIDEOCONTEXT_API_
” do not fit to the expected naming convention of the C language standard.
Would you like to adjust your selection for unique names?
He may be weak, but his memes are forever. Long Live Cary the Python wrangler.
https://github.com/carykh/jumpcutter and https://www.youtube.com/watch?v=DQ8orIurGxw
You feed the program a music clip along with the video files and it cuts the video synced with the music.
I finally got your code up and running in my Ubuntu virtual machine, but when I try to run it with either MP4 files OR MOV files, it simply gives the following error:
Could not open source file /home/creepinson/vid/HD0048.mp4
open_clip() error: Failed to open VideoContext for clip[/home/creepinson/vid/HD0048.mp4]
add_files() warning: failed to allocate clip[/home/creepinson/vid/HD0048.mp4]
sequence_insert_clip_sorted() error: parameters cannot be NULL....
And this happens when I run this command:
./bin/examples/random-splice out.mov 60 44100 ~/vid/ 300 13 10
When I remove the / after ~/vid
it simply gives this error:
pick_frames() error: sequence duration[0] is invalid
random_cut() error: Failed to pick frames....
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.