You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Wrong output filename when adding multiple files #6067
My theory is when we process the currently selected title, we will wrongly give it the filename for the last title.
My work around is to select the last title before selecting to "Queue > Add All" Option and then all titles get the correct filename. At least so far :-)
I have a suspicion that selecting the last title after the Add All, but before processing the queue might be OK too. Not tested yet.
I posted a screen shot in #6121, I think the answer is that the details all look correct, it is not until you run the job that the problem becomes apparent.
Take note of what track is selected, I think this is important. This is the track that will have the wrong filename.
Select Queue -> Add All.
From the Queue window there is absolutely no indication that anything is wrong. Closing the Queue Window and reopening it does not change anything.
From Queue Window, select start.
Watch the file being generated carefully. Handbrake does not give any notifications or anything when it overwrites the file it just generated.
I have a vague recollection I may have encountered the same problem when I scanned a number of DVDs in 2021. But can't be 100% sure now. I was getting a bit overwhelmed at the time. Particularly when I realized that my rips were silently losing tracks.
I also have seen instances of running one job at a time also can trigger it, but I haven't explored this in much depth yet.
I'm able to reproduce this as well, the filename is actually incorrect in the queue job itself (when saved to json via export), and in the activity log in Destination -> File, but in the Queue Summary window, the Destination field is what is is supposed to be, and not where it actually saved. So until you hit Start and look at the Activity log, or export queue to json and look at the job, everything looks good in the client. Even after finishing the encode, the Destination field in the Queue Summary shows the correct filename
@galad87 I could open a PR with this change, but I'm not sure if there are other ramifications from other call points that changing this might break.
I'm actually not entirely sure the call to ghb_set_title_settings(...) in title_add_all_action_cb is necessary, but again, I'm very new to this codebase and so I'm not sure. At the very least, the function name ghb_set_title_settings is misleading since it also changes _destination_settings, not just title_settings
@sr55 Its been about 15 years since I last tried to debug a C codebase and I'm having a hard time figuring this out, whats the difference between signal_user_data_t->settings and signal_user_data_t->settings_array? It appears they are both json as their underlying types, but I'm unable to see what data they contain with my current debugging setup
In case it helps anyone else, I was able to get debugging working in CLion by using bear to create a compilation database, (e.g. bear --force-wrapper -- ./configure --launch-jobs=24 --launch --force --debug=max ) then manually creating a run/debug configuration to start ~/Handbrake/build/gtk/ghb with ~/HandBrake/build/gtk/src/ghb.p set as the working directory
I just tested this, and can confirm it looks like it is fixed now.
Thanks!
Great to hear @brianmay . For the future, is there a good way to debug the json backed data via a debugger? I guess I've been spoiled by C# where I can just dive into objects and if need be run commands while stopped at a breakpoint to analyze live data.
Activity
brianmay commentedon Jun 13, 2024
My theory is when we process the currently selected title, we will wrongly give it the filename for the last title.
My work around is to select the last title before selecting to "Queue > Add All" Option and then all titles get the correct filename. At least so far :-)
I have a suspicion that selecting the last title after the Add All, but before processing the queue might be OK too. Not tested yet.
brianmay commentedon Jun 13, 2024
My suspicion is wrong, need to select the last title before the Add All operation.
galad87 commentedon Jun 14, 2024
I think something is not being copied, and the name is changed on a shared instance. Is the wrong filename shown on the queue details panel too?
brianmay commentedon Jun 14, 2024
Yes, that would make sense.
I posted a screen shot in #6121, I think the answer is that the details all look correct, it is not until you run the job that the problem becomes apparent.
galad87 commentedon Jun 14, 2024
Does it always happen or only sometimes? If you export the queue to json are the destination and name set correctly?
brianmay commentedon Jun 14, 2024
Hmmm. Just a thought. Wonder if the clobbering happens after the details are shown in the summary pane.
I should try closing and reopening the window, see if that makes any difference.
brianmay commentedon Jun 14, 2024
It always happens, that one file name is wrong. Unless I select the last track as above. i.e. It is easy to reproduce.
galad87 commentedon Jun 14, 2024
Can you provide all the steps you are doing? So I can try to replicate them. For example, are you using "Open Directory" or selecting multiple files?
brianmay commentedon Jun 14, 2024
Source is DVD.
I have a vague recollection I may have encountered the same problem when I scanned a number of DVDs in 2021. But can't be 100% sure now. I was getting a bit overwhelmed at the time. Particularly when I realized that my rips were silently losing tracks.
I also have seen instances of running one job at a time also can trigger it, but I haven't explored this in much depth yet.
brianmay commentedon Jun 15, 2024
Going to "Add Multiple" and just selecting the selected title also does produces the same problem.
WillGunn commentedon Aug 2, 2024
I'm able to reproduce this as well, the filename is actually incorrect in the queue job itself (when saved to json via export), and in the activity log in Destination -> File, but in the Queue Summary window, the Destination field is what is is supposed to be, and not where it actually saved. So until you hit Start and look at the Activity log, or export queue to json and look at the job, everything looks good in the client. Even after finishing the encode, the Destination field in the Queue Summary shows the correct filename
Here is an example queue job and activity log with the wrong output filename from Add All (filenames anonymized) I'm running this in a docker container (https://hub.docker.com/r/jlesage/handbrake/), but I don't think that is effecting this behavior as the original reporter is on Ubuntu
Queue Job
And here is the equivalent output activity log:
WillGunn commentedon Aug 2, 2024
Ok, it took a while to get a developer setup working with debugging, but I think I found the issue. I think that
https://github.com/HandBrake/HandBrake/blob/master/gtk/src/callbacks.c#L2832
GhbValue *dest_dict = ghb_get_job_dest_settings(ud->settings);should be
GhbValue *dest_dict = ghb_get_job_dest_settings(settings);as it currently overwrites the Destination -> File property of the first item in the ud array while looping over the array of files being added to the queue,
the input
settingsto that function changes each loop through here https://github.com/HandBrake/HandBrake/blob/master/gtk/src/title-add.c#L811 and so in this instance I believe the ghb_set_title_settings function should be setting the Destination File property on the current setting being passed in, and not on the first setting in the array (which is what ud->settings seems to do)@galad87 I could open a PR with this change, but I'm not sure if there are other ramifications from other call points that changing this might break.
I'm actually not entirely sure the call to
ghb_set_title_settings(...)intitle_add_all_action_cbis necessary, but again, I'm very new to this codebase and so I'm not sure. At the very least, the function nameghb_set_title_settingsis misleading since it also changes _destination_settings, not just title_settingssr55 commentedon Aug 2, 2024
Thanks for looking into it @WillGunn :) Would be happy to see a Pull Request to clear this.
@jstebbins @robxnano if either of you can comment would be appreciated.
WillGunn commentedon Aug 2, 2024
@sr55 Its been about 15 years since I last tried to debug a C codebase and I'm having a hard time figuring this out, whats the difference between
signal_user_data_t->settingsandsignal_user_data_t->settings_array? It appears they are both json as their underlying types, but I'm unable to see what data they contain with my current debugging setupfixes HandBrake#6067
WillGunn commentedon Aug 2, 2024
In case it helps anyone else, I was able to get debugging working in CLion by using bear to create a compilation database, (e.g.
bear --force-wrapper -- ./configure --launch-jobs=24 --launch --force --debug=max) then manually creating a run/debug configuration to start ~/Handbrake/build/gtk/ghb with ~/HandBrake/build/gtk/src/ghb.p set as the working directorybrianmay commentedon Aug 3, 2024
@WillGunn Thanks heaps for debugging this issue.
fixes #6067
bradleysepos commentedon Aug 7, 2024
Nice work tracking this down @WillGunn! 😸
fixes HandBrake#6067
brianmay commentedon Aug 13, 2024
I just tested this, and can confirm it looks like it is fixed now.
Thanks!
WillGunn commentedon Aug 13, 2024
Great to hear @brianmay . For the future, is there a good way to debug the json backed data via a debugger? I guess I've been spoiled by C# where I can just dive into objects and if need be run commands while stopped at a breakpoint to analyze live data.
fixes HandBrake#6067