aharmer / pathtrackr

An R package for video tracking and analysing animal movement
29 stars 8 forks source link

splitVideo produces empty folder and empty COMPRESSED.avi #12

Closed calebvogt closed 5 years ago

calebvogt commented 5 years ago

Hi, I have been getting along well with the package until very recently.

Briefly, I have three avi's that I would like to track: https://drive.google.com/drive/folders/1HAXvsa9yakmn25oT4wvNUUod9wV1E9Jm?usp=sharing

1.avi tracks perfectly and produces a folder with jpgs and a 1_COMPRESSED.avi as well. 2.avi and 3.avi produce empty folders and 2_COMPRESSED.avi and 3_COMPRESSED.avi video which each have 0 bytes.

I have copied the ffmpeg information for each of the three videos below, my apologies for the formatting. At first, I thought it might be a problem with the codec, as the h264 codec (1.avi) works just fine and 3.avi does not (3.avi has a mpeg4 codec). However, 2.avi ALSO has the h264 codec, and does not track using pathtrackr.

The ONLY other major difference I can discern between 1 and 2/3 is the Metadata encoder, which are as follows:

1.avi = Lavf54.63.104 2.avi = Lavf58.17.101 3.avi = Lavf58.17.101

Please let me know if you are aware of this bug, or if theres anything I can do to convert videos 2 and 3 to have the same encoder as 1. Any help is much appreciated, I spent all day tracking down this discrepancy!!!

**E:\Data\3_Liddell_Ecology_proc\OFT\test>ffmpeg -i 1.avi ffmpeg version N-91448-gbd8a5c6b7c Copyright (c) 2000-2018 the FFmpeg developers built with gcc 7.3.1 (GCC) 20180710 configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth libavutil 56. 18.102 / 56. 18.102 libavcodec 58. 21.104 / 58. 21.104 libavformat 58. 17.101 / 58. 17.101 libavdevice 58. 4.101 / 58. 4.101 libavfilter 7. 25.100 / 7. 25.100 libswscale 5. 2.100 / 5. 2.100 libswresample 3. 2.100 / 3. 2.100 libpostproc 55. 2.100 / 55. 2.100 Input #0, avi, from '1.avi': Metadata: encoder : Lavf54.63.104 Duration: 00:09:59.87, start: 0.000000, bitrate: 446 kb/s Stream #0:0: Video: h264 (High) (H264 / 0x34363248), yuv420p(progressive), 1920x1080, 443 kb/s, 15 fps, 15 tbr, 15 tbn, 30 tbc Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 8000 Hz, mono, fltp, 128 kb/s At least one output file must be specified

E:\Data\3_Liddell_Ecology_proc\OFT\test>ffmpeg -i 2.avi ffmpeg version N-91448-gbd8a5c6b7c Copyright (c) 2000-2018 the FFmpeg developers built with gcc 7.3.1 (GCC) 20180710 configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth libavutil 56. 18.102 / 56. 18.102 libavcodec 58. 21.104 / 58. 21.104 libavformat 58. 17.101 / 58. 17.101 libavdevice 58. 4.101 / 58. 4.101 libavfilter 7. 25.100 / 7. 25.100 libswscale 5. 2.100 / 5. 2.100 libswresample 3. 2.100 / 3. 2.100 libpostproc 55. 2.100 / 55. 2.100 [avi @ 000002826b289bc0] Could not find codec parameters for stream 1 (Audio: mp3 (mp3float) (U[0][0][0] / 0x0055), 8000 Hz, 1 channels, fltp): unspecified frame size Consider increasing the value for the 'analyzeduration' and 'probesize' options Guessed Channel Layout for Input Stream #0.1 : mono Input #0, avi, from '2.avi': Metadata: encoder : Lavf58.17.101 Duration: 00:10:00.20, start: 0.000000, bitrate: 1137 kb/s Stream #0:0: Video: h264 (High) (H264 / 0x34363248), yuv420p(progressive), 1920x1080, 1134 kb/s, 15 fps, 15 tbr, 15 tbn, 30 tbc Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 8000 Hz, mono, fltp At least one output file must be specified

E:\Data\3_Liddell_Ecology_proc\OFT\test>ffmpeg -i 3.avi ffmpeg version N-91448-gbd8a5c6b7c Copyright (c) 2000-2018 the FFmpeg developers built with gcc 7.3.1 (GCC) 20180710 configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth libavutil 56. 18.102 / 56. 18.102 libavcodec 58. 21.104 / 58. 21.104 libavformat 58. 17.101 / 58. 17.101 libavdevice 58. 4.101 / 58. 4.101 libavfilter 7. 25.100 / 7. 25.100 libswscale 5. 2.100 / 5. 2.100 libswresample 3. 2.100 / 3. 2.100 libpostproc 55. 2.100 / 55. 2.100 [mpeg4 @ 0000021b950abdc0] Failed to parse extradata [avi @ 0000021b95099bc0] Could not find codec parameters for stream 1 (Audio: mp3 (mp3float) (U[0][0][0] / 0x0055), 8000 Hz, 1 channels, fltp): unspecified frame size Consider increasing the value for the 'analyzeduration' and 'probesize' options Guessed Channel Layout for Input Stream #0.1 : mono Input #0, avi, from '3.avi': Metadata: encoder : Lavf58.17.101 Duration: 00:10:00.00, start: 0.000000, bitrate: 973 kb/s Stream #0:0: Video: mpeg4 (Simple Profile) (FMP4 / 0x34504D46), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 970 kb/s, 15 fps, 15 tbr, 15 tbn, 15 tbc Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 8000 Hz, mono, fltp At least one output file must be specified**

aharmer commented 5 years ago

The problem seems to be with the audio on files 2 and 3, they are missing bitrate info and so ffmpeg can't handle them. If you strip the sound from the videos (as it is not used in pathtrackr anyway) they will then work fine using the splitVideo function. Use the following code within a terminal window to convert your videos to new files without sound:

ffmpeg -i 2.avi -vcodec copy -an 2_no_sound.avi

calebvogt commented 5 years ago

Ah, thanks so much! I found another work around, but your is much better and can be implemented earlier in my video processing code. I appreciate the quick response.