unity-builder icon indicating copy to clipboard operation
unity-builder copied to clipboard

[iOS] Error while reading movie during project import

Open AytoMaximo opened this issue 2 years ago • 6 comments

Bug description

Hi! I have a simple test project, which should start a video play on my raw image component after app starts. However after CICD the video is gone and I've found the following log:

Start importing Assets/iPhone_final_1920x1080.mp4 using Guid(4a6cabe8c82444838bfda281abe35b82) Importer(-1,00000000000000000000000000000000) Error while reading movie: /github/workspace/Assets/iPhone_final_1920x1080.mp4 -> (artifact id: '64692c41f188253627aa45a741fde930') in 0.001871 seconds

MP4 file was added to LFS, if it is important.

My build pipeline:

name: AppStore CICD

on: workflow_dispatch

jobs:
  buildForiOSPlatform:
    name: Build for iOS
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        unityVersion:
          - 2021.3.16f1
        targetPlatform:
          - iOS

    steps:
      #Checkout (without LFS)
      - name: Checkout
        uses: actions/checkout@v2

      # Git LFS
      - name: Create LFS file list
        run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id

      - name: Restore LFS cache
        uses: actions/cache@v2
        id: lfs-cache
        with:
          path: .git/lfs
          key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}

      - name: Git LFS Pull
        run: |
          git lfs pull
          git add .
          git reset --hard    

      #Cache
      - name: Cache Library folder
        uses: actions/cache@v2
        with:
          path: Library
          key: Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }}
          restore-keys: |
            Library-     
      
      #Build
      - name: Build project
        uses: game-ci/unity-builder@v2
        env:
          UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
          UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
          UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
        with:
          unityVersion: ${{ matrix.unityVersion }}
          targetPlatform: ${{ matrix.targetPlatform }}
          allowDirtyBuild: true
          #customParameters: '-myParameter myValue -myBoolean -ThirdParameter andItsValue'
      
      #Output
      - name: Get Artefacts
        uses: actions/upload-artifact@v2
        with:
          name: build-iOS
          path: build/iOS

  releaseToAppStore:
    name: Release to the App Store
    runs-on: macos-latest
    needs: buildForiOSPlatform
    steps:
      - name: Checkout Repository
        uses: actions/checkout@v2

      - name: Download iOS Artifact
        uses: actions/download-artifact@v2
        with:
          name: build-iOS
          path: build/iOS

      - name: Fix File Permissions and Run fastlane
        env:
          APPLE_CONNECT_EMAIL: ${{ secrets.APPLE_CONNECT_EMAIL }}
          APPLE_DEVELOPER_EMAIL: ${{ secrets.APPLE_DEVELOPER_EMAIL }}
          APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}

          MATCH_REPOSITORY: ${{ secrets.MATCH_REPOSITORY }}
          MATCH_DEPLOY_KEY: ${{ secrets.MATCH_DEPLOY_KEY }}
          MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}

          APPSTORE_ISSUER_ID: ${{ secrets.APPSTORE_ISSUER_ID }}
          APPSTORE_KEY_ID: ${{ secrets.APPSTORE_KEY_ID }}
          APPSTORE_P8: ${{ secrets.APPSTORE_P8 }}

          IOS_BUILD_PATH: ${{ format('{0}/build/iOS', github.workspace) }}
          IOS_BUNDLE_ID: com.AytoMaximo.GameCI # Change it to match your Unity bundle id
          PROJECT_NAME: GameCI # Change it to match your project's name
        run: |
          eval "$(ssh-agent -s)"
          ssh-add - <<< "${MATCH_DEPLOY_KEY}"
          find $IOS_BUILD_PATH -type f -name "**.sh" -exec chmod +x {} \;
          bundle install
          bundle exec fastlane ios beta

      - name: Cleanup to avoid storage limit
        if: always()
        uses: geekyeggo/delete-artifact@v1
        with:
          name: build-iOS

How I can get to know what exactly is causing this error? Thank you in advance!

AytoMaximo avatar Jan 07 '23 16:01 AytoMaximo

I am aware this is an old post, but this issue still persists so in case anyone stumbles across this, here is the solution. The problem is that Unity does not support .mp4 formats on linux, which you are using as your hosted runner. See video file compatibility for reference. You can fix the issue by converting my .mp4 file into .webm format with vp8 codec. One way to achieve this is using ffmpeg, or directly recording in the desired format. Cheers!

SimonSchruff avatar Apr 16 '24 11:04 SimonSchruff

Hi, I'm still seeing this problem, although I'm building for MacOS, not Linux

mkingbonkers avatar Sep 11 '24 18:09 mkingbonkers

Hi, I'm also seeing the same issue. I'm wonder how to move over it without changing my movie format. Thanks, Felicia

feliciaAG avatar Sep 11 '24 18:09 feliciaAG

I'm encountering the same issue where my test project fails to play a video on a raw image component after the app starts, leading to the video being absent during the CICD process. The error log shows:

Start importing Assets/!/Art/Video/Pan Level 1 No Enemies.mp4 using Guid(14fcbdbb56c4bc442ba57afa182f1363) (VideoClipImporter) 

Error: Error while reading movie: /github/workspace/Assets/!/Art/Video/Pan Level 1 No Enemies.mp4.

Game-ci employs Docker images matching the target build platforms (Linux, MacOS, and Windows). The Docker host is Ubuntu, but the actual builds are performed on the appropriate platform-specific Docker images. Given this setup, could the issue still stem from platform-specific video file format support, or is there another potential cause for this error? Any insights or potential solutions would be greatly appreciated.

eproulx-bb avatar Sep 11 '24 18:09 eproulx-bb

I was able to work around the issue but it's still not great. The way I did it was to transform my MP4 video into a WEBM (with VP8 codec). I used this command: ffmpeg -i filename.mp4 -c:v libvpx -crf 4 -b:v 20M -an -b:a 64k -vbr on filename.webm

But this causes other issues. Now the video is very ugly when I build for Android (bluish with artifacts). I can't win.

How hard is it to add support for MP4 on the Ubuntu image??

eproulx-bb avatar Sep 27 '24 18:09 eproulx-bb

As alternative to transcoding to vp8, the link from https://github.com/game-ci/unity-builder/issues/488#issuecomment-2058890883 says you can place the videos in StreamingAssets and use VideoPlayer instead of VideoClip.

adabru avatar Nov 29 '24 17:11 adabru