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
Thanks, this falls under some of the other open issues to expand on output formats. I think we should add a new command like export-scenes that is dedicated for this purpose, so that the cuts can be saved in various formats. Updated #344 to include a link to this issue.
I would imagine the command to look something like export-scenes -o "cuts.qp" and have the format auto-detected from extension where possible, or explicitly specified with another flag. We could also allow specifying export-scenes several times to generate the output in different formats.
Unfortunately no ETA at this time, but in v0.6.3 you can now generate a list of cuts as frame numbers instead of timecodes with a config file. To do this, you can add the following to a config file:
[list-scenes]
cut-format = frames
And then use the list-scenes command to generate a CSV file, the first row will be the frames that you need to add I frames for. So the row would contain the following from your example:
1640,3789,17191,31784,33927
You might be able to wrangle that into a QP file with some bash magic or write a small Python script. If you're using the Python API, the detect function should already return the info you need.
It works ok but the generated CSV is not properly "standard".
I mean: looking at the file, we have a first part with Timecode list and a second part with Scene Number, that are CSV formatted in a really different way each other.
Please, write two files so that I can directly import the Scene number and frame in Excel.
When you will have time (if you want to ease my CSV file "postprocessing" :) ), simply output a file with a column of plain scene start frames, almost such as the example I did in the first post.
@tormento if you use the --skip-cuts option the file will omit the first row to allow it to be imported directly into Excel. This is not done by default for historical reasons, and will be fixed when we have a replacement for the list-scenes command in a future version.
The start frame column should align with the cut points you need for I frames.
@tormento one thing I'm not totally clear on is how this works with input seeking. Do the frame numbers refer to the encoded output frame numbers, or the frame numbers of the input?
For example, if we use start seeking, does the QP need to still start from frame 0, or should it be shifted?
The QP file tells the encoder (x264/x265) where to force a specific type of frame.
In our case, to have a clean scene cut, we need I type, i.e. what once was called a keyframe.
The CSV that PySceneDetect is shifted by 1, compared to encoder convention (wheree first frame is 0), so you need to take the (Start Frame-1) to have the appropriate position.
P.S: I think that the -1 value is totally optional but some tools output it and I kept on using. According to x265 readme, the number after the frame type should force a QP value but I never had use of it other than for keyframes.
@tormento Thanks, I should have that working now as a new save-qp command. Would you like to test a development version to verify? You can grab one for Windows here or from the latest build on PR #427. Replaced by PR #448
Invoking it as scenedetect -i video.mp4 save-qp results in the following example video.qp:
Activity
Breakthrough commentedon Apr 17, 2024
Thanks, this falls under some of the other open issues to expand on output formats. I think we should add a new command like
export-scenesthat is dedicated for this purpose, so that the cuts can be saved in various formats. Updated #344 to include a link to this issue.I would imagine the command to look something like
export-scenes -o "cuts.qp"and have the format auto-detected from extension where possible, or explicitly specified with another flag. We could also allow specifyingexport-scenesseveral times to generate the output in different formats.tormento commentedon Apr 18, 2024
Thanks, do you have any ETA?
Breakthrough commentedon Apr 18, 2024
Unfortunately no ETA at this time, but in v0.6.3 you can now generate a list of cuts as frame numbers instead of timecodes with a config file. To do this, you can add the following to a config file:
And then use the list-scenes command to generate a CSV file, the first row will be the frames that you need to add
Iframes for. So the row would contain the following from your example:You might be able to wrangle that into a QP file with some bash magic or write a small Python script. If you're using the Python API, the
detectfunction should already return the info you need.tormento commentedon Apr 19, 2024
Excel can do magic tricks ;)
tormento commentedon Jun 19, 2024
Tried your release, sorry for the delay.
It works ok but the generated CSV is not properly "standard".
I mean: looking at the file, we have a first part with Timecode list and a second part with Scene Number, that are CSV formatted in a really different way each other.
Please, write two files so that I can directly import the Scene number and frame in Excel.
When you will have time (if you want to ease my CSV file "postprocessing" :) ), simply output a file with a column of plain scene start frames, almost such as the example I did in the first post.
Breakthrough commentedon Jun 19, 2024
@tormento if you use the
--skip-cutsoption the file will omit the first row to allow it to be imported directly into Excel. This is not done by default for historical reasons, and will be fixed when we have a replacement for thelist-scenescommand in a future version.The start frame column should align with the cut points you need for I frames.
Breakthrough commentedon Sep 29, 2024
@tormento one thing I'm not totally clear on is how this works with input seeking. Do the frame numbers refer to the encoded output frame numbers, or the frame numbers of the input?
For example, if we use start seeking, does the QP need to still start from frame 0, or should it be shifted?
[cli] Add new `export-qp` command (#388)
[cli] Add new `export-qp` command (#388)
[cli] Add new `export-qp` command (#388)
[cli] Add new `export-qp` command (#388)
tormento commentedon Sep 30, 2024
The QP file tells the encoder (x264/x265) where to force a specific type of frame.
In our case, to have a clean scene cut, we need
Itype, i.e. what once was called a keyframe.The CSV that PySceneDetect is shifted by 1, compared to encoder convention (wheree first frame is 0), so you need to take the (Start Frame-1) to have the appropriate position.
P.S: I think that the
-1value is totally optional but some tools output it and I kept on using. According to x265 readme, the number after the frame type should force a QP value but I never had use of it other than for keyframes.[cli] Add new `export-qp` command (#388)
[cli] Add new `export-qp` command (#388)
Breakthrough commentedon Oct 1, 2024
@tormento Thanks, I should have that working now as a new
save-qpcommand. Would you like to test a development version to verify?You can grab one for Windows here or from the latest build on PR #427.Replaced by PR #448Invoking it as
scenedetect -i video.mp4 save-qpresults in the following examplevideo.qp:Let me know what you think :)
tormento commentedon Oct 2, 2024
Will try ASAP.
tormento commentedon Oct 2, 2024
Works perfectly, same result as my manual csv to qp conversion.
Thank you! You saved me a lot of work!
[cli] Add new `export-qp` command (#388)
[cli] Add new `save-qp` command (#388)
[cli] Add new save-qp command (#448)
save-commands) #344