Home>

Emscripten used is emscripten 1.38.11.
As the title says, there is SimpleFFPlayer in GITHUB
This is
https://github.com/WanghongLin/SimpleFFPlayer
First of all, I downloaded it and built it as it was with UBUNTU.
If i read this CMakeLists.txt

cmake_minimum_required (VERSION 3.5.1)
project (SimpleFFPlayer)
set (CMAKE_CXX_STANDARD 11)
include (FindPkgConfig)
if (PkgConfig_FOUND)
    set (ENV {PKG_CONFIG_PATH} "$ENV {PKG_CONFIG_PATH}: $ENV {HOME}/Applications/ffmpeg/lib/pkgconfig: $ENV {HOME} /Applications/SDL2-2.0.4/lib/pkgconfig")
    message ("$ENV {PKG_CONFIG_PATH}")
    pkg_check_modules (FFMPEG REQUIRED libavformat libavcodec libavutil libswscale libswresample)
    if (FFMPEG_FOUND)
        include_directories (BEFORE SYSTEM ${FFMPEG_INCLUDE_DIRS})
        link_directories (${FFMPEG_LIBRARY_DIRS})
        link_libraries (${FFMPEG_LIBRARIES})
    endif (FFMPEG_FOUND)
    pkg_search_module (SDL2 REQUIRED sdl2)
    if (SDL2_FOUND)
        include_directories (BEFORE SYSTEM ${SDL2_INCLUDE_DIRS})
        link_directories (${SDL2_LIBRARY_DIRS})
        link_libraries (${SDL2_LIBRARIES})
    endif (SDL2_FOUND)
endif (PkgConfig_FOUND)
set (SOURCE_FILES main.cpp MediaFormat.cpp MediaInput.cpp MediaRender.cpp MediaUtils.cpp MediaUtils.h MediaFrame.cpp MediaFrame.h MediaFrameAvailableListener.cpp MediaFrameAvailableListener.h)
add_executable (SimpleFFPlayer ${SOURCE_FILES})
target_link_libraries (SimpleFFPlayer "pthread")


You can see using ffmpeg SDL2 pthread like this.
So SDL2 and pthread can be used with emscripten, so I thought I should manage ffmpeg.
What I did was
①Download the latest version of ffmpeg from GITHUB and build it with emscripten

emconfigure ./configure --cc = emcc --ar = emar --ranlib = emranlib --prefix = $(pwd) /../ dist --enable-cross-compile --target-os = none- -arch = x86_32 --cpu = generic --disable-stripping --enable-shared --disable-programs --disable-asm --disable-doc --disable-devices --disable-pthreads --disable-w32threads- -disable-network --disable-debug --disable-xlib --disable-zlib --disable-sdl2 --disable-iconv --disable-everything --enable-protocol = file --enable-decoder = hevc- enable-parser = hevc --enable-demuxer = hevc --enable-decoder = h264 --enable-parser = h264 --enable-demuxer = h264

make -j4
make install

* This argument is
https://github.com/ commaai/vidutil.js/blob/master/libs/ffmpeg/build.txt
From the park
② Change CMakeLists.txt
It looks like this

cmake_minimum_required (VERSION 3.5.1)
project (SimpleFFPlayer)
set (CMAKE_CXX_STANDARD 11)
set (CMAKE_C_FLAGS "-s USE_SDL = 2")
set (CMAKE_CXX_FLAGS "-s USE_SDL = 2")
include (FindPkgConfig)
if (PkgConfig_FOUND)
    set (ENV {PKG_CONFIG_PATH} "/ media/kokawa2003/2ef39caa-192e-4e36-8eed-1919c6c9791f/emscriptensample/dist/lib/pkgconfig")
    message ("$ENV {PKG_CONFIG_PATH}")
    pkg_check_modules (FFMPEG REQUIRED libavformat libavcodec libavutil libswscale libswresample)
    if (FFMPEG_FOUND)
        include_directories (BEFORE SYSTEM ${FFMPEG_INCLUDE_DIRS})
        link_directories (${FFMPEG_LIBRARY_DIRS})
        link_libraries (${FFMPEG_LIBRARIES})
    endif (FFMPEG_FOUND)
endif (PkgConfig_FOUND)
set (SOURCE_FILES main.cpp MediaFormat.cpp MediaInput.cpp MediaRender.cpp MediaUtils.cpp MediaUtils.h MediaFrame.cpp MediaFrame.h MediaFrameAvailableListener.cpp MediaFrameAvailableListener.h)
add_executable (SimpleFFPlayer ${SOURCE_FILES})
target_link_libraries (SimpleFFPlayer "pthread")



emcmake cmake ..
emmake make
Fortunately, I was able to compile and did WASM and JS, but not HTML.
Why is this?
What should I add to CMakeLists.txt?