kanehekili / VideoCut

MPEG2,MP4,MKV,WEBM Cutter for Linux using MPV and libavcodec or ffmpeg. Cutting is lossless, the target file will not be reencoded
Other
44 stars 6 forks source link

Cut Video without audio stream #3

Closed ghost closed 7 years ago

ghost commented 7 years ago

Hi, great tool! :-)

Just one minor issue: if I want to save a video that has no audio stream, it fails, see below.

I created a video just as a screen capture from my desktop for educational purposes, without the need for audio. Here is what I used: ffmpeg -video_size 1024x768 -framerate 25 -f x11grab -i :0.0+100,200 output.mp4 from https://trac.ffmpeg.org/wiki/Capture/Desktop

Log:

generate file: my.mp4
video: h264
Traceback (most recent call last):
  File "VideoCut.py", line 1255, in run
    self.function(*self.arguments)
  File "VideoCut.py", line 1088, in __makeCuts
    hasSucess = cutter.cutPart(t1, t2, index,slices)
  File "/home/ssi/dev/VideoCut/VideoCutter/build/videocut/FFMPEGTools.py", line 632, in cutPart
    audioMode = self._audioMode(self.MODE_CUT)
  File "/home/ssi/dev/VideoCut/VideoCutter/build/videocut/FFMPEGTools.py", line 664, in _audioMode
    log("audio:",self._config.streamData.getAudioStream().getCodec())
AttributeError: 'NoneType' object has no attribute 'getCodec'

I could simply resolve that by checking, if there is no audio stream, in which case I returned an empty array. This way, my cut video was saved perfectly!

in FFMPEGTools.py, line 664, in _audioMode I added right at the beginning:

        if not self._config.streamData.getAudioStream():
            log("audio:","None")
            return []
kanehekili commented 7 years ago

Could you please check the latest commits? This has been handled already. https://github.com/kanehekili/VideoCut/commit/fc572bfcdbfe540ad43df9c0d672f55eba4b2239 on December 2016. But was'nt included in the build. My error. Version 0.92 created