VSE Reports sounds as missing after filepath is fixed #114547

Open
opened 2023-11-06 18:21:49 +01:00 by Nick Alberelli · 11 comments

System Information
Operating system: Linux-6.2.0-36-generic-x86_64-with-glibc2.37 64 Bits, X11 UI
Graphics card: NVIDIA GeForce RTX 3070 Laptop GPU/PCIe/SSE2 NVIDIA Corporation 4.6.0 NVIDIA 525.147.05

Blender Version
Broken: version: 4.1.0 Alpha, branch: main, commit date: 2023-11-06 14:51, hash: 9956ef4622d9

Short description of error
When fixing paths for sound strips, either via python or via the GUI, sound strips in the VSE will always report a missing file when executing File>External Data>Report Missing Files even after the strip filepath has been fixed

Test Files

vse_sound_datablocks.zip

Exact steps for others to reproduce the error using provided files

  1. Open 01_missing_sound.blend from vse_sound_datablocks.zip
  2. Update Sound Strip filepath to //audio_folder_02/testtone_50Hz.mp3
  3. Save and Reload
  4. File>External Data>Report Missing Files reports sound as missing, while sound file is actually valid
  5. This will result in a file like 02_fixed_missing_sound.blend

Exact steps for others to reproduce the error from scratch

  1. Load Sound Strip into VSE
  2. Relocate Sound FIle on Disk
  3. Update File Path for Sounds Strip in VSE to new location
  4. Save and Reload
  5. File>External Data>Report Missing Files reports sound as missing

Show_Bad_VSE_PAth

**System Information** Operating system: Linux-6.2.0-36-generic-x86_64-with-glibc2.37 64 Bits, X11 UI Graphics card: NVIDIA GeForce RTX 3070 Laptop GPU/PCIe/SSE2 NVIDIA Corporation 4.6.0 NVIDIA 525.147.05 **Blender Version** Broken: version: 4.1.0 Alpha, branch: main, commit date: 2023-11-06 14:51, hash: `9956ef4622d9` **Short description of error** When fixing paths for sound strips, either via python or via the GUI, sound strips in the VSE will always report a missing file when executing `File>External Data>Report Missing Files` even after the strip filepath has been fixed #### Test Files [vse_sound_datablocks.zip](/attachments/b38beef7-eb28-4a82-9ea2-010c1af7f2b5) **Exact steps for others to reproduce the error using provided files** 1. Open `01_missing_sound.blend` from [vse_sound_datablocks.zip](/attachments/b38beef7-eb28-4a82-9ea2-010c1af7f2b5) 2. Update Sound Strip filepath to `//audio_folder_02/testtone_50Hz.mp3` 3. Save and Reload 4. `File>External Data>Report Missing Files` reports sound as missing, while sound file is actually valid 5. This will result in a file like `02_fixed_missing_sound.blend` **Exact steps for others to reproduce the error from scratch** 1. Load Sound Strip into VSE 2. Relocate Sound FIle on Disk 3. Update File Path for Sounds Strip in VSE to new location 4. Save and Reload 5. `File>External Data>Report Missing Files` reports sound as missing ![Show_Bad_VSE_PAth](/attachments/84703751-407d-4fd5-b750-fd66fbcbfa7b)
Nick Alberelli added the
Type
Report
Priority
Normal
Status
Needs Triage
labels 2023-11-06 18:21:50 +01:00
Nick Alberelli changed title from VSE Reports sounds as missing when filepath is fixed to VSE Reports sounds as missing after filepath is fixed 2023-11-06 18:33:58 +01:00
Member

Hi, thanks for the report. I can confirm.
D.sounds['music_name'].filepath returns correct filepath. But VSE outliner shows the old path
Looks like a long standing bug (3.0 fails too)
Bisecting some other bug right now so can not check/debug the code 😅
image

Hi, thanks for the report. I can confirm. `D.sounds['music_name'].filepath` returns correct filepath. But VSE outliner shows the old path Looks like a long standing bug (3.0 fails too) Bisecting some other bug right now so can not check/debug the code 😅 ![image](/attachments/4d5f4c4d-b7ed-4fd5-844c-f4be98f00a34)
157 KiB
Member

Shouldnt this also actually reload the Sound (after changing the filepath)?
The fact that you have to save and reload the .blend file to see a change also seems quite wrong to me...

Shouldnt this also actually reload the Sound (after changing the filepath)? The fact that you have to save and reload the .blend file to see a change also seems quite wrong to me...
Member

Shouldnt this also actually reload the Sound (after changing the filepath)?
The fact that you have to save and reload the .blend file to see a change also seems quite wrong to me...

Ah, it does reload the sound, it is just the corresponding StripElem(s) that dont receive an immediate update

> Shouldnt this also actually reload the Sound (after changing the filepath)? > The fact that you have to save and reload the .blend file to see a change also seems quite wrong to me... Ah, it does reload the sound, it is just the corresponding StripElem(s) that dont receive an immediate update
Author

@lichtwerk In my testing, you can just change the file path and the sound will be audible in the VSE.

The Save and Reload step isn't necessary to get the sound to play via the VSE, (although it is required to get the waveform of the sound strip to populate) so we can disregard that step in fact.

@lichtwerk In my testing, you can just change the file path and the sound will be audible in the VSE. The Save and Reload step isn't necessary to get the sound to play via the VSE, (although it is required to get the waveform of the sound strip to populate) so we can disregard that step in fact.
Member

bpy.ops.sequencer.change_path() gives you an update on the waveform (still no good update in the Outliner for the StripElem)

This would work for the raw setting of the filepath (python or UI -- but same as above still no good update in the Outliner for the StripElem):



diff --git a/source/blender/makesrna/intern/rna_sound.cc b/source/blender/makesrna/intern/rna_sound.cc
index 054cd788555..4ffa23fd843 100644
--- a/source/blender/makesrna/intern/rna_sound.cc
+++ b/source/blender/makesrna/intern/rna_sound.cc
@@ -39,10 +39,11 @@ static const EnumPropertyItem rna_enum_audio_channels_items[] = {
 
 #  include "SEQ_sequencer.hh"
 
-static void rna_Sound_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
+static void rna_Sound_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
 {
   bSound *sound = (bSound *)ptr->data;
   DEG_id_tag_update(&sound->id, ID_RECALC_AUDIO);
+  BKE_sound_load(bmain, sound);
 }
 
 static void rna_Sound_caching_update(Main *bmain, Scene *scene, PointerRNA *ptr)
`bpy.ops.sequencer.change_path()` gives you an update on the waveform (still no good update in the Outliner for the StripElem) This would work for the raw setting of the filepath (python or UI -- but same as above still no good update in the Outliner for the StripElem): ```Diff diff --git a/source/blender/makesrna/intern/rna_sound.cc b/source/blender/makesrna/intern/rna_sound.cc index 054cd788555..4ffa23fd843 100644 --- a/source/blender/makesrna/intern/rna_sound.cc +++ b/source/blender/makesrna/intern/rna_sound.cc @@ -39,10 +39,11 @@ static const EnumPropertyItem rna_enum_audio_channels_items[] = { # include "SEQ_sequencer.hh" -static void rna_Sound_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr) +static void rna_Sound_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr) { bSound *sound = (bSound *)ptr->data; DEG_id_tag_update(&sound->id, ID_RECALC_AUDIO); + BKE_sound_load(bmain, sound); } static void rna_Sound_caching_update(Main *bmain, Scene *scene, PointerRNA *ptr) ```
Author

@lichtwerk Thanks you that is good to know!

The filepaths reporting as missing is really the piece of this that is causeing some blockages at the Blender Studio currently.

We just did some mass remapping of filepaths, and it would be nice to be able to tell if paths are genuienly broken or miss reported because of this bug.

@lichtwerk Thanks you that is good to know! The filepaths reporting as missing is really the piece of this that is causeing some blockages at the Blender Studio currently. We just did some mass remapping of filepaths, and it would be nice to be able to tell if paths are genuienly broken or miss reported because of this bug.
Member

This should be made cleaner, but to unblock you, you can try this:
(once the correct filepath is on the strip as well, File>External Data>Report Missing Files should go smoothly)



diff --git a/source/blender/makesrna/intern/rna_sequencer.cc b/source/blender/makesrna/intern/rna_sequencer.cc
index d8c3d6a08b4..21203d939fa 100644
--- a/source/blender/makesrna/intern/rna_sequencer.cc
+++ b/source/blender/makesrna/intern/rna_sequencer.cc
@@ -14,6 +14,7 @@
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_sequence_types.h"
+#include "DNA_sound_types.h"
 #include "DNA_vfont_types.h"
 
 #include "BLI_iterator.h"
@@ -1045,6 +1046,21 @@ static void rna_Sequence_filepath_update(Main *bmain, Scene * /*scene*/, Pointer
 
 static void rna_Sequence_sound_update(Main *bmain, Scene * /*active_scene*/, PointerRNA *ptr)
 {
+  /* First option: update the filepath on the sound first, then also update the Sequence sound to get the sound filepath copied over to the Strip:
+   * sound = C.scene.sequence_editor.sequences_all['testtone_50Hz.mp3'].sound
+   * sound.filepath = "//audio_folder_02/testtone_50Hz.mp3"
+   * C.scene.sequence_editor.sequences_all['testtone_50Hz.mp3'].sound = sound
+   * not ideal, but... */
+  Sequence *seq = (Sequence *)(ptr->data);
+
+  if (seq->sound != nullptr) {
+    BLI_path_split_dir_file(seq->sound->filepath,
+                            seq->strip->dirpath,
+                            sizeof(seq->strip->dirpath),
+                            seq->strip->stripdata->filename,
+                            sizeof(seq->strip->stripdata->filename));
+  }
+
   Scene *scene = (Scene *)ptr->owner_id;
   DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS | ID_RECALC_AUDIO);
   DEG_relations_tag_update(bmain);
@@ -3038,6 +3054,18 @@ static void rna_def_sound(BlenderRNA *brna)
   RNA_def_property_ui_text(prop, "Sound", "Sound data-block used by this sequence");
   RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_sound_update");
 
+  /* Other option: with this, you can update the Strip filepath totally by hand:
+   * sound = C.scene.sequence_editor.sequences_all['testtone_50Hz.mp3'].sound
+   * sound.filepath = "//audio_folder_02/testtone_50Hz.mp3"
+   * C.scene.sequence_editor.sequences_all['testtone_50Hz.mp3'].filepath = sound.filepath */
+  prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
+  RNA_def_property_ui_text(prop, "File", "");
+  RNA_def_property_string_funcs(prop,
+                                "rna_Sequence_filepath_get",
+                                "rna_Sequence_filepath_length",
+                                "rna_Sequence_filepath_set");
+  RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_filepath_update");
+
   prop = RNA_def_property(srna, "volume", PROP_FLOAT, PROP_NONE);
   RNA_def_property_float_sdna(prop, nullptr, "volume");
   RNA_def_property_range(prop, 0.0f, 100.0f);
diff --git a/source/blender/makesrna/intern/rna_sound.cc b/source/blender/makesrna/intern/rna_sound.cc
index 054cd788555..4ffa23fd843 100644
--- a/source/blender/makesrna/intern/rna_sound.cc
+++ b/source/blender/makesrna/intern/rna_sound.cc
@@ -39,10 +39,11 @@ static const EnumPropertyItem rna_enum_audio_channels_items[] = {
 
 #  include "SEQ_sequencer.hh"
 
-static void rna_Sound_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
+static void rna_Sound_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
 {
   bSound *sound = (bSound *)ptr->data;
   DEG_id_tag_update(&sound->id, ID_RECALC_AUDIO);
+  BKE_sound_load(bmain, sound);
 }
 
 static void rna_Sound_caching_update(Main *bmain, Scene *scene, PointerRNA *ptr)
This should be made cleaner, but to unblock you, you can try this: (once the correct filepath is on the strip as well, `File>External Data>Report Missing Files` should go smoothly) ```Diff diff --git a/source/blender/makesrna/intern/rna_sequencer.cc b/source/blender/makesrna/intern/rna_sequencer.cc index d8c3d6a08b4..21203d939fa 100644 --- a/source/blender/makesrna/intern/rna_sequencer.cc +++ b/source/blender/makesrna/intern/rna_sequencer.cc @@ -14,6 +14,7 @@ #include "DNA_object_types.h" #include "DNA_scene_types.h" #include "DNA_sequence_types.h" +#include "DNA_sound_types.h" #include "DNA_vfont_types.h" #include "BLI_iterator.h" @@ -1045,6 +1046,21 @@ static void rna_Sequence_filepath_update(Main *bmain, Scene * /*scene*/, Pointer static void rna_Sequence_sound_update(Main *bmain, Scene * /*active_scene*/, PointerRNA *ptr) { + /* First option: update the filepath on the sound first, then also update the Sequence sound to get the sound filepath copied over to the Strip: + * sound = C.scene.sequence_editor.sequences_all['testtone_50Hz.mp3'].sound + * sound.filepath = "//audio_folder_02/testtone_50Hz.mp3" + * C.scene.sequence_editor.sequences_all['testtone_50Hz.mp3'].sound = sound + * not ideal, but... */ + Sequence *seq = (Sequence *)(ptr->data); + + if (seq->sound != nullptr) { + BLI_path_split_dir_file(seq->sound->filepath, + seq->strip->dirpath, + sizeof(seq->strip->dirpath), + seq->strip->stripdata->filename, + sizeof(seq->strip->stripdata->filename)); + } + Scene *scene = (Scene *)ptr->owner_id; DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS | ID_RECALC_AUDIO); DEG_relations_tag_update(bmain); @@ -3038,6 +3054,18 @@ static void rna_def_sound(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Sound", "Sound data-block used by this sequence"); RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_sound_update"); + /* Other option: with this, you can update the Strip filepath totally by hand: + * sound = C.scene.sequence_editor.sequences_all['testtone_50Hz.mp3'].sound + * sound.filepath = "//audio_folder_02/testtone_50Hz.mp3" + * C.scene.sequence_editor.sequences_all['testtone_50Hz.mp3'].filepath = sound.filepath */ + prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH); + RNA_def_property_ui_text(prop, "File", ""); + RNA_def_property_string_funcs(prop, + "rna_Sequence_filepath_get", + "rna_Sequence_filepath_length", + "rna_Sequence_filepath_set"); + RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_filepath_update"); + prop = RNA_def_property(srna, "volume", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, nullptr, "volume"); RNA_def_property_range(prop, 0.0f, 100.0f); diff --git a/source/blender/makesrna/intern/rna_sound.cc b/source/blender/makesrna/intern/rna_sound.cc index 054cd788555..4ffa23fd843 100644 --- a/source/blender/makesrna/intern/rna_sound.cc +++ b/source/blender/makesrna/intern/rna_sound.cc @@ -39,10 +39,11 @@ static const EnumPropertyItem rna_enum_audio_channels_items[] = { # include "SEQ_sequencer.hh" -static void rna_Sound_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr) +static void rna_Sound_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr) { bSound *sound = (bSound *)ptr->data; DEG_id_tag_update(&sound->id, ID_RECALC_AUDIO); + BKE_sound_load(bmain, sound); } static void rna_Sound_caching_update(Main *bmain, Scene *scene, PointerRNA *ptr) ```
Author

@lichtwerk thank you! I will give it a test on a production file ASAP

@lichtwerk thank you! I will give it a test on a production file ASAP
Author

In my testing the latest patch you commented didn't appear to work 😞 I still get the missing files reported both in the test file I attached to the issue and the production file I have the issue on.

Also I would need this in main so that the users who are on the production (mainly the editor) doesn't have these files report as missing anymore.

In my testing the latest patch you commented didn't appear to work 😞 I still get the missing files reported both in the test file I attached to the issue and the production file I have the issue on. Also I would need this in main so that the users who are on the production (mainly the editor) doesn't have these files report as missing anymore.
Member

Have you run the python code in the patch comment?

Have you run the python code in the patch comment?
Author

@lichtwerk I had not, after running the python code in the patch comment I did get the expected result! Thank you, I will use a custom build with that patch and similar python code to cleanup the error messages in the meantime.

@lichtwerk I had not, after running the python code in the patch comment I did get the expected result! Thank you, I will use a custom build with that patch and similar python code to cleanup the error messages in the meantime.
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#114547
No description provided.