videoscripts icon indicating copy to clipboard operation
videoscripts copied to clipboard

An exception occurred

Open ghost opened this issue 9 years ago • 2 comments

Hello, I try to use makesprites but I have an error. Could you help me please? The logfile:

START [2015-10-04 00:34:33.791965] : ffmpeg -i video.mp4 -f image2 -bt 20M -vf fps=1/45 -aspect 16:9 /home/me/test/thumb/thumbs/video_vtt/tv%03d.jpg END [2015-10-04 00:34:37.131788] ffmpeg version N-75725-ge06114f Copyright (c) 2000-2015 the FFmpeg developers built with gcc 4.7 (Debian 4.7.2-5) configuration: --prefix=/usr libavutil 55. 2.100 / 55. 2.100 libavcodec 57. 4.100 / 57. 4.100 libavformat 57. 2.102 / 57. 2.102 libavdevice 57. 0.100 / 57. 0.100 libavfilter 6. 9.101 / 6. 9.101 libswscale 4. 0.100 / 4. 0.100 libswresample 2. 0.100 / 2. 0.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4': Metadata: major_brand : mp42 minor_version : 1 compatible_brands: mp42mp41 creation_time : 2015-03-05 19:27:05 Duration: 00:00:24.36, start: 0.000000, bitrate: 1619 kb/s Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 1359 kb/s, 29.97 fps, 29.97 tbr, 2997 tbn, 5994 tbc (default) Metadata: creation_time : 2015-03-05 19:27:05 handler_name : Apple Video Media Handler Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 255 kb/s (default) Metadata: creation_time : 2015-03-05 19:27:05 handler_name : Apple Sound Media Handler [swscaler @ 0x32508a0] deprecated pixel format used, make sure you did set range correctly Output #0, image2, to '/home/me/test/thumb/thumbs/video_vtt/tv%03d.jpg': Metadata: major_brand : mp42 minor_version : 1 compatible_brands: mp42mp41 encoder : Lavf57.2.102 Stream #0:0(eng): Video: mjpeg, yuvj420p(pc), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 0.02 fps, 0.02 tbn, 0.02 tbc (default) Metadata: creation_time : 2015-03-05 19:27:05 handler_name : Apple Video Media Handler encoder : Lavc57.4.100 mjpeg Stream mapping: Stream #0:0 -> #0:0 (h264 (native) -> mjpeg (native)) Press [q] to stop, [?] for help frame= 0 fps=0.0 q=0.0 size=N/A time=00:00:00.00 bitrate=N/A
frame= 0 fps=0.0 q=0.0 size=N/A time=00:00:00.00 bitrate=N/A
frame= 0 fps=0.0 q=0.0 size=N/A time=00:00:00.00 bitrate=N/A
frame= 0 fps=0.0 q=0.0 size=N/A time=00:00:00.00 bitrate=N/A
frame= 0 fps=0.0 q=0.0 size=N/A time=00:00:00.00 bitrate=N/A
frame= 0 fps=0.0 q=0.0 size=N/A time=00:00:00.00 bitrate=N/A
frame= 2 fps=0.6 q=5.0 Lsize=N/A time=00:01:30.00 bitrate=N/A
video:88kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

Removing first image, unneeded 1 thumbs written in /home/me/test/thumb/thumbs/video_vtt START [2015-10-04 00:34:37.133134] : sips --resampleWidth 100 /home/me/test/thumb/thumbs/video_vtt/tv002.jpg ERROR [2015-10-04 00:34:37.137101] An exception occurred None [Errno 2] No such file or directory

and I have a black image in thumbs/video_vtt/tv002.jpg I installed ffmpeg thanks to http://superuser.com/questions/286675/how-to-install-ffmpeg-on-debian - option 3 - git://source.ffmpeg.org/ffmpeg.git)

ghost avatar Oct 03 '15 22:10 ghost

DISREGARD - SEE NEXT COMMENT So - in your case, only 1 file was written, most likely because your thumb rate interval is greater than the length of your video. It defaults to 45 seconds (a picture taken every 45 seconds of video). Was your video less than 45 seconds long?

There's a second variable in makesprites, SKIP_FIRST, that by default is set to True. This deletes the first image (which in my videos is usually a black frame or other non-useful image.) It's not particularly helpful to include a screenshot of the very start second of a video, since people are presumably trying to seek into the middle of the video and want to see what section that is in the thumbnail image. If they want to go to the very start, they can do that without a thumbnail. I recommend keeping this variable set as is.

In your case, since only 1 image was created and the first image was deleted, you hit an exception case. I never used this script with such short videos myself. And of course, a sprite with only 1 image (if you didn't customize the thumbRate but instead changed SKIP_FIRST) would not be useful for previewing the middle of the video.

  1. If you are running makesprites directly, you could edit the run(task) line in makesprites to add a custom value, e.g. to take a picture every 5 seconds: run(task,thumbRate=5)
  2. If you are running batchsprites, you can pass in the custom thumb rate interval from the command line. See the sample in the comments at the top of that script.

vlanard avatar Oct 09 '15 17:10 vlanard

ACTUALLY - I've just run the code. I am not able to reproduce your error, but my previous suggestion that the thumb wasn't created is wrong. You DO have the tv002.jpg file created, so that's not the problem.

First problem

  • default thumb rate is to take a picture every 45 seconds. Looks like your video is only 24 seconds long, so that's not ideal for thumbnail screenshots. You should adjust.
  • If you are running makesprites directly, you could edit the run(task) line in makesprites to add a custom value, e.g. to take a picture every 5 seconds: run(task,thumbRate=5)
  • If you are running batchsprites, you can pass in the custom thumb rate interval from the command line. See the sample in the comments at the top of that script for how to do that.

Second problem - The error that the file doesn't exist is not due to what I previously thought. The tv002.jpg does exist in your case (possibly black because probably taken at the very end of your video? it's common for beginning frame to also be black but it's normally deleted). If you can extract the "ffmpeg" command line from your output and just run it in a terminal, you can verify there's no problem with your ffmpeg install. And do the same with the "sips" command on some image that you put in that directory to verify it works as well.

Could be a permissions issue, though that doesn't seem likely since ffmpeg was able to access that directory, so why not sips? But that's something to consider.

Best suggestion is for you to debug. Pause before sips runs and examine what's in the directory. Running the commands manually will tell you if there's a permissions or setup error.

vlanard avatar Oct 09 '15 18:10 vlanard