Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ffmpeg not starting after video download #479

Open
mcorvo opened this issue Mar 15, 2023 · 6 comments
Open

ffmpeg not starting after video download #479

mcorvo opened this issue Mar 15, 2023 · 6 comments

Comments

@mcorvo
Copy link

mcorvo commented Mar 15, 2023

Dear Daniel,

I'm working with AVideo-Encoder inside a container managed by Podman and I'm facing a strange issue (I cloned the last master of the git repo): when I try to upload a video from my laptop or from youtube, it is correctly downloaded, but ffmpeg doesn't start. From the log I see that the program should be correctly called, but it is not and the Encoder uploads only the preview of the video and not the encoded files. Furthermore if I run the command I find in the log directly from the command line inside the container, ffmpeg works correctly, so it seems not a problem with ffmpeg itself

This is the relevant part of the log:

[15-Mar-2023 10:56:02 UTC] Encoder:Format:: getDynamicCommandFromFormat(/var/www/html/videos/6_tmpFile.mp4, 31) [resolutions=[240,360,480,540,720,1080,1440,2160]] [height=720]
[15-Mar-2023 10:56:02 UTC] Encoder:Format:: getDynamicCommandFromFormat resolution 1080 was ignored, your upload file is 720 we wil not up transcode your video
[15-Mar-2023 10:56:02 UTC] Encoder:Format:: getDynamicCommandFromFormat::return(ffmpeg -i "{$pathFileName}" -vf scale=-2:240 -movflags +faststart -preset veryfast -vcodec h264 -acodec aac -b:a 128k -max_muxing_queue_size 1024 -y /var/www/html/videos/avideoTmpFile_6_streamers_id_1_240.mp4 -vf scale=-2:360 -movflags +faststart -preset veryfast -vcodec h264 -acodec aac -b:a 128k -max_muxing_queue_size 1024 -y /var/www/html/videos/avideoTmpFile_6_streamers_id_1_360.mp4 -vf scale=-2:480 -movflags +faststart -preset veryfast -vcodec h264 -acodec aac -b:a 128k -max_muxing_queue_size 1024 -y /var/www/html/videos/avideoTmpFile_6_streamers_id_1_480.mp4 -vf scale=-2:540 -movflags +faststart -preset veryfast -vcodec h264 -acodec aac -b:a 192k -max_muxing_queue_size 1024 -y /var/www/html/videos/avideoTmpFile_6_streamers_id_1_540.mp4 -vf scale=-2:720 -movflags +faststart -preset veryfast -vcodec h264 -acodec aac -b:a 192k -max_muxing_queue_size 1024 -y /var/www/html/videos/avideoTmpFile_6_streamers_id_1_720.mp4)
[15-Mar-2023 10:56:02 UTC] AVideo-Encoder Format::exec Start Encoder [ffmpeg -i "/var/www/html/videos/6_tmpFile.mp4" -vf scale=-2:240 -movflags +faststart -preset veryfast -vcodec h264 -acodec aac -b:a 128k -max_muxing_queue_size 1024 -y /var/www/html/videos/avideoTmpFile_6_streamers_id_1_240.mp4 -vf scale=-2:360 -movflags +faststart -preset veryfast -vcodec h264 -acodec aac -b:a 128k -max_muxing_queue_size 1024 -y /var/www/html/videos/avideoTmpFile_6_streamers_id_1_360.mp4 -vf scale=-2:480 -movflags +faststart -preset veryfast -vcodec h264 -acodec aac -b:a 128k -max_muxing_queue_size 1024 -y /var/www/html/videos/avideoTmpFile_6_streamers_id_1_480.mp4 -vf scale=-2:540 -movflags +faststart -preset veryfast -vcodec h264 -acodec aac -b:a 192k -max_muxing_queue_size 1024 -y /var/www/html/videos/avideoTmpFile_6_streamers_id_1_540.mp4 -vf scale=-2:720 -movflags +faststart -preset veryfast -vcodec h264 -acodec aac -b:a 192k -max_muxing_queue_size 1024 -y /var/www/html/videos/avideoTmpFile_6_streamers_id_1_720.mp4]
[15-Mar-2023 10:56:03 UTC] progressFileHasVideosWithErrors: we could not detect files on the progress log, we will ignore errors
ffmpeg version 4.3.5-0+deb11u1 Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 10 (Debian 10.2.1-6)
configuration: --prefix=/usr --extra-version=0+deb11u1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
Option user_agent not found.

[15-Mar-2023 10:56:03 UTC] getReturn_vars {"videos_id":712,"video_id_hash":"cHlEZEhBN3dUTng5c1h3bU9TMmwrdlRaR2Vud0NTWms0VUtZV1NiNzc5VT0=","releaseDate":"2023-03-15 10:33"}
[15-Mar-2023 10:56:03 UTC] Encoder::send() order_id=7
[15-Mar-2023 10:56:03 UTC] Encoder::run: Autodelete Not active
[15-Mar-2023 10:56:03 UTC] getReturn_vars {"videos_id":712,"video_id_hash":"cHlEZEhBN3dUTng5c1h3bU9TMmwrdlRaR2Vud0NTWms0VUtZV1NiNzc5VT0=","releaseDate":"2023-03-15 10:33"}
[15-Mar-2023 10:56:03 UTC] AVideo-Encoder sending confirmation to objects/aVideoEncoderNotifyIsDone.json.php
[15-Mar-2023 10:56:03 UTC] sendToStreamer to objects/aVideoEncoderNotifyIsDone.json.php
[15-Mar-2023 10:56:03 UTC] sendToStreamer spectrumimage not set
[15-Mar-2023 10:56:03 UTC] sendToStreamer rawVideo not set
[15-Mar-2023 10:56:03 UTC] sendToStreamer image not set
[15-Mar-2023 10:56:03 UTC] sendToStreamer gifimage not set
[15-Mar-2023 10:56:03 UTC] sendToStreamer webpimage not set
[15-Mar-2023 10:56:03 UTC] sendToStreamer video not set
[15-Mar-2023 10:56:03 UTC] sendToStreamer https://mediawall-test.infn.it/objects/aVideoEncoderNotifyIsDone.json.php in 0.606 seconds {"error":false,"target":"objects/aVideoEncoderNotifyIsDone.json.php","postFields":{"fail":0,"streamers_id":"1","user":"admin","pass":"_user_hash_S3Q2RmV2a3hCWDJ3aFZkOEdlMEIrSW8wZ1lmeU9Ob2dTWGhrRHZLakhIejR5SFdNbU1XSWYzeVJYVTdIQjB0a3NQTGJWRTJTNTZLdWdHcFUwMERWWnc9PQ==","return_vars":"{"videos_id":712,"video_id_hash":"cHlEZEhBN3dUTng5c1h3bU9TMmwrdlRaR2Vud0NTWms0VUtZV1NiNzc5VT0=","releaseDate":"2023-03-15 10:33"}","releaseDate":"2023-03-15 10:33","videos_id":712,"video_id_hash":"cHlEZEhBN3dUTng5c1h3bU9TMmwrdlRaR2Vud0NTWms0VUtZV1NiNzc5VT0="},"response_raw":"{"error":false,"video_id":712}","response":{"error":false,"video_id":712}}

Could you give me any hints to help me solve this issue?

Thanks in advance,

Marco

@DanielnetoDotCom
Copy link
Member

I cannot see any issue but try to manually run this command

ffmpeg -i "/var/www/html/videos/6_tmpFile.mp4" -vf scale=-2:240 -movflags +faststart -preset veryfast -vcodec h264 -acodec aac -b:a 128k -max_muxing_queue_size 1024 -y /var/www/html/videos/avideoTmpFile_6_streamers_id_1_240.mp4 -vf scale=-2:360 -movflags +faststart -preset veryfast -vcodec h264 -acodec aac -b:a 128k -max_muxing_queue_size 1024 -y /var/www/html/videos/avideoTmpFile_6_streamers_id_1_360.mp4 -vf scale=-2:480 -movflags +faststart -preset veryfast -vcodec h264 -acodec aac -b:a 128k -max_muxing_queue_size 1024 -y /var/www/html/videos/avideoTmpFile_6_streamers_id_1_480.mp4 -vf scale=-2:540 -movflags +faststart -preset veryfast -vcodec h264 -acodec aac -b:a 192k -max_muxing_queue_size 1024 -y /var/www/html/videos/avideoTmpFile_6_streamers_id_1_540.mp4 -vf scale=-2:720 -movflags +faststart -preset veryfast -vcodec h264 -acodec aac -b:a 192k -max_muxing_queue_size 1024 -y /var/www/html/videos/avideoTmpFile_6_streamers_id_1_720.mp4

@mcorvo
Copy link
Author

mcorvo commented Mar 16, 2023

The command, run from command line inside the container, works just fine. The only difference I see is that when running from CLI, the output starts like this:

ffmpeg version 4.3.5-0+deb11u1 Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 10 (Debian 10.2.1-6)
configuration: --prefix=/usr --extra-version=0+deb11u1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-av
resample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --e
nable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt -
-enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-l
ibtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --en
able-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-f
rei0r --enable-libx264 --enable-shared
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/var/www/html/videos/17_tmpFile.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.45.100
Duration: 00:04:28.80, start: 0.000000, bitrate: 2002 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 1869 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name : ISO Media file produced by Google Inc.
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127 kb/s (default)
Metadata:
handler_name : ISO Media file produced by Google Inc.
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Stream #0:0 -> #1:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #1:1 (aac (native) -> aac (native))
Stream #0:0 -> #2:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #2:1 (aac (native) -> aac (native))
Stream #0:0 -> #3:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #3:1 (aac (native) -> aac (native))
Stream #0:0 -> #4:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #4:1 (aac (native) -> aac (native))
Stream #0:0 -> #5:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #5:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
.....

while the log created inside Encoder shows (this is taken from an X_tmpFile_progress.txt):

ffmpeg version 4.3.5-0+deb11u1 Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 10 (Debian 10.2.1-6)
configuration: --prefix=/usr --extra-version=0+deb11u1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-av
resample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --e
nable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt -
-enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-l
ibtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --en
able-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-f
rei0r --enable-libx264 --enable-shared
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
Option user_agent not found.

and there is stops. I tried to find some hints on this "user_option" but didn't find anything useful. Could it be something that is wrapped around the command when

$encoder->exec($code . " 1> "{$progressFile}" 2>&1", $output, $return_val);

is run?

Thanks in advance,

Regards,

Marco

@DanielnetoDotCom
Copy link
Member

I am not sure what is happening but looks like a permission thing. maybe php has a memory limit or has no permission to execute ffmpeg commands

Are you using Ubuntu? and php as an apache module?

@mcorvo
Copy link
Author

mcorvo commented Mar 17, 2023

Actually I'm using a docker image called php:7-apache which is a Debian (from /etc/os-release)

PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian

It's the default of the Dockerfile to build Encoder image.

@DanielnetoDotCom
Copy link
Member

Make sure you are using this docker

https://github.com/WWBN/AVideo/wiki/Running-AVideo-with-Docker

this is working fine

@mohmafia
Copy link

mohmafia commented Apr 3, 2023

@DanielnetoDotCom the php-mod apache module is very insecure you should consider to make things work with fpm and that the script needs root also big security risk .. nothing needs root permissions to encode or do cli stuff over php root access is a very very dangerous thing and leaves the door wide open to hackers please considder that with your next update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants