
Recherche avancée
Médias (91)
-
#3 The Safest Place
16 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#4 Emo Creates
15 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#2 Typewriter Dance
15 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#1 The Wires
11 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
ED-ME-5 1-DVD
11 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Audio
-
Revolution of Open-source and film making towards open film making
6 octobre 2011, par
Mis à jour : Juillet 2013
Langue : English
Type : Texte
Autres articles (82)
-
Amélioration de la version de base
13 septembre 2013Jolie sélection multiple
Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...) -
Le profil des utilisateurs
12 avril 2011, parChaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...) -
Configurer la prise en compte des langues
15 novembre 2010, parAccéder à la configuration et ajouter des langues prises en compte
Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)
Sur d’autres sites (7639)
-
ffmpeg-python error, cannot load mp4 encoder
19 août 2020, par tristan_jiaThis error came when I just try a simple demo from the page of ffmpeg-python :


import ffmpeg
stream = ffmpeg.input('human_face.mp4')
stream = ffmpeg.hflip(stream)
stream = ffmpeg.output(stream, 'new_human_face.mp4')
ffmpeg.run(stream)



And the output goes like :


...
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'human_face.mp4':
 Metadata:
 major_brand : isom
 minor_version : 512
 compatible_brands: isomiso2mp41
 encoder : Lavf58.49.100
 Duration: 00:00:12.45, start: 0.000000, bitrate: 742 kb/s
 Stream #0:0(und): Video: mpeg4 (mp4v / 0x7634706D), none, 256x256, 741 kb/s, 20 fps, 20 tbr, 10240 tbn, 10240 tbc (default)
 Metadata:
 handler_name : VideoHandler
Automatic encoder selection failed for output stream #0:0. Default encoder for format mp4 (codec mpeg4) is probably disabled or this build of ffmpeg does not include that codec. Please choose an encoder manually.
Error selecting an encoder for stream 0:0
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 File "/home/tristan_jia/workspace/py3.6/venv/lib/python3.6/site-packages/ffmpeg/_run.py", line 325, in run
 raise Error('ffmpeg', out, err)
</module></stdin>


I think the most important log is :"Automatic encoder selection failed for output stream #0:0. Default encoder for format mp4 (codec mpeg4) is probably disabled or this build of ffmpeg does not include that codec. Please choose an encoder manually."


I've reinstalled the ffmpeg package but the error remains.



Appended 1 :
Thanks for the comment from @HernánAlarcón :


- 

- the version is 3.4.4.
- the output of
ffmpeg -encoders
is :






(venv) tristan_jia@linux-ftbv:~/.../data> ffmpeg -encoders
ffmpeg version 3.4.4 Copyright (c) 2000-2018 the FFmpeg developers
 built with gcc 7 (SUSE Linux)
 configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --incdir=/usr/include/ffmpeg --extra-cflags='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g' --optflags='-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g' --disable-htmlpages --enable-pic --disable-stripping --enable-shared --disable-static --enable-gpl --disable-openssl --enable-avresample --enable-libcdio --enable-gnutls --enable-ladspa --disable-cuda --disable-cuvid --enable-libass --enable-libbluray --enable-libcelt --enable-libcdio --enable-libdc1394 --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libzimg --enable-libzvbi --enable-vaapi --enable-vdpau --enable-muxers --enable-demuxers --disable-encoders --disable-decoders --disable-decoder='mpeg4,h263,h264,hevc,vc1' --enable-encoder='apng,ass,ayuv,bmp,ffv1,ffvhuff,flac,gif,huffyuv,jpegls,libgsm,libmp3lame,libopenjpeg,libopus,libschroedinger,libspeex,libtheora,libtwolame,libvorbis,libvpx_vp8,libvpx_vp9,libwebp,libwebp_anim,mjpeg,mp2,mp2fixed,opus,pam,pbm,pcm_alaw,pcm_f32be,pcm_f32le,pcm_f64be,pcm_f64le,pcm_mulaw,pcm_s16be,pcm_s16be_planar,pcm_s16le,pcm_s16le_planar,pcm_s24be,pcm_s24le,pcm_s24le_planar,pcm_s32be,pcm_s32le,pcm_s32le_planar,pcm_s8,pcm_s8_planar,pcm_u16be,pcm_u16le,pcm_u24be,pcm_u24le,pcm_u32be,pcm_u32le,pcm_u8,pcx,pgm,pgmyuv,png,ppm,sgi,srt,ssa,sunrast,targa,text,tiff,v210,v308,v408,v410,vorbis,xbm,xwd,y41p,yuv4,zlib,' --enable-decoder='ac3,ansi,apng,ass,ayuv,bmp,dirac,exr,ffv1,ffvhuff,ffwavesynth,flac,gif,gsm,huffyuv,libcelt,libgsm,libopenjpeg,libopus,libschroedinger,libspeex,libvorbis,libvpx_vp8,libvpx_vp9,mjpeg,mpeg1video,mpeg2video,,mp1,mp1float,mp2,mp2float,mp3,mp3float,opus,pam,pbm,pcm_alaw,pcm_bluray,pcm_dvd,pcm_f32be,pcm_f32le,pcm_f64be,pcm_f64le,pcm_mulaw,pcm_s16be,pcm_s16be_planar,pcm_s16le,pcm_s16le_planar,pcm_s24be,pcm_s24le,pcm_s24le_planar,pcm_s32be,pcm_s32le,pcm_s32le_planar,pcm_s8,pcm_s8_planar,pcm_u16be,pcm_u16le,pcm_u24be,pcm_u24le,pcm_u32be,pcm_u32le,pcm_u8,pcx,pgm,pgmyuv,pgssub,png,ppm,rawvideo,sgi,srt,ssa,sunrast,targa,text,theora,tiff,v210,v210x,v308,v408,v410,vorbis,vp3,vp5,vp6,vp6a,vp6f,vp8,vp9,webp,xbm,xwd,y41p,yuv4,zlib,'
 libavutil 55. 78.100 / 55. 78.100
 libavcodec 57.107.100 / 57.107.100
 libavformat 57. 83.100 / 57. 83.100
 libavdevice 57. 10.100 / 57. 10.100
 libavfilter 6.107.100 / 6.107.100
 libavresample 3. 7. 0 / 3. 7. 0
 libswscale 4. 8.100 / 4. 8.100
 libswresample 2. 9.100 / 2. 9.100
 libpostproc 54. 7.100 / 54. 7.100
Encoders:
 V..... = Video
 A..... = Audio
 S..... = Subtitle
 .F.... = Frame-level multithreading
 ..S... = Slice-level multithreading
 ...X.. = Codec is experimental
 ....B. = Supports draw_horiz_band
 .....D = Supports direct rendering method 1
 ------
 V..... apng APNG (Animated Portable Network Graphics) image
 V..... ayuv Uncompressed packed MS 4:4:4:4
 V..... bmp BMP (Windows and OS/2 bitmap)
 V.S... ffv1 FFmpeg video codec #1
 VF.... ffvhuff Huffyuv FFmpeg variant
 V..... gif GIF (Graphics Interchange Format)
 VF.... huffyuv Huffyuv / HuffYUV
 VF.... libopenjpeg OpenJPEG JPEG 2000 (codec jpeg2000)
 VF.... jpegls JPEG-LS
 VFS... mjpeg MJPEG (Motion JPEG)
 V..... pam PAM (Portable AnyMap) image
 V..... pbm PBM (Portable BitMap) image
 V..... pcx PC Paintbrush PCX image
 V..... pgm PGM (Portable GrayMap) image
 V..... pgmyuv PGMYUV (Portable GrayMap YUV) image
 VF.... png PNG (Portable Network Graphics) image
 V..... ppm PPM (Portable PixelMap) image
 V..... sgi SGI image
 V..... sunrast Sun Rasterfile image
 V..... targa Truevision Targa image
 V..... libtheora libtheora Theora (codec theora)
 VF.... tiff TIFF image
 V..... v210 Uncompressed 4:2:2 10-bit
 V..... v308 Uncompressed packed 4:4:4
 V..... v408 Uncompressed packed QT 4:4:4:4
 V..... v410 Uncompressed 4:4:4 10-bit
 V..... libvpx libvpx VP8 (codec vp8)
 V..... libvpx-vp9 libvpx VP9 (codec vp9)
 V..... libwebp_anim libwebp WebP image (codec webp)
 V..... libwebp libwebp WebP image (codec webp)
 V..... xbm XBM (X BitMap) image
 V..... xwd XWD (X Window Dump) image
 V..... y41p Uncompressed YUV 4:1:1 12-bit
 V..... yuv4 Uncompressed packed 4:2:0
 VF.... zlib LCL (LossLess Codec Library) ZLIB
 A..... flac FLAC (Free Lossless Audio Codec)
 A..... libgsm libgsm GSM (codec gsm)
 A..... mp2 MP2 (MPEG audio layer 2)
 A..... mp2fixed MP2 fixed point (MPEG audio layer 2) (codec mp2)
 A..... libtwolame libtwolame MP2 (MPEG audio layer 2) (codec mp2)
 A..... libmp3lame libmp3lame MP3 (MPEG audio layer 3) (codec mp3)
 A..X.. opus Opus
 A..... libopus libopus Opus (codec opus)
 A..... pcm_alaw PCM A-law / G.711 A-law
 A..... pcm_f32be PCM 32-bit floating point big-endian
 A..... pcm_f32le PCM 32-bit floating point little-endian
 A..... pcm_f64be PCM 64-bit floating point big-endian
 A..... pcm_f64le PCM 64-bit floating point little-endian
 A..... pcm_mulaw PCM mu-law / G.711 mu-law
 A..... pcm_s16be PCM signed 16-bit big-endian
 A..... pcm_s16be_planar PCM signed 16-bit big-endian planar
 A..... pcm_s16le PCM signed 16-bit little-endian
 A..... pcm_s16le_planar PCM signed 16-bit little-endian planar
 A..... pcm_s24be PCM signed 24-bit big-endian
 A..... pcm_s24le PCM signed 24-bit little-endian
 A..... pcm_s24le_planar PCM signed 24-bit little-endian planar
 A..... pcm_s32be PCM signed 32-bit big-endian
 A..... pcm_s32le PCM signed 32-bit little-endian
 A..... pcm_s32le_planar PCM signed 32-bit little-endian planar
 A..... pcm_s8 PCM signed 8-bit
 A..... pcm_s8_planar PCM signed 8-bit planar
 A..... pcm_u16be PCM unsigned 16-bit big-endian
 A..... pcm_u16le PCM unsigned 16-bit little-endian
 A..... pcm_u24be PCM unsigned 24-bit big-endian
 A..... pcm_u24le PCM unsigned 24-bit little-endian
 A..... pcm_u32be PCM unsigned 32-bit big-endian
 A..... pcm_u32le PCM unsigned 32-bit little-endian
 A..... pcm_u8 PCM unsigned 8-bit
 A..... libspeex libspeex Speex (codec speex)
 A..X.. vorbis Vorbis
 A..... libvorbis libvorbis (codec vorbis)
 S..... ssa ASS (Advanced SubStation Alpha) subtitle (codec ass)
 S..... ass ASS (Advanced SubStation Alpha) subtitle
 S..... srt SubRip subtitle (codec subrip)
 S..... text Raw text subtitle
'''



-
How to overlay 2 videos, one is main second one is overlaying it, and play sound simultaneously. using FFMPEG in ANDROID STUDIO
6 août 2020, par Dusan Lilicas title say I'm trying to overlay 2 videos and play sound simultaneously. So far i managed to put 1 video over another using this command :


String[] command = {"-i", mainVideoPath, "-vf",
 "movie=" + overlayVideo + ", scale=300:-1[inner]; [in][inner]overlay=10:10[out]" ,combinedVideoOutput};



and this works but I have 3 problems here.
First, video is rotated by 90 degrees (overlay video), second Audio is played only from main video (I want to play sound from both videos simultaneously), and third overlay video is longer (for example : overlayVideo duration is 10 seconds and main video last 7 seconds) then mainVideo, so i want to final video last as long as mainVideo, as soon as mainVideo finish, overlayVideo should also stop (need to cut it prolly ?)


String[] command = {"-i", mainVideoPath, "-i", overlayVideo ,
 "-filter_complex", "[1:v][0:v]scale2ref=(256/256)*ih/8/sar:ih/8[wm][base];[base][wm]overlay=10:10" ,combinedVideoOutput};



Using this command i have 2 problems same as above except video is not rotated here.
I have to say that I'm not very familiar with ffmpeg commands. I was trying to figure it out from documentation link to documentation but without any success.
I know that I'm missing some filters like -map merge or something but can't figure it out.
Thanks in advance !


EDIT1 :
This is logcat from second commad as asked


D/LISKO: ffmpeg version n4.0-39-gda39990 Copyright (c) 2000-2018 the FFmpeg developers
 built with gcc 4.9.x (GCC) 20150123 (prerelease)
D/LISKO: configuration: --target-os=linux --cross-prefix=/root/bravobit/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/root/bravobit/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-ffprobe --enable-libopus --enable-libvorbis --enable-libfdk-aac --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-fontconfig --enable-libvpx --enable-libass --enable-yasm --enable-pthreads --disable-debug --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-linux-perf --disable-doc --disable-shared --enable-static --enable-runtime-cpudetect --enable-nonfree --enable-network --enable-avresample --enable-avformat --enable-avcodec --enable-indev=lavfi --enable-hwaccels --enable-ffmpeg --enable-zlib --enable-gpl --enable-small --enable-nonfree --pkg-config=pkg-config --pkg-config-flags=--static --prefix=/root/bravobit/ffmpeg-android/build/armeabi-v7a --extra-cflags='-I/root/bravobit/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all' --extra-ldflags='-L/root/bravobit/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-cxxflags=
D/LISKO: libavutil 56. 14.100 / 56. 14.100
 libavcodec 58. 18.100 / 58. 18.100
 libavformat 58. 12.100 / 58. 12.100
 libavdevice 58. 3.100 / 58. 3.100
 libavfilter 7. 16.100 / 7. 16.100
D/LISKO: libavresample 4. 0. 0 / 4. 0. 0
 libswscale 5. 1.100 / 5. 1.100
D/LISKO: libswresample 3. 1.100 / 3. 1.100
 libpostproc 55. 1.100 / 55. 1.100
D/LISKO: Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/mainVideo.mp4':
 Metadata:
 major_brand : iso6
 minor_version : 1
 compatible_brands: mp42iso6avc1isom
 creation_time : 2020-08-03T13:20:11.000000Z
 Duration: 00:00:07.04, start: 0.000000, bitrate: 1380 kb/s
 Stream #0:0(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 140 kb/s (default)
 Metadata:
 creation_time : 2020-07-28T08:11:36.000000Z
 Stream #0:1(und): Video: h264 (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 81:256 DAR 9:16], 1264 kb/s, 30 fps, 30 tbr, 90k tbn, 180k tbc (default)
 Metadata:
 creation_time : 2020-07-28T08:11:36.000000Z
D/LISKO: Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/overlayVideo.mp4':
 Metadata:
 major_brand : mp42
 minor_version : 0
 compatible_brands: isommp42
 creation_time : 2020-08-04T07:27:47.000000Z
 com.android.version: 10
 Duration: 00:00:11.19, start: 0.000000, bitrate: 9993 kb/s
D/LISKO: Stream #1:0(eng): Video: h264 (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720, 9238 kb/s, SAR 1:1 DAR 16:9, 28.38 fps, 29.75 tbr, 90k tbn, 180k tbc (default)
 Metadata:
 rotate : 270
 creation_time : 2020-08-04T07:27:47.000000Z
 handler_name : VideoHandle
 Side data:
 displaymatrix: rotation of 90.00 degrees
 Stream #1:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s (default)
 Metadata:
 creation_time : 2020-08-04T07:27:47.000000Z
 handler_name : SoundHandle
 Stream mapping:
 Stream #0:1 (h264) -> scale2ref:ref (graph 0)
 Stream #1:0 (h264) -> scale2ref:default (graph 0)
 overlay (graph 0) -> Stream #0:0 (libx264)
 Stream #0:0 -> #0:1 (aac (native) -> aac (native))
 Press [q] to stop, [?] for help
D/LISKO: [libx264 @ 0xee986100] using SAR=81/256
D/LISKO: [libx264 @ 0xee986100] using cpu capabilities: ARMv6 NEON
 [libx264 @ 0xee986100] profile High, level 3.1
D/LISKO: [libx264 @ 0xee986100] 264 - core 152 r2851M ba24899 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - 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=12 lookahead_threads=2 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=25 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
D/LISKO: Output #0, mp4, to '/storage/emulated/0/outputVideo.mp4':
D/LISKO: Metadata:
 major_brand : iso6
D/LISKO: minor_version : 1
D/LISKO: compatible_brands: mp42iso6avc1isom
D/LISKO: encoder : Lavf58.12.100
 Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 81:256 DAR 9:16], q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)
D/LISKO: Metadata:
 encoder : Lavc58.18.100 libx264
 Side data:
 cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
D/LISKO: Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
 Metadata:
 creation_time : 2020-07-28T08:11:36.000000Z
D/LISKO: encoder : Lavc58.18.100 aac
D/LISKO: frame= 26 fps=0.0 q=0.0 size= 0kB time=00:00:00.09 bitrate= 4.1kbits/s dup=2 drop=0 speed=0.185x 
D/LISKO: frame= 41 fps= 41 q=0.0 size= 0kB time=00:00:00.58 bitrate= 0.7kbits/s dup=2 drop=0 speed=0.574x 
D/LISKO: frame= 49 fps= 32 q=0.0 size= 0kB time=00:00:00.92 bitrate= 0.4kbits/s dup=2 drop=0 speed=0.613x 
D/LISKO: frame= 59 fps= 29 q=29.0 size= 0kB time=00:00:01.97 bitrate= 0.2kbits/s dup=2 drop=0 speed=0.974x 
D/LISKO: frame= 75 fps= 29 q=29.0 size= 0kB time=00:00:01.97 bitrate= 0.2kbits/s dup=2 drop=0 speed=0.762x 



EDIT2 :
After adding "-shortest" to command i managed to cut overlay video to be the same length as main video (because overlay video is always longer then mainVideo, "-shortest" take short one duration. So now, command looks like this :


String[] command = {"-i", mainVideoPath, "-i", overlayVideo ,"-filter_complex", 
"[1:v][0:v]scale2ref=(256/256)*ih/8/sar:ih/8[wm][base];[base][wm]overlay=10:10", "-shortest", combinedVideoOutput};



Rotation is good so only need to merge their audios. For now, only mainVideo audio is playing, overlay video audio isn't


EDIT 3 :


String[] command = {"-i", mainVideoPath, "-i", overlayVideo ,
 "-strict", "experimental",
 "-filter_complex",
 "[1:v][0:v]scale2ref=(256/256)*ih/8/sar:ih/8[wm][base];" +
 "[base][wm]overlay=10:10; " +
 "pan=stereo|c0=2*c0|c1=3*c0[a0];[1:a]pan=stereo|c0=1*c0|c1=4*c0[a1];[a0][a1]amix=inputs=2:duration=first:dropout_transition=2",
 "-shortest" ,combinedVideoOutput};



With this command i managed to overlay videos, and play sound from both of them, rotation is good, but -shortest doesn't work now. Only existing problem now is to make them to last as shorter one (mainVideo is always shorter) ???


EDIT 4 :


This is finally working command


String[] command = {"-i", mainVideoPath, "-i", overlayVideo,
 "-filter_complex",
 "[1:v][0:v]scale2ref=(256/256)*ih/8/sar:ih/8[wm][base];" +
 "[base][wm]overlay=10:10:shortest=1;" +
 "pan=stereo|c0=2*c0|c1=3*c0[a0];[1:a]pan=stereo|c0=1*c0|c1=4*c0[a1];" +
 "[a0][a1]amix=inputs=2:duration=first:dropout_transition=2",
 combinedVideoOutput};



Thanks


-
FFMPEG php HLS and DASH conversion
21 juillet 2020, par Angus SimonsI'm using this repo https://github.com/aminyazdanpanah/PHP-FFmpeg-video-streaming to encode video in hls and then reproduce on the front end.


After creating all the hls segments correctly the php script fail to execute the command below.
The command getting error is the next one :


'/usr/bin/ffmpeg' '-y' '-i' 'source.mp4' '-c:v' 'libx264' '-c:a' 'aac' '-bf' '1' '-keyint_min' '25' '-g' '250' '-sc_threshold' '40' '-use_timeline' '1' '-use_template' '1' '-init_seg_name' 'dash_init_$RepresentationID$.$ext$' '-media_seg_name' 'dash_chunk_$RepresentationID$_$Number%05d$.$ext$' '-seg_duration' '10' '-hls_playlist' '0' '-f' 'dash' '-adaptation_sets' 'id=0,streams=v id=1,streams=a' '-map' '0' '-s:v:0' '256x144' '-b:v:0' '830k' '-map' '0' '-s:v:1' '426x240' '-b:v:1' '969k' '-map' '0' '-s:v:2' '640x360' '-b:v:2' '1162k' '-map' '0' '-s:v:3' '854x480' '-b:v:3' '1453k' '-map' '0' '-s:v:4' '1280x720' '-b:v:4' '1938k' '-map' '0' '-s:v:5' '1920x1080' '-b:v:5' '2907k' '-strict' '-2' '-threads' '12' 'dash.mpd'



Here there is the error printed executing the command with CLI :


ffmpeg version 4.3-2~16.04.york1 Copyright (c) 2000-2020 the FFmpeg developers
 built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.12) 20160609
 configuration: --prefix=/usr --extra-version='2~16.04.york1' --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-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-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
 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'source.mp4':
 Metadata:
 major_brand : mp42
 minor_version : 0
 compatible_brands: mp42mp41
 creation_time : 2020-07-10T09:13:47.000000Z
 Duration: 01:03:27.36, start: 0.000000, bitrate: 3298 kb/s
 Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 2977 kb/s, 25 fps, 25 tbr, 25k tbn, 50 tbc (default)
 Metadata:
 creation_time : 2020-07-10T09:13:47.000000Z
 handler_name : ?Mainconcept Video Media Handler
 encoder : AVC Coding
 Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 317 kb/s (default)
 Metadata:
 creation_time : 2020-07-10T09:13:48.000000Z
 handler_name : #Mainconcept MP4 Sound Media Handler
 Stream mapping:
 Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
 Stream #0:1 -> #0:1 (aac (native) -> aac (native))
 Stream #0:0 -> #0:2 (h264 (native) -> h264 (libx264))
 Stream #0:1 -> #0:3 (aac (native) -> aac (native))
 Stream #0:0 -> #0:4 (h264 (native) -> h264 (libx264))
 Stream #0:1 -> #0:5 (aac (native) -> aac (native))
 Stream #0:0 -> #0:6 (h264 (native) -> h264 (libx264))
 Stream #0:1 -> #0:7 (aac (native) -> aac (native))
 Stream #0:0 -> #0:8 (h264 (native) -> h264 (libx264))
 Stream #0:1 -> #0:9 (aac (native) -> aac (native))
 Stream #0:0 -> #0:10 (h264 (native) -> h264 (libx264))
 Stream #0:1 -> #0:11 (aac (native) -> aac (native))
 Press [q] to stop, [?] for help
 [libx264 @ 0x55de2d5e6c80] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
 [libx264 @ 0x55de2d5e6c80] profile High, level 2.0
 [libx264 @ 0x55de2d5e6c80] 264 - core 155 r2917 0a84d98 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - 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=12 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=1 b_pyramid=0 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=abr mbtree=1 bitrate=830 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
 [libx264 @ 0x55de2d09fcc0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
 [libx264 @ 0x55de2d09fcc0] profile High, level 2.1
 [libx264 @ 0x55de2d09fcc0] 264 - core 155 r2917 0a84d98 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - 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=12 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=1 b_pyramid=0 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=abr mbtree=1 bitrate=969 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
 [libx264 @ 0x55de2d0a4240] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
 [libx264 @ 0x55de2d0a4240] profile High, level 3.0
 [libx264 @ 0x55de2d0a4240] 264 - core 155 r2917 0a84d98 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - 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=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=1 b_pyramid=0 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=abr mbtree=1 bitrate=1162 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
 [libx264 @ 0x55de2d0a8380] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
 [libx264 @ 0x55de2d0a8380] profile High, level 3.0
 [libx264 @ 0x55de2d0a8380] 264 - core 155 r2917 0a84d98 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - 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=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=1 b_pyramid=0 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=abr mbtree=1 bitrate=1453 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
 [libx264 @ 0x55de2d085c80] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
 [libx264 @ 0x55de2d085c80] profile High, level 3.1
 [libx264 @ 0x55de2d085c80] 264 - core 155 r2917 0a84d98 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - 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=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=1 b_pyramid=0 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=abr mbtree=1 bitrate=1938 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
 [libx264 @ 0x55de2d089d40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
 [libx264 @ 0x55de2d089d40] profile High, level 4.0
 [libx264 @ 0x55de2d089d40] 264 - core 155 r2917 0a84d98 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - 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=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=1 b_pyramid=0 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=abr mbtree=1 bitrate=2907 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
 [dash @ 0x55de2cf50900] Opening 'dash_init_0.m4s' for writing
 [dash @ 0x55de2cf50900] Opening 'dash_init_1.m4s' for writing
 [dash @ 0x55de2cf50900] Opening 'dash_init_2.m4s' for writing
 [dash @ 0x55de2cf50900] Conflicting stream par values in Adaptation Set 1
 Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
 Error initializing output stream 0:10 -- 
 [libx264 @ 0x55de2d5e6c80] final ratefactor: 16.04
 [aac @ 0x55de2d09eb80] Qavg: 65536.000
 [aac @ 0x55de2d09eb80] 2 frames left in the queue on closing
 [libx264 @ 0x55de2d09fcc0] final ratefactor: 19.18
 [aac @ 0x55de2d0a2b00] Qavg: 65536.000
 [aac @ 0x55de2d0a2b00] 2 frames left in the queue on closing
 [libx264 @ 0x55de2d0a4240] final ratefactor: 21.16
 [aac @ 0x55de2d0a6c40] Qavg: 65536.000
 [aac @ 0x55de2d0a6c40] 2 frames left in the queue on closing
 [libx264 @ 0x55de2d0a8380] final ratefactor: 21.67
 [aac @ 0x55de2d084540] Qavg: 65536.000
 [aac @ 0x55de2d084540] 2 frames left in the queue on closing
 [libx264 @ 0x55de2d085c80] final ratefactor: 22.63
 [aac @ 0x55de2d088600] Qavg: 65536.000
 [aac @ 0x55de2d088600] 2 frames left in the queue on closing
 [libx264 @ 0x55de2d089d40] final ratefactor: 22.67
 [aac @ 0x55de2d08c5c0] Qavg: 65536.000
 [aac @ 0x55de2d08c5c0] 2 frames left in the queue on closing
 Conversion failed!



I checked if I have MPEG DASH support enable and it is enabled in FFMPEG