termux / termux-packages

A package build system for Termux.
https://termux.dev
Other
12.98k stars 2.98k forks source link

[Bug]: `ffmpeg -i "~/storage/X.mp4` gives `Error opening input files. No such file or directory.` for all `X`. Must `mv storage/X.mp4 ~/` (which is slow). #21055

Closed SwuduSusuwu closed 1 month ago

SwuduSusuwu commented 1 month ago

Problem description

termux-setup-storage was success, but must use mv ~/storage/X.mp4 ~/ (which is slow for long visual records, because Android's filesystem does this as cp ~/storage/X.mp4 ~/ && rm ~/storage/X.mp4 as opposed to an actual move)

What steps will reproduce the bug?

 $ ffmpeg -i "~/storage/movies/Afghanistan scratch and sniff (Swudu Susuwu frog walk at dawn, Sakura School Sim
ulator).mp4" -framerate 30 -c:v libx264 -crf 32 -t 9:42 "~/storage/emulated/downloads/Afghanistan scratch and sn
iff (Swudu Susuwu frog walk at dawn, Sakura School Simulator).mp4"
ffmpeg version 6.1.1 Copyright (c) 2000-2023 the FFmpeg developers
  built with Android (11349228, +pgo, +bolt, +lto, -mlgo, based on r487747e) clang version 17.0.2 (https://andro
id.googlesource.com/toolchain/llvm-project d9f89f4d16663d5012e5c09495f3b30ece3d2362)
  configuration: --arch=aarch64 --as=aarch64-linux-android-clang --cc=aarch64-linux-android-clang --cxx=aarch64-
linux-android-clang++ --nm=llvm-nm --pkg-config=/home/builder/.termux-build/_cache/android-r26d-api-28-v5/bin/pk
g-config --strip=llvm-strip --cross-prefix=aarch64-linux-android- --disable-indevs --disable-outdevs --enable-in
dev=lavfi --disable-static --disable-symver --enable-cross-compile --enable-gnutls --enable-gpl --enable-version
3 --enable-jni --enable-lcms2 --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libf
ontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libharfbuzz --enable-libmp3lame --en
able-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenmpt --enable-libopus --enable-librav1e --enabl
e-libsoxr --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvid
stab --enable-libvmaf --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx2
64 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-mediacodec --enable-opencl --ena
ble-shared --prefix=/data/data/com.termux/files/usr --target-os=android --disable-vulkan --enable-neon --disable
-libfdk-aac
  libavutil      58. 29.100 / 58. 29.100
  libavcodec     60. 31.102 / 60. 31.102
  libavformat    60. 16.100 / 60. 16.100
  libavdevice    60.  3.100 / 60.  3.100
  libavfilter     9. 12.100 /  9. 12.100
  libswscale      7.  5.100 /  7.  5.100
  libswresample   4. 12.100 /  4. 12.100
  libpostproc    57.  3.100 / 57.  3.100
[in#0 @ 0xb40000762191e210] Error opening input: No such file or directory
Error opening input file ~/storage/movies/Afghanistan scratch and sniff (Swudu Susuwu frog walk at dawn, Sakura
School Simulator).mp4.
Error opening input files: No such file or directory
~ $ stat ~/storage/movies/Afghanistan\ scratch\ and\ sniff\ \(Swudu\ Susuwu\ frog\ walk\ at\ dawn,\ Sakura\ Scho
ol\ Simulator\).mp4
  File: /data/data/com.termux/files/home/storage/movies/Afghanistan scratch and sniff (Swudu Susuwu frog walk at
dawn, Sakura School Simulator).mp4
  Size: 2277087256      Blocks: 4451816    IO Block: 4096   regular file
Device: 0,189   Inode: 482635      Links: 1
Access: (0770/-rwxrwx---)  Uid: (10224/ u0_a224)   Gid: ( 1023/media_rw)
Access: 2024-08-05 08:22:56.296006602 -0700
Modify: 2024-08-05 08:23:23.740006616 -0700
Change: 2024-08-05 08:30:37.032006827 -0700
Birth: -
~ $ mv ~/storage/movies/Afghanistan\ scratch\ and\ sniff\ \(Swudu\ Susuwu\ frog\ walk\ at\ dawn,\ Sakura\ School
\ Simulator\).mp4 ~/
~ $ ffmpeg -i "Afghanistan scratch and sniff (Swudu Susuwu frog walk at dawn, Sakura School Simulator).mp4" -fra
merate 30 -c:v libx264 -crf 32 -t 9:42 "smallAfghanistan scratch and sniff (Swudu Susuwu frog walk at dawn, Saku
ra School Simulator).mp4"
ffmpeg version 6.1.1 Copyright (c) 2000-2023 the FFmpeg developers
  built with Android (11349228, +pgo, +bolt, +lto, -mlgo, based on r487747e) clang version 17.0.2 (https://andro
id.googlesource.com/toolchain/llvm-project d9f89f4d16663d5012e5c09495f3b30ece3d2362)
  configuration: --arch=aarch64 --as=aarch64-linux-android-clang --cc=aarch64-linux-android-clang --cxx=aarch64-
linux-android-clang++ --nm=llvm-nm --pkg-config=/home/builder/.termux-build/_cache/android-r26d-api-28-v5/bin/pk
g-config --strip=llvm-strip --cross-prefix=aarch64-linux-android- --disable-indevs --disable-outdevs --enable-in
dev=lavfi --disable-static --disable-symver --enable-cross-compile --enable-gnutls --enable-gpl --enable-version
3 --enable-jni --enable-lcms2 --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libf
ontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libharfbuzz --enable-libmp3lame --en
able-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenmpt --enable-libopus --enable-librav1e --enabl
e-libsoxr --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvid
stab --enable-libvmaf --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx2
64 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-mediacodec --enable-opencl --ena
ble-shared --prefix=/data/data/com.termux/files/usr --target-os=android --disable-vulkan --enable-neon --disable
-libfdk-aac
  libavutil      58. 29.100 / 58. 29.100
  libavcodec     60. 31.102 / 60. 31.102
  libavformat    60. 16.100 / 60. 16.100
  libavdevice    60.  3.100 / 60.  3.100
  libavfilter     9. 12.100 /  9. 12.100
  libswscale      7.  5.100 /  7.  5.100
  libswresample   4. 12.100 /  4. 12.100
  libpostproc    57.  3.100 / 57.  3.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0xb400007a457ce6d0] Skipping unhandled metadata com.android.video.temporal_layers_cou
nt of type 67
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Afghanistan scratch and sniff (Swudu Susuwu frog walk at dawn, Sakura S
chool Simulator).mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2024-08-05T15:22:55.000000Z
    com.android.version: 14
  Duration: 00:09:42.85, start: 0.000000, bitrate: 31254 kb/s
  Stream #0:0[0x1](eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 2400x1080, 312
48 kb/s, 30.06 fps, 29.97 tbr, 90k tbn (default)
    Metadata:
      creation_time   : 2024-08-05T15:22:55.000000Z
      handler_name    : VideoHandle
      vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 0xb400007a657c7f80] using cpu capabilities: ARMv8 NEON
[libx264 @ 0xb400007a657c7f80] profile High, level 5.0, 4:2:0, 8-bit
[libx264 @ 0xb400007a657c7f80] 264 - core 164 - H.264/MPEG-4 AVC codec - Copyleft 2003-2022 - http://www.videola
n.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 m
ixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 thre
ads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bfr
ames=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=
40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=32.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 a
q=1:1.00
Output #0, mp4, to 'smallAfghanistan scratch and sniff (Swudu Susuwu frog walk at dawn, Sakura School Simulator)
.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    com.android.version: 14
    encoder         : Lavf60.16.100
  Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 2400x1080, q=2-31, 29.97 f
ps, 30k tbn (default)
    Metadata:
      creation_time   : 2024-08-05T15:22:55.000000Z
      handler_name    : VideoHandle
      vendor_id       : [0][0][0][0]
      encoder         : Lavc60.31.102 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
frame=17299 fps= 10 q=38.0 size=  153344kB time=00:09:37.10 bitrate=2176.7kbits/s dup=12 drop=12 speed=0.343x  
frame=17303 fps= 10 q=38.0 size=  153344kB time=00:09:37.27 bitrate=2176.1kbits/s dup=12 drop=15 speed=0.343x  
frame=17308 fps= 10 q=38.0 size=  153344kB time=00:09:37.41 bitrate=2175.6kbits/s dup=12 drop=18 speed=0.343x  
frame=17313 fps= 10 q=38.0 size=  153600kB time=00:09:37.57 bitrate=2178.6kbits/s dup=12 drop=23 speed=0.343x  
frame=17318 fps= 10 q=38.0 size=  153600kB time=00:09:37.77 bitrate=2177.8kbits/s dup=12 drop=26 speed=0.343x  
frame=17324 fps= 10 q=38.0 size=  153600kB time=00:09:37.97 bitrate=2177.1kbits/s dup=12 drop=28 speed=0.343x  
frame=17331 fps= 10 q=38.0 size=  153600kB time=00:09:38.17 bitrate=2176.3kbits/s dup=12 drop=31 speed=0.343x  
frame=17335 fps= 10 q=38.0 size=  153600kB time=00:09:38.34 bitrate=2175.7kbits/s dup=12 drop=33 speed=0.343x  
frame=17341 fps= 10 q=38.0 size=  153600kB time=00:09:38.51 bitrate=2175.1kbits/s dup=12 drop=36 speed=0.343x  
frame=17347 fps= 10 q=38.0 size=  153856kB time=00:09:38.71 bitrate=2177.9kbits/s dup=12 drop=38 speed=0.343x  
frame=17353 fps= 10 q=38.0 size=  153856kB time=00:09:38.91 bitrate=2177.2kbits/s dup=12 drop=41 speed=0.343x  
frame=17358 fps= 10 q=38.0 size=  153856kB time=00:09:39.07 bitrate=2176.5kbits/s dup=12 drop=45 speed=0.343x  
frame=17363 fps= 10 q=38.0 size=  153856kB time=00:09:39.27 bitrate=2175.8kbits/s dup=12 drop=48 speed=0.343x  
frame=17370 fps= 10 q=38.0 size=  153856kB time=00:09:39.47 bitrate=2175.0kbits/s dup=12 drop=51 speed=0.343x  
frame=17375 fps= 10 q=38.0 size=  154112kB time=00:09:39.64 bitrate=2178.0kbits/s dup=12 drop=53 speed=0.343x  
frame=17380 fps= 10 q=38.0 size=  154112kB time=00:09:39.81 bitrate=2177.4kbits/s dup=12 drop=54 speed=0.343x  
frame=17386 fps= 10 q=38.0 size=  154112kB time=00:09:40.01 bitrate=2176.7kbits/s dup=12 drop=56 speed=0.343x  
[out#0/mp4 @ 0xb400007ae57d44d0] video:154698kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxi
ng overhead: 0.113659%
frame=17443 fps= 10 q=-1.0 Lsize=  154874kB time=00:09:41.91 bitrate=2180.3kbits/s dup=12 drop=56 speed=0.344x
[libx264 @ 0xb400007a657c7f80] frame I:70    Avg QP:26.84  size: 80722
[libx264 @ 0xb400007a657c7f80] frame P:9538  Avg QP:35.51  size: 10529
[libx264 @ 0xb400007a657c7f80] frame B:7835  Avg QP:39.14  size:  6679
[libx264 @ 0xb400007a657c7f80] consecutive B-frames: 29.0% 26.3% 21.1% 23.6%
[libx264 @ 0xb400007a657c7f80] mb I  I16..4: 22.2% 62.6% 15.2%
[libx264 @ 0xb400007a657c7f80] mb P  I16..4:  3.6%  8.4%  1.1%  P16..4: 11.7%  1.5%  0.5%  0.0%  0.0%    skip:73
.2%
[libx264 @ 0xb400007a657c7f80] mb B  I16..4:  1.2%  2.5%  0.3%  B16..8: 13.1%  1.8%  0.2%  direct: 0.5%  skip:80
.3%  L0:50.1% L1:48.8% BI: 1.1%
[libx264 @ 0xb400007a657c7f80] 8x8 transform intra:63.7% inter:80.6%
[libx264 @ 0xb400007a657c7f80] coded y,uvDC,uvAC intra: 20.2% 47.0% 25.6% inter: 1.7% 2.5% 0.3%
[libx264 @ 0xb400007a657c7f80] i16 v,h,dc,p: 31% 33% 12% 24%
[libx264 @ 0xb400007a657c7f80] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 23% 15% 36%  4%  4%  5%  4%  4%  4%
[libx264 @ 0xb400007a657c7f80] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 21% 32%  4%  5%  5%  5%  4%  3%
[libx264 @ 0xb400007a657c7f80] i8c dc,h,v,p: 62% 18% 17%  4%
[libx264 @ 0xb400007a657c7f80] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0xb400007a657c7f80] ref P L0: 56.4%  9.6% 17.6% 16.5%
[libx264 @ 0xb400007a657c7f80] ref B L0: 83.2% 14.2%  2.7%
[libx264 @ 0xb400007a657c7f80] ref B L1: 97.1%  2.9%
[libx264 @ 0xb400007a657c7f80] kb/s:2177.41
~ $

What is the expected behavior?

Termux should allow commands (other than mv or stat) to use ~/storage/ input sources.

System information

~ $ termux-info
Termux Variables:
TERMUX_EXEC__PROC_SELF_EXE=/data/data/com.termux/files/usr/bin/termux-info
TERMUX_VERSION=googleplay.2024.07.07
TERMUX__USER_ID=0
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://termux.net stable main
Updatable packages:
All packages up to date
termux-tools version:
3.0.7
Android version:
14
Kernel build information:
Linux localhost 5.10.198-android13-4-00047-g7a2aa337ab82-ab11664978 #1 SMP PREEMPT Wed Apr 3 07:17:30 UTC 2024 a
arch64 Android
Device manufacturer:
Google
LD Variables:
LD_LIBRARY_PATH=
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
~ $
SwuduSusuwu commented 1 month ago

Importance: Termux's ffmpeg is the last Android app which allows to demux/mux; Knew of Google Store apps which allowed to demux/mux ( https://github.com/SwuduSusuwu/SubStack/blob/trunk/posts/TranscodeMuxHowto.md is a class about how to use those ), but the last update broke those; now those do not have value ( FFmpeg Media Encoder Unknown encoder libx264 FFmpeg Media Encoder Unrecognized option crf Video Transcoder useless ) Must abandon Android soon (can't afford a house, but as soon as can afford a house+desktop, can flash Sailfish OS or Ubuntu Touch) to fix this

sylirre commented 1 month ago

Quoted path component ~ won't expand. This is why you have error Error opening input: No such file or directory.

Either specify absolute path or use environment variable ${HOME} instead.

This issue is not a bug but rather shell scripting issue at user side.