0

I am facing a problem which seems to be a common one; my recorded videos using ffmpeg on raspbian is not playable in any mobile browser (android and iphone).

ffmpeg -loglevel quiet -input_format mjpeg -i $1 -preset ultrafast video.mp4
  • $1 is /dev/video0

The output of ffprobe of the recorded video is:

ffprobe version 6.0-full_build-www.gyan.dev Copyright (c) 2007-2023 the FFmpeg developers
  built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libvpl --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
  libavutil      58.  2.100 / 58.  2.100
  libavcodec     60.  3.100 / 60.  3.100
  libavformat    60.  3.100 / 60.  3.100
  libavdevice    60.  1.100 / 60.  1.100
  libavfilter     9.  3.100 /  9.  3.100
  libswscale      7.  1.100 /  7.  1.100
  libswresample   4. 10.100 /  4. 10.100
  libpostproc    57.  1.100 / 57.  1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '..\videos\1_1.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf59.5.100
  Duration: 00:00:36.10, start: 0.016016, bitrate: 11896 kb/s
  Stream #0:0[0x1](und): Video: h264 (High 4:2:2) (avc1 / 0x31637661), yuvj422p(pc, bt470bg/unknown/unknown, progressive), 1920x1080, 11894 kb/s, 60 fps, 60 tbr, 15360 tbn (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]

I have already tried multiple possible solutions like pix_fmt etc but it didnt work. The device under /dev/video0 deliveres mjpeg.

Thank you very much in advance!

2 Answers 2

0

Supported media formats mentions a baseline profile, the ffmpeg encode command should have

-c:v libx264 -crf 23 -profile:v baseline -level 3.0 -pix_fmt yuv420p
0

please, try:

ffmpeg -loglevel quiet -input_format mjpeg -i "$1" -c:v libx264 -preset ultrafast -profile:v main -pix_fmt yuv420p -movflags +faststart video.mp4

explanation:

"$1" - the use of quotation marks to better handle whitespace in directory names and paths.

-c:v libx264 - to force the use of x264.

-profile:v main - to force compatibility with Android 6 or higher according to documentation provided by xer-rex

-pix_fmt yuv420p - to force the 8-bit color standard accepted on most devices.

-movflags +faststart - to move muxer information to the beginning of the file and thus allow "instant" execution in web scenarios.

see: ffmeg/h.264 jellyfin/codec-support android/supported-formats

_o/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.