Sequencer: Use movieclip framerate when importing new movie strips
When importing new movie strips into the sequencer, the scene's frame rate will now be adjusted to match that of the movie being loaded by default. To get the old behaviour (e.g. if importing a clip into an existing project), disable the "Use Movie Framerate" option in the file browser when selecting the strip. This change is designed to solve the common problem that users trying to import video clips will forget to adjust the frame rate before importing the clip, thus causing the sound and video strips to be out of sync (as the sound strip ends up longer/shorter than the video stream).
This commit is contained in:
parent
cd6c6ee1a5
commit
4846b44024
|
@ -386,6 +386,7 @@ typedef struct SeqLoadInfo {
|
|||
#define SEQ_LOAD_FRAME_ADVANCE (1 << 1)
|
||||
#define SEQ_LOAD_MOVIE_SOUND (1 << 2)
|
||||
#define SEQ_LOAD_SOUND_CACHE (1 << 3)
|
||||
#define SEQ_LOAD_SYNC_FPS (1 << 4)
|
||||
|
||||
|
||||
/* seq_dupli' flags */
|
||||
|
|
|
@ -5249,6 +5249,11 @@ Sequence *BKE_sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoad
|
|||
seq->anim_preseek = IMB_anim_get_preseek(anim_arr[0]);
|
||||
BLI_strncpy(seq->name + 2, "Movie", SEQ_NAME_MAXSTR - 2);
|
||||
BKE_sequence_base_unique_name_recursive(&scene->ed->seqbase, seq);
|
||||
|
||||
/* adjust scene's frame rate settings to match */
|
||||
if (seq_load->flag & SEQ_LOAD_SYNC_FPS) {
|
||||
IMB_anim_get_fps(anim_arr[0], &scene->r.frs_sec, &scene->r.frs_sec_base, true);
|
||||
}
|
||||
|
||||
/* basic defaults */
|
||||
seq->strip = strip = MEM_callocN(sizeof(Strip), "strip");
|
||||
|
|
|
@ -209,6 +209,9 @@ static void seq_load_operator_info(SeqLoadInfo *seq_load, wmOperator *op)
|
|||
|
||||
if ((prop = RNA_struct_find_property(op->ptr, "sound")) && RNA_property_boolean_get(op->ptr, prop))
|
||||
seq_load->flag |= SEQ_LOAD_MOVIE_SOUND;
|
||||
|
||||
if ((prop = RNA_struct_find_property(op->ptr, "use_framerate")) && RNA_property_boolean_get(op->ptr, prop))
|
||||
seq_load->flag |= SEQ_LOAD_SYNC_FPS;
|
||||
|
||||
/* always use this for ops */
|
||||
seq_load->flag |= SEQ_LOAD_FRAME_ADVANCE;
|
||||
|
@ -700,6 +703,7 @@ void SEQUENCER_OT_movie_strip_add(struct wmOperatorType *ot)
|
|||
WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH | WM_FILESEL_FILES, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
|
||||
sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME);
|
||||
RNA_def_boolean(ot->srna, "sound", true, "Sound", "Load sound with the movie");
|
||||
RNA_def_boolean(ot->srna, "use_framerate", true, "Use Movie Framerate", "Use framerate from the movie to keep sound and video in sync");
|
||||
}
|
||||
|
||||
/* add sound operator */
|
||||
|
|
Loading…
Reference in New Issue