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
'Error splitting video (ffmpeg returned 1) ' occurs while using 'split_video_ffmpeg' #392
@MqLeet in v0.6.1 I added -map 0 to the ffmpeg args as part of fixing #271. It seems to cause issues for this particular video, I am not entirely sure why though.
@MqLeet thank you for sharing the sample, that was really helpful. Running through ffprobe I see the following streams:
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'tokyo-walk.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf60.3.100
Duration: 00:00:59.97, start: 0.000000, bitrate: 6462 kb/s
Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 6459 kb/s, 30 fps, 30 tbr, 15360 tbn (default)
Metadata:
handler_name : Core Media Video
vendor_id : [0][0][0][0]
encoder : Lavc60.3.100 libx264
timecode : 00:00:00:00
Stream #0:1[0x2](eng): Data: none (tmcd / 0x64636D74)
Metadata:
handler_name : Core Media Video
timecode : 00:00:00:00
Unsupported codec with id 0 for input stream 1
I was able to rework the set of mappings from -map 0 to -map 0:v -map 0:a? -map 0:s? to get it to work. NOTE: The order of the streams is important!
Initially I thought the video mapping would need to be -map 0:v:0 (only select the first video stream), but selecting all video streams seems to work as well. I'm not sure why it works since it seems to interpret both streams as videos. Thanks for the report though, I'll make sure to update the default args in the next release.
Open items before closing:
Decide on a default video mapping:
-map 0:v matches current behavior, but might fail if one of the video streams is unsupported.
-map 0:v:0 would only take a single video stream if multiple are present, which reduces the chances of failures, and only selects the stream PySceneDetect processed. This may be the best option for compatibility, but would require anyone dealing with multiple video streams to override the default set of arguments.
@MqLeet in v0.6.1 I added -map 0 to the ffmpeg args as part of fixing #271. It seems to cause issues for this particular video, I am not entirely sure why though.
Keeping this issue open until the items in the previous comment are resolved. I think changing these options should be considered in order to improve compatibility out-of-the-box, but still want to verify the new mapping I've proposed.
@yongyongdown try setting show_output=True when calling split_video_ffmpeg to get more information about the error. That will let you know why ffmpeg does not like the input. Can you try that and post it here?
It looks like you are using a very old version of ffmpeg which is probably why the default arguments aren't working. What version of PySceneDetect are you using? Can you also try with a newer version of ffmpeg?
Activity
MqLeet commentedon Apr 22, 2024
Hi @Breakthrough, thanks for your great work! Can you help me?😭
Breakthrough commentedon Apr 27, 2024
@MqLeet in v0.6.1 I added
-map 0to the ffmpeg args as part of fixing #271. It seems to cause issues for this particular video, I am not entirely sure why though.You can override the default ffmpeg arguments by setting the
arg_overrideparameter ofsplit_video_ffmpeg().Can you remove the
-map 0from the defaults and try to see if that works? Thanks!Breakthrough commentedon Apr 27, 2024
@MqLeet thank you for sharing the sample, that was really helpful. Running through
ffprobeI see the following streams:I was able to rework the set of mappings from
-map 0to-map 0:v -map 0:a? -map 0:s?to get it to work. NOTE: The order of the streams is important!Initially I thought the video mapping would need to be
-map 0:v:0(only select the first video stream), but selecting all video streams seems to work as well. I'm not sure why it works since it seems to interpret both streams as videos. Thanks for the report though, I'll make sure to update the default args in the next release.Open items before closing:
-map 0:vmatches current behavior, but might fail if one of the video streams is unsupported.-map 0:v:0would only take a single video stream if multiple are present, which reduces the chances of failures, and only selects the stream PySceneDetect processed. This may be the best option for compatibility, but would require anyone dealing with multiple video streams to override the default set of arguments.MqLeet commentedon Apr 28, 2024
Hi @Breakthrough , after removing "-map 0" , bug fixed!

Thanks for your great work!
Breakthrough commentedon May 8, 2024
Keeping this issue open until the items in the previous comment are resolved. I think changing these options should be considered in order to improve compatibility out-of-the-box, but still want to verify the new mapping I've proposed.
Breakthrough commentedon May 19, 2024
A single stream is likely the most common use case, so I will choose that for a default.
[video_splitter] Update default ffmpeg stream mapping
yongyongdown commentedon Jun 24, 2024
hello
I too am experiencing the same problem.
run the code below, an error will appear.
I also modified DEFAULT_FFMPEG_ARGS like this. But still the problem persists.

What should I do?
Thank you for your reply.
Breakthrough commentedon Jun 25, 2024
@yongyongdown try setting
show_output=Truewhen callingsplit_video_ffmpegto get more information about the error. That will let you know why ffmpeg does not like the input. Can you try that and post it here?yongyongdown commentedon Jun 25, 2024
@Breakthrough
run it,
but, I don't know where I saw this code, but when I run it, it works fine.


The first code removes map from arg_override,
The code that works well is the one with only -map 0 added.
Likewise, add arg_override='-map 0' to the first code, it works well.
Breakthrough commentedon Jun 26, 2024
It looks like you are using a very old version of ffmpeg which is probably why the default arguments aren't working. What version of PySceneDetect are you using? Can you also try with a newer version of ffmpeg?
yongyongdown commentedon Jun 27, 2024
I used ffmpeg == 4.3, pyscenedetect == 0.6.4
I don't think I am using an old version. In any case, the issue has been resolved, but please let me know if you need any information
tavyscrolls commentedon Sep 27, 2024
On Ubuntu, you need to switch channels from stable (ffmpeg 4.3 ~2020) to latest/edge