savonet / liquidsoap

Liquidsoap is a statically typed scripting general-purpose language with dedicated operators and backend for all thing media, streaming, file generation, automation, HTTP backend and more.
http://liquidsoap.info
GNU General Public License v2.0
1.4k stars 130 forks source link

Unable to decode "file.mp4" #1412

Closed yasn0st closed 3 years ago

yasn0st commented 3 years ago

All day I have been trying to get liquidsoap to play a video file. And I can't do it. I keep getting the message Unable to decode. I tried it in windows, tried it in ubuntu, compiled the application in opam. Replaced gavl with ffmpeg. Converted mp4 to xvid avi and ogv. And all to no avail.

I want to make a script that makes a video broadcast with music on youtube. Everything works with a static picture. But the video doesn't work.

script:

set("log.stdout",true)
set("log.file",true)

set("video.converter.preferred","ffmpeg")
set("decoder.file_extensions.ffmpeg",["mp3","mp4","m4a","wav","flac","ogg","wma","webm","osb"])

set("frame.video.width",1280)
set("frame.video.height",720)
set("frame.video.samplerate", 25)

video = mksafe(single("./vid/img2_1.mp4"))
s = mksafe(playlist("./mp3"))
source = mux_video(video=video,s)
output.youtube.live.ffmpeg(id="youtube",fallible=true,bitrate="500",key="***",source)

log

2020/11/25 22:47:34 >>> LOG START
2020/11/25 22:47:33 [main:3] Liquidsoap 1.4.3
2020/11/25 22:47:33 [main:3] Using: bytes=[distributed with OCaml 4.02 or above] pcre=7.4.6 sedlex=2.2 menhirLib=20201122 dtools=0.4.2 duppy=0.8.0 cry=0.6.5 mm=0.5.0 ogg=0.5.2 vorbis=0.7.1 mad=0.4.5 dynlink=[distributed with Ocaml] lame=0.3.4 gstreamer=0.3.1 fdkaac=0.3.2 gavl=0.1.6 ffmpeg=0.4.3 samplerate=0.1.5 taglib=0.3.6 camomile=1.0.2 faad=0.4.0 sdl=0.9.1
2020/11/25 22:47:34 [gstreamer.loader:3] Loaded GStreamer 1.18.0 0
2020/11/25 22:47:34 [frame:3] Using 44100Hz audio, 25Hz video, 44100Hz master.
2020/11/25 22:47:34 [frame:3] Frame size must be a multiple of 1764 ticks = 1764 audio samples = 1 video samples.
2020/11/25 22:47:34 [frame:3] Targetting 'frame.duration': 0.04s = 1764 audio samples = 1764 ticks.
2020/11/25 22:47:34 [frame:3] Frames last 0.04s = 1764 audio samples = 1 video samples = 1764 ticks.
2020/11/25 22:47:34 [sandbox:3] Sandboxing disabled
2020/11/25 22:47:34 [video.converter:3] Using preferred video converter: ffmpeg.
2020/11/25 22:47:34 [audio.converter:3] Using samplerate converter: ffmpeg.
2020/11/25 22:47:34 [mp3:3] Loading playlist...
2020/11/25 22:47:34 [mp3:3] Playlist is a directory.
2020/11/25 22:47:34 [mp3:3] Successfully loaded a playlist of 6 tracks.
2020/11/25 22:47:34 [vid:3] Loading playlist...
2020/11/25 22:47:34 [vid:3] Playlist is a directory.
2020/11/25 22:47:34 [vid:3] Successfully loaded a playlist of 1 tracks.
2020/11/25 22:47:34 [clock.wallclock_main:3] Streaming loop starts, synchronized with wallclock.
2020/11/25 22:47:34 [decoder:3] Method "FFMPEG" accepted "./mp3/\208\191\209\128\208\191\208\176 \208\191\209\128\208\191\208\176\209\128 \208\176\208\191\209\128\208\176\209\128\208\176.mp3".
2020/11/25 22:47:34 [decoder:3] Unable to decode "./vid/img2_1.mp4"!
2020/11/25 22:47:34 [decoder:3] Method "FFMPEG" accepted "./mp3/\208\176\209\128\208\191\209\128.mp3".
2020/11/25 22:47:34 [mp3:3] Prepared "./mp3/\208\191\209\128\208\191\208\176 \208\191\209\128\208\191\208\176\209\128 \208\176\208\191\209\128\208\176\209\128\208\176.mp3" (RID 2).
2020/11/25 22:47:34 [decoder:3] Unable to decode "./vid/img2_1.mp4" as {audio=0;video=1;midi=0}!
2020/11/25 22:47:34 [decoder:3] Unable to decode "./vid/img2_1.mp4"!
2020/11/25 22:47:34 [decoder:3] Unable to decode "./vid/img2_1.mp4" as {audio=0;video=1;midi=0}!
2020/11/25 22:47:34 [decoder:3] Unable to decode "./vid/img2_1.mp4"!
2020/11/25 22:47:34 [decoder:3] Unable to decode "./vid/img2_1.mp4" as {audio=0;video=1;midi=0}!
2020/11/25 22:47:34 [decoder:3] Unable to decode "./vid/img2_1.mp4"!
2020/11/25 22:47:34 [decoder:3] Unable to decode "./vid/img2_1.mp4" as {audio=0;video=1;midi=0}!
2020/11/25 22:47:34 [main:3] Shutdown started!
2020/11/25 22:47:34 [main:3] Waiting for main threads to terminate...
2020/11/25 22:47:34 [clock.wallclock_main:3] Streaming loop stopped.
2020/11/25 22:47:34 [main:3] Threads terminated.
2020/11/25 22:47:34 [threads:3] Shutting down scheduler...
2020/11/25 22:47:34 [threads:3] Scheduler shut down.
2020/11/25 22:47:34 [threads:3] Waiting for queue threads to terminate...
2020/11/25 22:47:34 [threads:3] Queues shut down
2020/11/25 22:47:35 [main:3] Cleaning downloaded files...
2020/11/25 22:47:35 [main:3] Freeing memory...

log with gavl is same

2020/11/25 22:50:35 >>> LOG START
2020/11/25 22:50:34 [main:3] Liquidsoap 1.4.3
2020/11/25 22:50:34 [main:3] Using: bytes=[distributed with OCaml 4.02 or above] pcre=7.4.6 sedlex=2.2 menhirLib=20201122 dtools=0.4.2 duppy=0.8.0 cry=0.6.5 mm=0.5.0 ogg=0.5.2 vorbis=0.7.1 mad=0.4.5 dynlink=[distributed with Ocaml] lame=0.3.4 gstreamer=0.3.1 fdkaac=0.3.2 gavl=0.1.6 ffmpeg=0.4.3 samplerate=0.1.5 taglib=0.3.6 camomile=1.0.2 faad=0.4.0 sdl=0.9.1
2020/11/25 22:50:34 [gstreamer.loader:3] Loaded GStreamer 1.18.0 0
2020/11/25 22:50:35 [decoder:3] Unable to decode "./vid/img2_1.mp4"!
2020/11/25 22:50:35 [decoder:3] Unable to decode "./vid/img2_1.mp4" as {audio=0;video=1;midi=0}!
2020/11/25 22:50:35 [frame:3] Using 44100Hz audio, 25Hz video, 44100Hz master.
2020/11/25 22:50:35 [frame:3] Frame size must be a multiple of 1764 ticks = 1764 audio samples = 1 video samples.
2020/11/25 22:50:35 [frame:3] Targetting 'frame.duration': 0.04s = 1764 audio samples = 1764 ticks.
2020/11/25 22:50:35 [frame:3] Frames last 0.04s = 1764 audio samples = 1 video samples = 1764 ticks.
2020/11/25 22:50:35 [sandbox:3] Sandboxing disabled
2020/11/25 22:50:35 [video.converter:3] Using preferred video converter: gavl.
2020/11/25 22:50:35 [audio.converter:3] Using samplerate converter: ffmpeg.
2020/11/25 22:50:35 [mp3:3] Loading playlist...
2020/11/25 22:50:35 [mp3:3] Playlist is a directory.
2020/11/25 22:50:35 [mp3:3] Successfully loaded a playlist of 6 tracks.
2020/11/25 22:50:35 [single_7833:3] "./vid/img2_1.mp4" is static, resolving once for all...
2020/11/25 22:50:35 [clock.wallclock_main:2] Error when starting youtube: Req_simple.Invalid_URI!
2020/11/25 22:50:35 [clock.wallclock_main:3] Raised at file "sources/req_simple.ml", line 36, characters 56-73
2020/11/25 22:50:35 [clock.wallclock_main:3] Called from file "source.ml", line 413, characters 8-20
2020/11/25 22:50:35 [clock.wallclock_main:3] Called from file "operators/switch.ml", line 109, characters 10-21
2020/11/25 22:50:35 [clock.wallclock_main:3] Called from file "list.ml", line 110, characters 12-15
2020/11/25 22:50:35 [clock.wallclock_main:3] Called from file "source.ml", line 413, characters 8-20
2020/11/25 22:50:35 [clock.wallclock_main:3] Called from file "list.ml", line 110, characters 12-15
2020/11/25 22:50:35 [clock.wallclock_main:3] Called from file "source.ml", line 413, characters 8-20
2020/11/25 22:50:35 [clock.wallclock_main:3] Called from file "outputs/output.ml", line 134, characters 6-22
2020/11/25 22:50:35 [clock.wallclock_main:3] Called from file "source.ml", line 413, characters 8-20
2020/11/25 22:50:35 [clock.wallclock_main:3] Called from file "clock.ml", line 228, characters 16-27
2020/11/25 22:50:35 [youtube:1] Got ill-balanced activations (from youtube)!
2020/11/25 22:50:35 [clock:2] Error when leaving output youtube: File "source.ml", line 435, characters 12-18: Assertion failed!
2020/11/25 22:50:35 [clock:3] Raised at file "source.ml", line 435, characters 12-24
2020/11/25 22:50:35 [clock:3] Called from file "source.ml", line 440, characters 33-61
2020/11/25 22:50:35 [clock:3] Called from file "clock.ml", line 84, characters 6-13
2020/11/25 22:50:35 [main:3] Shutdown started!
2020/11/25 22:50:35 [main:3] Waiting for main threads to terminate...
2020/11/25 22:50:35 [main:3] Threads terminated.
2020/11/25 22:50:35 [threads:3] Shutting down scheduler...
2020/11/25 22:50:35 [decoder:3] Method "FFMPEG" accepted "./mp3/\208\176\208\191\208\176\208\178\208\191.mp3".
2020/11/25 22:50:35 [threads:3] Scheduler shut down.
2020/11/25 22:50:35 [threads:3] Waiting for queue threads to terminate...
2020/11/25 22:50:35 [threads:3] Queues shut down
2020/11/25 22:50:35 [main:3] Cleaning downloaded files...
2020/11/25 22:50:35 [main:3] Freeing memory...

ffprobe of mp4 file

ffprobe version 4.3.1-4ubuntu1 Copyright (c) 2007-2020 the FFmpeg developers
  built with gcc 10 (Ubuntu 10.2.0-9ubuntu2)
  configuration: --prefix=/usr --extra-version=4ubuntu1 --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-nvenc --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 './vid/img2_1.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42mp41
    creation_time   : 2020-11-25T11:12:31.000000Z
  Duration: 00:00:59.80, start: 0.000000, bitrate: 2022 kb/s
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 2019 kb/s, 25 fps, 25 tbr, 25k tbn, 50 tbc (default)
    Metadata:
      creation_time   : 2020-11-25T11:12:31.000000Z
      handler_name    : ?Mainconcept Video Media Handler
      encoder         : AVC Coding
smimram commented 3 years ago

The problem here comes from the fact that you are trying to decode the file with video only as indicated by

{audio=0;video=1;midi=0}

whereas it has audio. You should add

video=drop_audio(video)

to decode with audio and drop it. This should work on 2.0 though where we can drop audio if necessary.