Can FFmpeg crop gif image under 1 second? - swift

I am developing an iOS application about gif.
But I have a problem with gif cropping. Cropping gif spends so many times with FFmpeg.
(updated code)
These are the ffmpeg codes I've tried.
cropped images -> gif
ffmpeg -f image2 -i %d.jpg -vf 'scale=450:-1' output.gif
using concat command (cropped images -> gif)
ffmpeg -f concat -i tmp.txt output.gif
using crop filter
ffmpeg -i in.gif -filter:v "crop=out_w:out_h:x:y" out.gif
These codes are so slow when converting images to gif
or gif to cropped gif.
Is there a way to reduce the time to crop gif less than 1 second?
(updated2)
ffmpeg -i in.gif -filter:v "crop=out_w:out_h:x:y" out.gif
ffmpeg version 4.4 Copyright (c) 2000-2021 the FFmpeg developers
built with Apple clang version 12.0.5 (clang-1205.0.22.9)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.4_2 --enable-shared
--enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-avresample --enable-videotoolbox libavutil 56. 70.100 / 56. 70.100 libavcodec 58.134.100 /
58.134.100 libavformat 58. 76.100 / 58. 76.100 libavdevice 58. 13.100 / 58. 13.100 libavfilter 7.110.100 / 7.110.100 libavresample 4. 0. 0 / 4. 0. 0 libswscale 5. 9.100 /
5. 9.100 libswresample 3. 9.100 / 3. 9.100 libpostproc 55. 9.100 / 55. 9.100 Input #0, gif, from './test.gif': Duration: 00:00:18.27, start: 0.000000, bitrate: 70098 kb/s Stream #0:0:
Video: gif, bgra, 1080x1920, 15 fps, 14.99 tbr, 100 tbn, 100 tbc
Stream mapping: Stream #0:0 -> #0:0 (gif (native) -> gif (native))
Press [q] to stop, [?] for help Output #0, gif, to './crop.gif':
Metadata:
encoder : Lavf58.76.100 Stream #0:0: Video: gif, bgr8(pc, progressive), 1080x1198, q=2-31, 200 kb/s, 14.99 fps, 100 tbn
Metadata:
encoder : Lavc58.134.100 gif frame= 1 fps=0.0 q=-0.0 size= 0kB time=00:00:00.01 bitrate= 0.0kbits/s speed=5e+03x
frame= 11 fps=0.0 q=-0.0 size= 4096kB time=00:00:00.68
bitrate=49344.8kbits/s speed=1.31x frame= 22 fps= 21 q=-0.0
size= 8192kB time=00:00:01.41 bitrate=47594.9kbits/s speed=1.32x
frame= 32 fps= 20 q=-0.0 size= 12288kB time=00:00:02.08
bitrate=48395.8kbits/s speed=1.32x frame= 43 fps= 20 q=-0.0
size= 16384kB time=00:00:02.81 bitrate=47764.3kbits/s speed=1.33x
frame= 54 fps= 20 q=-0.0 size= 20992kB time=00:00:03.55
bitrate=48441.3kbits/s speed=1.33x frame= 65 fps= 20 q=-0.0
size= 24832kB time=00:00:04.28 bitrate=47528.9kbits/s speed=1.35x
frame= 77 fps= 21 q=-0.0 size= 28928kB time=00:00:05.08
bitrate=46649.2kbits/s speed=1.36x frame= 87 fps= 21 q=-0.0
size= 32768kB time=00:00:05.75 bitrate=46684.4kbits/s speed=1.36x
frame= 98 fps= 21 q=-0.0 size= 36608kB time=00:00:06.48
bitrate=46279.7kbits/s speed=1.36x frame= 109 fps= 21 q=-0.0
size= 40704kB time=00:00:07.22 bitrate=46183.8kbits/s speed=1.37x
frame= 120 fps= 21 q=-0.0 size= 44800kB time=00:00:07.95
bitrate=46163.7kbits/s speed=1.37x frame= 131 fps= 21 q=-0.0
size= 49152kB time=00:00:08.69 bitrate=46335.2kbits/s speed=1.38x
frame= 142 fps= 21 q=-0.0 size= 53504kB time=00:00:09.42
bitrate=46529.2kbits/s speed=1.37x frame= 153 fps= 21 q=-0.0
size= 57344kB time=00:00:10.15 bitrate=46282.0kbits/s speed=1.38x
frame= 164 fps= 21 q=-0.0 size= 61184kB time=00:00:10.89
bitrate=46025.6kbits/s speed=1.38x frame= 174 fps= 21 q=-0.0
size= 65280kB time=00:00:11.55 bitrate=46300.8kbits/s speed=1.37x
frame= 185 fps= 21 q=-0.0 size= 69376kB time=00:00:12.29
bitrate=46243.1kbits/s speed=1.38x frame= 196 fps= 21 q=-0.0
size= 72960kB time=00:00:13.02 bitrate=45905.4kbits/s speed=1.38x
frame= 207 fps= 21 q=-0.0 size= 76544kB time=00:00:13.76
bitrate=45570.4kbits/s speed=1.38x frame= 218 fps= 21 q=-0.0
size= 80640kB time=00:00:14.49 bitrate=45590.3kbits/s speed=1.38x
frame= 229 fps= 21 q=-0.0 size= 84224kB time=00:00:15.23
bitrate=45302.9kbits/s speed=1.39x frame= 240 fps= 21 q=-0.0
size= 88064kB time=00:00:15.96 bitrate=45201.8kbits/s speed=1.39x
frame= 250 fps= 21 q=-0.0 size= 91648kB time=00:00:16.63
bitrate=45146.1kbits/s speed=1.39x frame= 261 fps= 21 q=-0.0
size= 96000kB time=00:00:17.36 bitrate=45301.4kbits/s speed=1.38x
frame= 271 fps= 21 q=-0.0 size= 99840kB time=00:00:18.03
bitrate=45362.7kbits/s speed=1.38x frame= 274 fps= 21 q=-0.0
Lsize= 101552kB time=00:00:18.23 bitrate=45634.2kbits/s speed=1.37x
video:101552kB audio:0kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 0.000019%
it takes 12 seconds

Related

ffmpeg seems to output a video with a wrong codec?

I´m using ffmpeg with flutter and I create a video from a lot of images. The problem: ffmpeg seems to not create a video with a right codec or something else.... please check my description below for concrete informations.
First the code parts:
Creating video from images
-r $settings_fps -i $tempPath/img%04d.jpg -vcodec libx264 -y -an -vf "pad=ceil(iw/2)*2:ceil(ih/2)*2" -shortest $tempPath/$videoFileName.mp4
Adding audio to the created video
-i ${finalSong.path} -i $videoPath -c:a aac -shortest $tempPath/$newVideoFileName.mp4
This is my video output from console on creating this video:
flutter: ffmpeg version git-2020-01-25-fd11dd500 Copyright (c) 2000-2020 the FFmpeg developers
built with Apple clang version 11.0.0 (clang-1100.0.33.17)
configuration: --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk --prefix=/Users/taner/Projects/mobile-ffmpeg/prebuilt/ios-arm64-apple-darwin/ffmpeg --enable-version3 --arch=aarch64 --cpu=armv8 --target-os=darwin --ar=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar --cc=clang --cxx=clang++ --as='/Users/taner/Projects/mobile-ffmpeg/.tmp/gas-preprocessor.pl -arch aarch64 -- clang -arch arm64 -target aarch64-ios-darwin -march=armv8-a+crc+crypto -mcpu=generic -DMOBILE_FFMPEG_ARM64 -Wno-unused-function -Wno-deprecated-declarations -fstrict-aliasing -fembed-bitcode -DIOS -DMOBILE_FFMPEG_BUILD_DATE=20200125 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk -Oz -miphoneos-version-min=12.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/usr/include' --ranlib=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib --strip=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip --enable-neon --enable-cross-compile --enable-pic --enable-asm --enable-inline-asm --enable-optimizations --enable-swscale --enable-static --disable-shared --enable-small --disable-v4l2-m2m --disable-outdev=v4l2 --disable-outdev=fbdev --disable-indev=v4l2 --disable-indev=fbdev --disable-openssl --disable-xmm-clobber-test --disable-debug --disable-neon-clobber-test --disable-programs --disable-postproc --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-sndio --disable-schannel --disable-securetransport --disable-xlib --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --disable-appkit --disable-alsa --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --enable-gmp --enable-gnutls --enable-libx264 --enable-gpl --enable-libxvid --enable-gpl --enable-libx265 --enable-gpl --enable-libvidstab --enable-gpl --disable-sdl2 --enable-zlib --enable-audiotoolbox --enable-coreimage --enable-bzlib --enable-videotoolbox --enable-avfoundation --enable-iconv
libavutil 56. 38.100 / 56. 38.100
libavcodec 58. 65.102 / 58. 65.102
libavformat 58. 35.101 / 58. 35.101
libavdevice 58. 9.103 / 58. 9.103
libavfilter 7. 70.101 / 7. 70.101
libswscale 5. 6.100 / 5. 6.100
libswresample 3. 6.100 / 3. 6.100
Input #0, mp3, from '/var/mobile/Containers/Data/Application/AEEF7BB8-36F3-4ECD-824B-B294E9DF7294/Library/Caches/melodic_slow.mp3':
Metadata:
encoder : LAME 32bits version 3.99.5 (http://lame.sf.net)
TLEN : 134072
Duration: 00:02:14.11, start: 0.025057, bitrate: 320 kb/s
Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 320 kb/s
Metadata:
encoder : LAME3.99r
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '/var/mobile/Containers/Data/Application/AEEF7BB8-36F3-4ECD-824B-B294E9DF7294/Library/Caches/Memories_163dfbf0-f4cf-11ea-86c6-cd08c5621e56.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.35.101
Duration: 00:00:03.50, start: 0.000000, bitrate: 10069 kb/s
Stream #1:0(und): Video: h264 (avc1 / 0x31637661), yuvj422p(pc), 1920x1080 [SAR 1:1 DAR 16:9], 10065 kb/s, 24 fps, 24 tbr, 12288 tbn, 48 tbc (default)
Metadata:
handler_name : VideoHandler
Stream mapping:
Stream #1:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:0 -> #0:1 (mp3 (mp3float) -> aac (native))
Press [q] to stop, [?] for help
frame= 0 fps=0.0 q=0.0 size= 0kB time=-577014:32:22.77 bitrate= -0.0kbits/s speed=N/A
sws_param option is deprecated and ignored
using SAR=1/1
using cpu capabilities: ARMv8 NEON
profile High 4:2:2, level 4.0, 4:2:2, 8-bit
264 - core 159 - H.264/MPEG-4 AVC codec - Copyleft 2003-2019 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=9 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=24 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to '/var/mobile/Containers/Data/Application/AEEF7BB8-36F3-4ECD-824B-B294E9DF7294/Library/Caches/Memories_191007b0-f4cf-11ea-9024-c9fcef51db39.mp4':
Metadata:
TLEN : 134072
encoder : Lavf58.35.101
Stream #0:0(und): Video: h264 (libx264) (avc1 / 0x31637661), yuvj422p(pc, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 24 fps, 12288 tbn, 24 tbc (default)
Metadata:
handler_name : VideoHandler
encoder : Lavc58.65.102 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
Stream #0:1: Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s
Metadata:
encoder : Lavc58.65.102 aac
frame= 47 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= 0x
frame= 61 fps= 49 q=28.0 size= 256kB time=00:00:00.23 bitrate=9033.3kbits/s speed=0.187x
frame= 73 fps= 42 q=28.0 size= 512kB time=00:00:00.71 bitrate=5827.4kbits/s speed=0.411x
frame= 84 fps= 21 q=-1.0 Lsize= 3418kB time=00:00:03.50 bitrate=7986.4kbits/s speed=0.856x
video:3359kB audio:55kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.117042%
frame I:1 Avg QP:22.78 size:170700
frame P:22 Avg QP:23.95 size: 83595
frame B:61 Avg QP:28.22 size: 23428
consecutive B-frames: 2.4% 2.4% 0.0% 95.2%
mb I I16..4: 1.8% 97.3% 0.9%
mb P I16..4: 0.4% 13.4% 1.0% P16..4: 39.0% 21.7% 14.2% 0.0% 0.0% skip:10.3%
mb B I16..4: 0.1% 2.4% 0.2% B16..8: 27.0% 6.3% 2.1% direct: 2.4% skip:59.5% L0:39.3% L1:47.8% BI:12.9%
8x8 transform intra:91.6% inter:83.1%
coded y,uvDC,uvAC intra: 88.4% 97.3% 40.9% inter: 21.1% 26.6% 1.7%
i16 v,h,dc,p: 18% 27% 7% 48%
i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 18% 18% 16% 5% 8% 8% 9% 7% 9%
i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 18% 16% 13% 7% 11% 10% 10% 7% 8%
i8c dc,h,v,p: 41% 19% 28% 12%
Weighted P-Frames: Y:0.0% UV:0.0%
ref P L0: 53.9% 22.4% 18.3% 5.4%
ref B L0: 86.7% 9.9% 3.4%
ref B L1: 96.1% 3.9%
kb/s:7860.37
Qavg: 149.884
flutter: ffmpeg version git-2020-01-25-fd11dd500
flutter: Copyright (c) 2000-2020 the FFmpeg developers
flutter:
flutter: built with Apple clang version 11.0.0 (clang-1100.0.33.17)
flutter: configuration: --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk --prefix=/Users/taner/Projects/mobile-ffmpeg/prebuilt/ios-arm64-apple-darwin/ffmpeg --enable-version3 --arch=aarch64 --cpu=armv8 --target-os=darwin --ar=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar --cc=clang --cxx=clang++ --as='/Users/taner/Projects/mobile-ffmpeg/.tmp/gas-preprocessor.pl -arch aarch64 -- clang -arch arm64 -target aarch64-ios-darwin -march=armv8-a+crc+crypto -mcpu=generic -DMOBILE_FFMPEG_ARM64 -Wno-unused-function -Wno-deprecated-declarations -fstrict-aliasing -fembed-bitcode -DIOS -DMOBILE_FFMPEG_BUILD_DATE=20200125 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk -Oz -miphoneos-version-min=12.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/usr/include' --ranlib=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib --strip=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip --enable-neon --enable-cross-compile --enable-pic --enable-asm --enable-inline-asm --enable-optimizations --enable-swscale --enable-static --disable-shared --enable-small --disable-v4l2-m2m --disable-outdev=v4l2 --disable-outdev=fbdev --disable-indev=v4l2 --disable-indev=fbdev --disable-openssl --disable-xmm-clobber-test --disable-debug --disable-neon-clobber-test --disable-programs --disable-postproc --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-sndio --disable-schannel --disable-securetransport --disable-xlib --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --disable-appkit --disable-alsa --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --enable-gmp --enable-gnutls --enable-libx264 --enable-gpl --enable-libxvid --enable-gpl --enable-libx265 --enable-gpl --enable-libvidstab --enable-gpl --disable-sdl2 --enable-zlib --enable-audiotoolbox --enable-coreimage --enable-bzlib --enable-videotoolbox --enable-avfoundation --enable-iconv
flutter: libavutil 56. 38.100 / 56. 38.100
flutter: libavcodec 58. 65.102 / 58. 65.102
flutter: libavformat 58. 35.101 / 58. 35.101
flutter: libavdevice 58. 9.103 / 58. 9.103
flutter: libavfilter 7. 70.101 / 7. 70.101
flutter: libswscale 5. 6.100 / 5. 6.100
flutter: libswresample 3. 6.100 / 3. 6.100
flutter: Input #0, image2, from '/var/mobile/Containers/Data/Application/AEEF7BB8-36F3-4ECD-824B-B294E9DF7294/Library/Caches/img%04d.jpg':
flutter: Duration:
flutter: 00:00:03.40
flutter: , start:
flutter: 0.000000
flutter: , bitrate:
flutter: N/A
flutter:
flutter: Stream #0:0
flutter: : Video: mjpeg, yuvj422p(pc, bt470bg/unknown/unknown), 1920x1080 [SAR 1:1 DAR 16:9]
flutter: ,
flutter: 25 fps,
flutter: 25 tbr,
flutter: 25 tbn,
flutter: 25 tbc
flutter:
flutter: Stream mapping:
flutter: Stream #0:0 -> #0:0
flutter: (mjpeg (native) -> h264 (libx264))
flutter:
flutter: Press [q] to stop, [?] for help
flutter: sws_param option is deprecated and ignored
flutter: using SAR=1/1
flutter: using cpu capabilities: ARMv8 NEON
flutter: profile High 4:2:2, level 4.0, 4:2:2, 8-bit
flutter: 264 - core 159 - H.264/MPEG-4 AVC codec - Copyleft 2003-2019 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=9 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=24 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
flutter: Output #0, mp4, to '/var/mobile/Containers/Data/Application/AEEF7BB8-36F3-4ECD-824B-B294E9DF7294/Library/Caches/Memories_f578a1c0-f4d0-11ea-9e60-5b43394b2511.mp4':
flutter: Metadata:
flutter: encoder :
flutter: Lavf58.35.101
flutter:
flutter: Stream #0:0
flutter: : Video: h264 (libx264) (avc1 / 0x31637661), yuvj422p(pc), 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1
flutter: ,
flutter: 24 fps,
flutter: 12288 tbn,
flutter: 24 tbc
flutter:
flutter: Metadata:
flutter: encoder :
flutter: Lavc58.65.102 libx264
flutter:
flutter: Side data:
flutter:
flutter: cpb:
flutter: bitrate max/min/avg: 0/0/0 buffer size: 0
flutter: vbv_delay: N/A
flutter:
flutter: frame= 1 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed=N/A
flutter: frame= 47 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= 0x
flutter: frame= 60 fps= 53 q=28.0 size= 256kB time=00:00:00.16 bitrate=12579.1kbits/s speed=0.147x
flutter: frame= 72 fps= 43 q=28.0 size= 768kB time=00:00:00.66 bitrate=9436.6kbits/s speed=0.401x
flutter: frame= 84 fps= 38 q=28.0 size= 1280kB time=00:00:01.16 bitrate=8987.5kbits/s speed=0.527x
flutter: frame= 85 fps= 19 q=-1.0 Lsize= 4334kB time=00:00:03.41 bitrate=10391.1kbits/s speed=0.773x
flutter: video:4332kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead:
flutter: 0.043800%
flutter:
flutter: frame I:1 Avg QP:22.19 size:178746
flutter: frame P:21 Avg QP:23.69 size:106999
flutter: frame B:63 Avg QP:28.13 size: 31899
flutter: consecutive B-frames: 1.2% 0.0% 0.0% 98.8%
flutter: mb I I16..4: 2.4% 97.0% 0.6%
flutter: mb P I16..4: 0.7% 38.2% 0.8% P16..4: 22.6% 19.2% 15.1% 0.0% 0.0% skip: 3.3%
flutter: mb B I16..4: 0.2% 6.7% 0.2% B16..8: 24.6% 8.6% 3.0% direct: 4.2% skip:52.5% L0:47.8% L1:36.8% BI:15.4%
flutter: 8x8 transform intra:95.8% inter:86.8%
flutter: coded y,uvDC,uvAC intra: 89.3% 95.1% 22.5% inter: 26.3% 28.9% 3.0%
flutter: i16 v,h,dc,p: 20% 33% 22% 24%
flutter: i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19% 24% 33% 3% 4% 3% 4% 4% 5%
flutter: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 20% 16% 6% 10% 7% 9% 6% 7%
flutter: i8c dc,h,v,p: 44% 22% 29% 5%
flutter: Weighted P-Frames: Y:0.0% UV:0.0%
flutter: ref P L0: 43.8% 18.2% 23.0% 15.0%
flutter: ref B L0: 69.6% 22.3% 8.1%
flutter: ref B L1: 86.1% 13.9%
flutter: kb/s:10018.70
flutter: Video erfolgreich erstellt
flutter: Ja. Video existiert im Pfad!
flutter: ffmpeg version git-2020-01-25-fd11dd500
flutter: Copyright (c) 2000-2020 the FFmpeg developers
flutter:
flutter: built with Apple clang version 11.0.0 (clang-1100.0.33.17)
flutter: configuration: --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk --prefix=/Users/taner/Projects/mobile-ffmpeg/prebuilt/ios-arm64-apple-darwin/ffmpeg --enable-version3 --arch=aarch64 --cpu=armv8 --target-os=darwin --ar=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar --cc=clang --cxx=clang++ --as='/Users/taner/Projects/mobile-ffmpeg/.tmp/gas-preprocessor.pl -arch aarch64 -- clang -arch arm64 -target aarch64-ios-darwin -march=armv8-a+crc+crypto -mcpu=generic -DMOBILE_FFMPEG_ARM64 -Wno-unused-function -Wno-deprecated-declarations -fstrict-aliasing -fembed-bitcode -DIOS -DMOBILE_FFMPEG_BUILD_DATE=20200125 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk -Oz -miphoneos-version-min=12.1 -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.2.sdk/usr/include' --ranlib=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib --strip=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip --enable-neon --enable-cross-compile --enable-pic --enable-asm --enable-inline-asm --enable-optimizations --enable-swscale --enable-static --disable-shared --enable-small --disable-v4l2-m2m --disable-outdev=v4l2 --disable-outdev=fbdev --disable-indev=v4l2 --disable-indev=fbdev --disable-openssl --disable-xmm-clobber-test --disable-debug --disable-neon-clobber-test --disable-programs --disable-postproc --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-sndio --disable-schannel --disable-securetransport --disable-xlib --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --disable-appkit --disable-alsa --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --enable-gmp --enable-gnutls --enable-libx264 --enable-gpl --enable-libxvid --enable-gpl --enable-libx265 --enable-gpl --enable-libvidstab --enable-gpl --disable-sdl2 --enable-zlib --enable-audiotoolbox --enable-coreimage --enable-bzlib --enable-videotoolbox --enable-avfoundation --enable-iconv
flutter: libavutil 56. 38.100 / 56. 38.100
flutter: libavcodec 58. 65.102 / 58. 65.102
flutter: libavformat 58. 35.101 / 58. 35.101
flutter: libavdevice 58. 9.103 / 58. 9.103
flutter: libavfilter 7. 70.101 / 7. 70.101
flutter: libswscale 5. 6.100 / 5. 6.100
flutter: libswresample 3. 6.100 / 3. 6.100
flutter: Input #0, mp3, from '/var/mobile/Containers/Data/Application/AEEF7BB8-36F3-4ECD-824B-B294E9DF7294/Library/Caches/melodic_slow.mp3':
flutter: Metadata:
flutter: encoder :
flutter: LAME 32bits version 3.99.5 (http://lame.sf.net)
flutter:
flutter: TLEN :
flutter: 134072
flutter:
flutter: Duration:
flutter: 00:02:14.11
flutter: , start:
flutter: 0.025057
flutter: , bitrate:
flutter: 320 kb/s
flutter:
flutter: Stream #0:0
flutter: : Audio: mp3, 44100 Hz, stereo, fltp, 320 kb/s
flutter:
flutter: Metadata:
flutter: encoder :
flutter: LAME3.99r
flutter:
flutter: Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '/var/mobile/Containers/Data/Application/AEEF7BB8-36F3-4ECD-824B-B294E9DF7294/Library/Caches/Memories_f578a1c0-f4d0-11ea-9e60-5b43394b2511.mp4':
flutter: Metadata:
flutter: major_brand :
flutter: isom
flutter:
flutter: minor_version :
flutter: 512
flutter:
flutter: compatible_brands:
flutter: isomiso2avc1mp41
flutter:
flutter: encoder :
flutter: Lavf58.35.101
flutter:
flutter: Duration:
flutter: 00:00:03.54
flutter: , start:
flutter: 0.000000
flutter: , bitrate:
flutter: 10023 kb/s
flutter:
flutter: Stream #1:0
flutter: (und)
flutter: : Video: h264 (avc1 / 0x31637661), yuvj422p(pc), 1920x1080 [SAR 1:1 DAR 16:9], 10020 kb/s
flutter: ,
flutter: 24 fps,
flutter: 24 tbr,
flutter: 12288 tbn,
flutter: 48 tbc
flutter: (default)
flutter:
flutter: Metadata:
flutter: handler_name :
flutter: VideoHandler
flutter:
flutter: Stream mapping:
flutter: Stream #1:0 -> #0:0
flutter: (h264 (native) -> h264 (libx264))
flutter:
flutter: Stream #0:0 -> #0:1
flutter: (mp3 (mp3float) -> aac (native))
flutter:
flutter: Press [q] to stop, [?] for help
flutter: frame= 0 fps=0.0 q=0.0 size= 0kB time=-577014:32:22.77 bitrate= -0.0kbits/s speed=N/A
flutter: sws_param option is deprecated and ignored
flutter: using SAR=1/1
flutter: using cpu capabilities: ARMv8 NEON
flutter: profile High 4:2:2, level 4.0, 4:2:2, 8-bit
flutter: 264 - core 159 - H.264/MPEG-4 AVC codec - Copyleft 2003-2019 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=9 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=24 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
flutter: Output #0, mp4, to '/var/mobile/Containers/Data/Application/AEEF7BB8-36F3-4ECD-824B-B294E9DF7294/Library/Caches/Memories_f81f09a0-f4d0-11ea-983d-0b683ab874e3.mp4':
flutter: Metadata:
flutter: TLEN :
flutter: 134072
flutter:
flutter: encoder :
flutter: Lavf58.35.101
flutter:
flutter: Stream #0:0
flutter: (und)
flutter: : Video: h264 (libx264) (avc1 / 0x31637661), yuvj422p(pc, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1
flutter: ,
flutter: 24 fps,
flutter: 12288 tbn,
flutter: 24 tbc
flutter: (default)
flutter:
flutter: Metadata:
flutter: handler_name :
flutter: VideoHandler
flutter:
flutter: encoder :
flutter: Lavc58.65.102 libx264
flutter:
flutter: Side data:
flutter:
flutter: cpb:
flutter: bitrate max/min/avg: 0/0/0 buffer size: 0
flutter: vbv_delay: N/A
flutter:
flutter: Stream #0:1
flutter: : Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s
flutter:
flutter: Metadata:
flutter: encoder :
flutter: Lavc58.65.102 aac
flutter:
flutter: frame= 47 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= 0x
flutter: frame= 61 fps= 57 q=28.0 size= 256kB time=00:00:00.23 bitrate=9033.3kbits/s speed=0.218x
flutter: frame= 74 fps= 46 q=28.0 size= 768kB time=00:00:00.78 bitrate=7969.6kbits/s speed=0.489x
flutter: frame= 85 fps= 22 q=-1.0 Lsize= 3440kB time=00:00:03.55 bitrate=7933.2kbits/s speed=0.902x
flutter: video:3380kB audio:56kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead:
flutter: 0.117084%
flutter:
flutter: frame I:1 Avg QP:22.68 size:174045
flutter: frame P:22 Avg QP:23.88 size: 84065
flutter: frame B:62 Avg QP:28.21 size: 23184
flutter: consecutive B-frames: 1.2% 4.7% 0.0% 94.1%
flutter: mb I I16..4: 2.0% 97.3% 0.7%
flutter: mb P I16..4: 0.4% 13.4% 0.9% P16..4: 39.3% 21.6% 14.6% 0.0% 0.0% skip: 9.7%
flutter: mb B I16..4: 0.1% 2.4% 0.2% B16..8: 26.7% 6.3% 2.0% direct: 2.5% skip:59.8% L0:41.1% L1:45.7% BI:13.1%
flutter: 8x8 transform intra:91.8% inter:83.1%
flutter: coded y,uvDC,uvAC intra: 88.3% 97.2% 41.4% inter: 21.0% 26.5% 1.7%
flutter: i16 v,h,dc,p: 18% 25% 5% 52%
flutter: i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 18% 19% 16% 5% 8% 8% 9% 7% 9%
flutter: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 18% 16% 13% 7% 12% 9% 10% 7% 8%
flutter: i8c dc,h,v,p: 41% 19% 28% 12%
flutter: Weighted P-Frames: Y:0.0% UV:0.0%
flutter: ref P L0: 53.4% 22.2% 18.9% 5.5%
flutter: ref B L0: 86.6% 10.3% 3.2%
flutter: ref B L1: 95.8% 4.2%
flutter: kb/s:7817.54
flutter: Qavg: 149.529
flutter: Speichern mit GallerySaver: /var/mobile/Containers/Data/Application/AEEF7BB8-36F3-4ECD-824B-B294E9DF7294/Library/Caches/Memories_f81f09a0-f4d0-11ea-983d-0b683ab874e3.mp4
flutter: Speichern mit GallerySaver nicht erfolgreich
In general the created video works, but: If i try to save it as video with flutter gallery_saver to the device, this video will not saved. Other videos for example works well. But not the created with ffmpeg.
Can you find any reason for this in the ffmpeg output log? Thank you!
Videos for web playback usually require chroma sampling to be 4:2:0. FFmpeg, by default, will try to preserve the source sampling scheme, so your output is 4:2:2 (see yuvj422p in the output stream).
Use for step 1,
-r $settings_fps -i $tempPath/img%04d.jpg -vcodec libx264 -y -an -vf "pad=ceil(iw/2)*2:ceil(ih/2)*2" -pix_fmt yuv420p $tempPath/$videoFileName.mp4
And in step 2, avoid re-encoding video
-i ${finalSong.path} -i $videoPath -c:v copy -c:a aac -shortest $tempPath/$newVideoFileName.mp4

GIMP get current image reference number to operate on current image

I have more than one image open, and I'd like to run scrip-fu functions on the currently selected image. How can I get the image reference number to the currently selected image so I can use the reference in other functions (e.g. (gimp-image-width 7))? I'm using GIMP 2.10.12.
Using (gimp-image-list) lists all the image references:
> (gimp-image-list)
(12 #(12 11 10 9 8 7 6 5 4 3 2 1))
I've been using (gimp-image-latest) for this, which should work for the general case
(define (gimp-image-list-items)
(cadr (gimp-image-list)))
(define (gimp-image-latest)
(aref (gimp-image-list-items) 0))
(define img (gimp-image-latest))
Then it's in img. E.g.:
> (gimp-image-get-layers img)
(283 #(770 769 768 767 766 765 764 763 762 761 760 759 758 757 756 755 754 753 752 751 750 749 748 747 746 745 744 743 742 741 740 739 738 737 736 735 734 733 732 731 730 729 728 727 726 725 724 723 722 721 720 719 718 717 716 715 714 713 712 711 710 709 708 707 706 705 704 703 702 701 700 699 698 697 696 695 694 693 692 691 690 689 688 687 686 685 684 683 682 681 680 679 678 677 676 675 674 673 672 671 670 669 668 667 666 665 664 663 662 661 660 659 658 657 656 655 654 653 652 651 650 649 648 647 646 645 644 643 642 641 640 639 638 637 636 635 634 633 632 631 630 629 628 627 626 625 624 623 622 621 620 619 618 617 616 615 614 613 612 611 610 609 608 607 606 605 604 603 602 601 600 599 598 597 596 595 594 593 592 591 590 589 588 587 586 585 584 583 582 581 580 579 578 577 576 575 574 573 572 571 570 569 568 567 566 565 564 563 562 561 560 559 558 557 556 555 554 553 552 551 550 549 548 547 546 545 544 543 542 541 540 539 538 537 536 535 534 533 532 531 530 529 528 527 526 525 524 523 522 521 520 519 518 517 516 515 514 513 512 511 510 509 508 507 506 505 504 503 502 501 500 499 498 497 496 495 494 493 492 491 490 489 488))

MATLAB Polygon Self Intersection - Delete Zero Volume Parts

I have a MATLAB polygon (below) which self intersects to make the zero volume part (which I will call a sliver) in the image (also below).
I am having a lot of trouble finding and removing the zero volume sliver.
Hope anyone can help. Thanks.
IMAGE:
enter image description here
Polygon:
newBoundary =
1 1
1 216
8 221
25 239
46 255
60 269
70 282
81 296
92 313
113 323
127 326
145 336
163 349
170 368
174 374
192 388
209 400
229 416
236 433
252 450
266 470
268 488
274 504
284 523
274 518
249 513
246 532
246 538
224 527
216 541
206 554
205 573
192 589
185 590
169 609
148 620
154 641
170 646
172 660
165 683
154 673
140 654
130 648
116 656
105 660
92 679
82 700
69 719
90 730
77 751
87 770
66 763
48 774
37 791
28 804
18 804
9 817
1 834
1 838
1 1049
131 1049
141 1044
164 1029
181 1014
193 1004
208 995
221 979
239 979
239 962
253 951
270 940
290 926
299 908
317 899
332 879
353 869
364 857
379 841
376 856
386 870
383 889
380 913
382 933
383 958
378 975
379 993
378 1016
374 1029
367 1040
366 1049
616 1049
615 1049
610 1037
615 1016
612 993
618 978
612 953
609 936
606 913
608 894
609 874
606 854
622 839
633 853
651 869
670 883
690 900
706 916
721 934
740 951
747 971
765 978
785 992
795 1007
816 1015
831 1028
848 1049
1049 1049
1049 781
1027 784
1003 780
997 798
974 812
973 796
964 780
947 765
930 773
922 760
926 736
917 722
898 713
879 719
883 704
886 679
873 663
853 670
847 649
841 627
839 607
835 621
814 631
794 620
778 604
761 588
744 601
729 592
716 577
705 556
698 537
689 517
698 502
711 486
726 486
730 463
743 446
760 439
764 420
784 404
802 388
816 373
837 366
846 344
866 337
881 324
901 314
912 299
926 283
946 272
951 253
970 242
977 225
998 223
1006 207
1025 192
1049 186
1049 1
789 1
792 6
778 20
774 37
762 49
753 70
736 79
715 90
695 100
672 91
668 109
663 131
668 153
651 156
657 168
648 170
633 153
612 150
613 127
610 114
613 97
615 74
613 54
612 36
613 21
620 1
380 1
379 9
377 34
371 56
379 78
387 98
379 117
376 136
384 151
372 156
350 164
332 174
318 168
327 150
309 139
299 129
281 127
290 108
275 107
261 90
236 76
235 60
219 52
206 35
187 22
168 4
156 1
1 1
Zero volume slivers may occur when there are three or more consecutive points aligned. In this particular case those were:
366 1049
616 1049
615 1049
since they fall on the same horizontal line.
If you want to automate this, you should check every group of three consecutive points to see if they fall on the same line. If they do, you need to discard the one in the middle, according to appearance order.
In this particular case, the one in the middle is:
616 1049

Perl errors while trying to replace words in a large file

I have a huge 1.1 GB File. It contains only 1 line and 1167889705 characters. I want to replace all the occurences of "LFENT" by "\nLFENT".
I am using
perl 5, version 18, subversion 1 (v5.18.1) built for x86_64-linux –
Perl Script
perl -ne 's/LFENT/\nLFENT/g; print;' queries.txt
Sample
22 serialization::archive 10 0 0 0 0 134477 0 0 0 9 LFENT_1_1 6 LFDOC1 20 documents/LFDOC1.xml 6 PERSON 12 barack obama 0 0 1 0 12 barack obama 0 0 6 LFDOC1 0 76 127 0.11599133 151 0.11042373 331 0.057491675 389 0.05621225 396 0.065223008 398 0.12416559 421 0.10331947 502 0.055213902 641 0.08908961 642 0.084330745 690 0.11456303 699 0.16876614 720 0.080576144 791 0.077269703 792 0.077503696 849 0.08224529 854 0.074629158 1028 0.11078026 1039 0.091981322 1300 0.070129424 1359 0.06072164 1390 0.05564769 1424 0.076605573 1461 0.15357952 1467 0.083702087 1583 0.069745384 1960 0.088143557 2118 0.064093992 2192 0.054430917 2304 0.089718938 2417 0.10173298 2436 0.069064997 2683 0.12296619 2700 0.068218805 2715 0.14005794 2786 0.084942013 3016 0.08474879 3113 0.083180025 3183 0.07413847 3202 0.081254445 3351 0.21241546 3587 0.061469007 3711 0.068944298 3949 0.10349752 5284 0.087500088 5775 0.092185706 5816 0.20625457 6320 0.11784423 6435 0.076852165 6794 0.094336778 6805 0.063363358 6946 0.11133534 7277 0.074097082 7588 0.12458359 7590 0.099151991 7629 0.28773388 7790 0.1194713 8137 0.11009126 8214 0.10754209 8889 0.12056628 9326 0.13841057 9701 0.25610805 9863 0.11877144 9908 0.11499001 10500 0.12205271 11917 0.11144774 12750 0.11285295 13453 0.13751692 19236 0.12948024 20390 0.12416928 20795 0.11188922 23777 0.13165452 23887 0.10065161 27644 0.1620737 73361 0.16295943 75521 0.17926371 9 LFENT_1_2 6 LFDOC1 20 documents/LFDOC1.xml 6 PERSON 5 obama 2 0 12 barack obama 5 obama 6 LFDOC1 0 76 127 0.11599133 151 0.11042373 331 0.057491675 389 0.05621225 396 0.065223008 398 0.12416559 421 0.10331947 502 0.055213902 641 0.08908961 642 0.084330745 690 0.11456303 699 0.16876614 720 0.080576144 791 0.077269703 792 0.077503696 849 0.08224529 854 0.074629158 1028 0.11078026 1039 0.091981322 1300 0.070129424 1359 0.06072164 1390 0.05564769 1424 0.076605573 1461 0.15357952 1467 0.083702087 1583 0.069745384 1960 0.088143557 2118 0.064093992 2192 0.054430917 2304 0.089718938 2417 0.10173298 2436 0.069064997 2683 0.12296619 2700 0.068218805 2715 0.14005794 2786 0.084942013 3016 0.08474879 3113 0.083180025 3183 0.07413847 3202 0.081254445 3351 0.21241546 3587 0.061469007 3711 0.068944298 3949 0.10349752 5284 0.087500088 5775 0.092185706 5816 0.20625457 6320 0.11784423 6435 0.076852165 6794 0.094336778 6805 0.063363358 6946 0.11133534 7277 0.074097082 7588 0.12458359 7590 0.099151991 7629 0.28773388 7790 0.1194713 8137 0.11009126 8214 0.10754209 8889 0.12056628 9326 0.13841057 9701 0.25610805 9863 0.11877144 9908 0.11499001 10500 0.12205271 11917 0.11144774 12750 0.11285295 13453 0.13751692 19236 0.12948024 20390 0.12416928 20795 0.11188922 23777 0.13165452 23887 0.10065161 27644 0.1620737 73361 0.16295943 75521 0.17926371 9 LFENT_1_3 6 LFDOC1 20 documents/LFDOC1.xml 4 MISC 8 american 1 0 8 american 6 LFDOC1 0 76 127 0.11599133 151 0.11042373 331 0.057491675 389 0.05621225 396 0.065223008 398 0.12416559 421 0.10331947 502 0.055213902 641 0.08908961 642 0.084330745 690 0.11456303 699 0.16876614 720 0.080576144 791 0.077269703 792 0.077503696 849 0.08224529 854 0.074629158 1028 0.11078026 1039 0.091981322 1300 0.070129424 1359 0.06072164 1390 0.05564769 1424 0.076605573 1461 0.15357952 1467 0.083702087 1583 0.069745384 1960 0.088143557 2118 0.064093992 2192 0.054430917 2304 0.089718938 2417 0.10173298 2436 0.069064997 2683 0.12296619 2700 0.068218805 2715 0.14005794 2786 0.084942013 3016 0.08474879 3113 0.083180025 3183 0.07413847 3202 0.081254445 3351 0.21241546 3587 0.061469007 3711 0.068944298 3949 0.10349752 5284 0.087500088 5775 0.092185706 5816 0.20625457 6320 0.11784423 6435 0.076852165 6794 0.094336778 6805 0.063363358 6946 0.11133534 7277 0.074097082 7588 0.12458359 7590 0.099151991 7629 0.28773388 7790 0.1194713 8137 0.11009126 8214 0.10754209 8889 0.12056628 9326 0.13841057 9701 0.25610805 9863 0.11877144 9908 0.11499001 10500 0.12205271 11917 0.11144774 12750 0.11285295 13453 0.13751692 19236
Problem
The script will work on the sample that I posted. But when I try it on the whole line I get the following error:
Substitution loop at -e line 1, <> line 1.
It is simplest to use LFENT as the record separator. That reduces the blocks to a more manageable size and ensures that there is no more than one LFENT to be replaced in each block
Command-line perl allows for setting the record separator with the -0 modifier, but the value of the parameter must be the code point in octal of a single character, and you can't specify a string. So here you have to set it once in a BEGIN block
Like this
perl -p -e'BEGIN{$/="LFENT"} s/LFENT/\nLFENT/'
output
22 serialization::archive 10 0 0 0 0 134477 0 0 0 9
LFENT_1_1 6 LFDOC1 20 documents/LFDOC1.xml 6 PERSON 12 barack obama 0 0 1 0 12 barack obama 0 0 6 LFDOC1 0 76 127 0.11599133 151 0.11042373 331 0.057491675 389 0.05621225 396 0.065223008 398 0.12416559 421 0.10331947 502 0.055213902 641 0.08908961 642 0.084330745 690 0.11456303 699 0.16876614 720 0.080576144 791 0.077269703 792 0.077503696 849 0.08224529 854 0.074629158 1028 0.11078026 1039 0.091981322 1300 0.070129424 1359 0.06072164 1390 0.05564769 1424 0.076605573 1461 0.15357952 1467 0.083702087 1583 0.069745384 1960 0.088143557 2118 0.064093992 2192 0.054430917 2304 0.089718938 2417 0.10173298 2436 0.069064997 2683 0.12296619 2700 0.068218805 2715 0.14005794 2786 0.084942013 3016 0.08474879 3113 0.083180025 3183 0.07413847 3202 0.081254445 3351 0.21241546 3587 0.061469007 3711 0.068944298 3949 0.10349752 5284 0.087500088 5775 0.092185706 5816 0.20625457 6320 0.11784423 6435 0.076852165 6794 0.094336778 6805 0.063363358 6946 0.11133534 7277 0.074097082 7588 0.12458359 7590 0.099151991 7629 0.28773388 7790 0.1194713 8137 0.11009126 8214 0.10754209 8889 0.12056628 9326 0.13841057 9701 0.25610805 9863 0.11877144 9908 0.11499001 10500 0.12205271 11917 0.11144774 12750 0.11285295 13453 0.13751692 19236 0.12948024 20390 0.12416928 20795 0.11188922 23777 0.13165452 23887 0.10065161 27644 0.1620737 73361 0.16295943 75521 0.17926371 9
LFENT_1_2 6 LFDOC1 20 documents/LFDOC1.xml 6 PERSON 5 obama 2 0 12 barack obama 5 obama 6 LFDOC1 0 76 127 0.11599133 151 0.11042373 331 0.057491675 389 0.05621225 396 0.065223008 398 0.12416559 421 0.10331947 502 0.055213902 641 0.08908961 642 0.084330745 690 0.11456303 699 0.16876614 720 0.080576144 791 0.077269703 792 0.077503696 849 0.08224529 854 0.074629158 1028 0.11078026 1039 0.091981322 1300 0.070129424 1359 0.06072164 1390 0.05564769 1424 0.076605573 1461 0.15357952 1467 0.083702087 1583 0.069745384 1960 0.088143557 2118 0.064093992 2192 0.054430917 2304 0.089718938 2417 0.10173298 2436 0.069064997 2683 0.12296619 2700 0.068218805 2715 0.14005794 2786 0.084942013 3016 0.08474879 3113 0.083180025 3183 0.07413847 3202 0.081254445 3351 0.21241546 3587 0.061469007 3711 0.068944298 3949 0.10349752 5284 0.087500088 5775 0.092185706 5816 0.20625457 6320 0.11784423 6435 0.076852165 6794 0.094336778 6805 0.063363358 6946 0.11133534 7277 0.074097082 7588 0.12458359 7590 0.099151991 7629 0.28773388 7790 0.1194713 8137 0.11009126 8214 0.10754209 8889 0.12056628 9326 0.13841057 9701 0.25610805 9863 0.11877144 9908 0.11499001 10500 0.12205271 11917 0.11144774 12750 0.11285295 13453 0.13751692 19236 0.12948024 20390 0.12416928 20795 0.11188922 23777 0.13165452 23887 0.10065161 27644 0.1620737 73361 0.16295943 75521 0.17926371 9
LFENT_1_3 6 LFDOC1 20 documents/LFDOC1.xml 4 MISC 8 american 1 0 8 american 6 LFDOC1 0 76 127 0.11599133 151 0.11042373 331 0.057491675 389 0.05621225 396 0.065223008 398 0.12416559 421 0.10331947 502 0.055213902 641 0.08908961 642 0.084330745 690 0.11456303 699 0.16876614 720 0.080576144 791 0.077269703 792 0.077503696 849 0.08224529 854 0.074629158 1028 0.11078026 1039 0.091981322 1300 0.070129424 1359 0.06072164 1390 0.05564769 1424 0.076605573 1461 0.15357952 1467 0.083702087 1583 0.069745384 1960 0.088143557 2118 0.064093992 2192 0.054430917 2304 0.089718938 2417 0.10173298 2436 0.069064997 2683 0.12296619 2700 0.068218805 2715 0.14005794 2786 0.084942013 3016 0.08474879 3113 0.083180025 3183 0.07413847 3202 0.081254445 3351 0.21241546 3587 0.061469007 3711 0.068944298 3949 0.10349752 5284 0.087500088 5775 0.092185706 5816 0.20625457 6320 0.11784423 6435 0.076852165 6794 0.094336778 6805 0.063363358 6946 0.11133534 7277 0.074097082 7588 0.12458359 7590 0.099151991 7629 0.28773388 7790 0.1194713 8137 0.11009126 8214 0.10754209 8889 0.12056628 9326 0.13841057 9701 0.25610805 9863 0.11877144 9908 0.11499001 10500 0.12205271 11917 0.11144774 12750 0.11285295 13453 0.13751692 19236[Finished in 0.2s]
By the way, it is unlikely to cause a problem but LFENT is always preceded by a space character in your example data. You may want to remove it by using s/\s*LFENT/\nLFENT for your substitution
And a look-ahead might be more appropriate too s/\s*(?=LFENT)/\n/ so that you don't have to remove and replace the unchanged part of the match
Try updating your perl to a more current version.
This was a known bug for a long time (fixed in v5.22.0): perl #123071: substitution loop issue with long strings
You can do so with the following commands (assuming you are on linux):
wget http://www.cpan.org/src/5.0/perl-5.22.1.tar.gz
tar -xzf perl-5.22.1.tar.gz
cd perl-5.22.1
./Configure -des -Dprefix=$HOME/localperl
make
make test
make install
Then test it by running $HOME/localperl/bin/perl -v and add it to your PATH using this: export PATH=$HOME/localperl/bin/:$PATH.

Exception when trying to refresh Clojure code in cider

I am using clojure in Emacs with cider and the cider repl (0.7.0). This is pretty fine, but whenever I run cider-referesh (or hit C-c C-x), I get an exception:
ClassNotFoundException clojure.tools.namespace.repl java.net.URLClassLoader$1.run (URLClassLoader.java:372)
1. Unhandled java.lang.ClassNotFoundException
clojure.tools.namespace.repl
URLClassLoader.java: 372 java.net.URLClassLoader$1/run
URLClassLoader.java: 361 java.net.URLClassLoader$1/run
AccessController.java: -2 java.security.AccessController/doPrivileged
URLClassLoader.java: 360 java.net.URLClassLoader/findClass
DynamicClassLoader.java: 61 clojure.lang.DynamicClassLoader/findClass
ClassLoader.java: 424 java.lang.ClassLoader/loadClass
ClassLoader.java: 357 java.lang.ClassLoader/loadClass
Class.java: -2 java.lang.Class/forName0
Class.java: 340 java.lang.Class/forName
RT.java: 2065 clojure.lang.RT/classForName
Compiler.java: 978 clojure.lang.Compiler$HostExpr/maybeClass
Compiler.java: 756 clojure.lang.Compiler$HostExpr/access$400
Compiler.java: 6583 clojure.lang.Compiler/macroexpand1
Compiler.java: 6613 clojure.lang.Compiler/macroexpand
Compiler.java: 6687 clojure.lang.Compiler/eval
Compiler.java: 6666 clojure.lang.Compiler/eval
core.clj: 2927 clojure.core/eval
main.clj: 239 clojure.main/repl/read-eval-print/fn
main.clj: 239 clojure.main/repl/read-eval-print
main.clj: 257 clojure.main/repl/fn
main.clj: 257 clojure.main/repl
RestFn.java: 1096 clojure.lang.RestFn/invoke
interruptible_eval.clj: 56 clojure.tools.nrepl.middleware.interruptible-eval/evaluate/fn
AFn.java: 152 clojure.lang.AFn/applyToHelper
AFn.java: 144 clojure.lang.AFn/applyTo
core.clj: 624 clojure.core/apply
core.clj: 1862 clojure.core/with-bindings*
RestFn.java: 425 clojure.lang.RestFn/invoke
interruptible_eval.clj: 41 clojure.tools.nrepl.middleware.interruptible-eval/evaluate
interruptible_eval.clj: 171 clojure.tools.nrepl.middleware.interruptible-eval/interruptible-eval/fn/fn
core.clj: 2402 clojure.core/comp/fn
interruptible_eval.clj: 138 clojure.tools.nrepl.middleware.interruptible-eval/run-next/fn
AFn.java: 22 clojure.lang.AFn/run
ThreadPoolExecutor.java: 1142 java.util.concurrent.ThreadPoolExecutor/runWorker
ThreadPoolExecutor.java: 617 java.util.concurrent.ThreadPoolExecutor$Worker/run
Thread.java: 745 java.lang.Thread/run
What is the reason for this, and how can I fix it?
It seems that this exception was a bug, that has now been fixed in cider.
Try adding [org.clojure/tools.namespace "0.2.5"] to your project.clj