excitoon / video-remove-silence

Tool for removing silence from video files
MIT License
109 stars 23 forks source link

Where's the output file? #7

Closed FilipeMarch closed 4 years ago

FilipeMarch commented 5 years ago

I've run the algorithm video-remove-silence on three different video files, but nothing happens after the process ends. I can't find any output_file anywhere.

Where the output_file should be located? My folder and video remains completely unchanged after running this program.

I'm using Python 3.7, Linux Mint 19.1

Erudition commented 5 years ago

The code says it should be called (original name)_result_.(original extension).

Erudition commented 5 years ago

Okay, you're right, there was no output, but looking at the log is seems like this last line is supposed to be an error:

Stream map '0:v:0' matches no streams.
To ignore this, add a trailing '?' to the map.

So I made the change it suggests and sure enough, the video_result file is spit out in the same folder. Unfortunately, in that case it lacks the visual part - it's just sound.

I notice also that there's this in the log where the video get extracted:

Output #0, mp4, to '/tmp/tmpbj9nq18_':
  Metadata:
    encoder         : Lavf58.20.100
    Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1080x1920, q=-1--1, 30 fps, 15360 tbn, 30 tbc
    Metadata:
      encoder         : Lavc58.35.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame=    0 fps=0.0 q=0.0 Lsize=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

So yeah, the error is caused for good reason - ffmpeg was given a 0-second video stream. not sure why this is, but since the dev seems not to be responding, I'll tinker with it.

Erudition commented 5 years ago

Okay, I messed around for hours, good thing I didn't give up!

Try removing this line from the script: https://github.com/excitoon/video-remove-silence/blob/98021460aea4a73bfc06d96c3a22765ff784ae53/video-remove-silence#L204

which says: decoder.stderr.close()

...which, in my case, stopped the one ffmpeg call from producing zero-length output! Now it all works fine!

Author: I'm not sure why closing standard error would close standard in as well (I'm assuming that's what's happening) but it does!

Erudition commented 5 years ago

Okay, now I'm mad - turns out this fix is exactly what was in @eperez 's pull request #6 from back in May!

And I'm mostly mad at myself, because I had already tried to work around this by git-cloning eperez's fork and trying that instead. I did: git clone https://github.com/eperez/video-remove-silence.git But that clones the master branch, which (little did I know) has no changes from the original. Turns out the fix was in the bugfix/no-close-stderr branch: https://github.com/eperez/video-remove-silence/tree/bugfix/no-close-stderr ...so I did not receive the fix at the time. grr!

Anyway, to be fair, the pull request did not have a corresponding issue, and also the pull request does not explain the problem (it only says "to prevent issues") so it wouldn't have caught our attention.

@excitoon , please merge #6 !

Everyone else - in the mean time use: git clone --single-branch --branch bugfix/no-close-stderr https://github.com/eperez/video-remove-silence.git

excitoon commented 4 years ago

Let me try to reproduce it