livepeer / task-runner

Background service that executes tasks from the Livepeer API. Mainly used for VOD.
MIT License
4 stars 2 forks source link

Error Transcoding #21

Open anarkrypto opened 2 years ago

anarkrypto commented 2 years ago

Error Transcoding:

Using livepeer.com API: import task failed. error: error processing ffprobe output: too many tracks in file: 3

Using livepeer-trascode: Can't get info about file: 'aacparser: parse MPEG4AudioConfig failed(EOF)',

Video download: http://ftp.vim.org/ftp/ftp/pub/graphics/blender/demo/movies/BBB/bbb_sunflower_1080p_30fps_normal.mp4

MP4 Info:

File:
  major brand:      isom
  minor version:    1
  compatible brand: isom
  compatible brand: avc1
  fast start:       yes

Movie:
  duration:   634533 ms
  time scale: 600
  fragments:  no

Found 3 Tracks
Track 1:
  flags:        1 ENABLED
  id:           1
  type:         Video
  duration: 634533 ms
  language: und
  media:
    sample count: 19036
    timescale:    30000
    duration:     19036000 (media timescale units)
    duration:     634533 (ms)
    bitrate (computed): 2998.717 Kbps
  display width:  1920.000000
  display height: 1080.000000
  frame rate (computed): 30.000
  Sample Description 0
    Coding:      avc1 (H.264)
    Width:       1920
    Height:      1080
    Depth:       24
    AVC Profile:          100 (High)
    AVC Profile Compat:   0
    AVC Level:            41
    AVC NALU Length Size: 4
    AVC SPS: [67640029acca501e0089f970110000030001000003003c8f183196]
    AVC PPS: [68e93b2c8b]
    Codecs String: avc1.640029
Track 2:
  flags:        1 ENABLED
  id:           2
  type:         Audio
  duration: 634200 ms
  language: und
  media:
    sample count: 26425
    timescale:    48000
    duration:     30441600 (media timescale units)
    duration:     634200 (ms)
    bitrate (computed): 160.000 Kbps
  Sample Description 0
    Coding:      mp4a (MPEG-4 Audio)
    Stream Type: Audio
    Object Type: MPEG-1 Audio
    Max Bitrate: 165120
    Avg Bitrate: 160000
    Buffer Size: 480
    Sample Rate: 48000
    Sample Size: 16
    Channels:    2
Track 3:
  flags:        1 ENABLED
  id:           3
  type:         Audio
  duration: 634143 ms
  language: und
  media:
    sample count: 19817
    timescale:    48000
    duration:     30438912 (media timescale units)
    duration:     634144 (ms)
    bitrate (computed): 320.000 Kbps
  Sample Description 0
    Coding:      ac-3 (Dolby Digital (AC-3))
    Sample Rate: 48000
    Sample Size: 16
    Channels:    2
    AC-3 Data Rate: 32
    AC-3 Stream:
        fscod       = 0
        bsid        = 8
        bsmod       = 0
        acmod       = 7
        lfeon       = 1
    AC-3 dac3 payload: [103c00]
yondonfu commented 2 years ago

This issue seems to be related to the VOD task runner so I've moved this to the appropriate repo. If this is not the case, feel free to update accordingly.

victorges commented 2 years ago

So I actually had this same problem yesterday with a BBB video, first because it had 3 tracks, being 2 of them audio tracks. I've fixed this immediate issue here: https://github.com/livepeer/task-runner/pull/23 That's not currently in production yet, but we should be deploying it sometime this week.

The other issue, which you would encounter next with that file, is that we only support the AAC audio codec. So you would have to transcode your file audio to AAC instead, which can be one with ffmpeg as well. You can use a command like this, keeping all the audio tracks:

ffmpeg -i bbb_sunflower_1080p_30fps_normal.mp4 -map 0 -c:a aac -strict -2 -c:v copy -f mp4 bbb_1080p30fps_aac.mp4

While we don't deploy #23 to production, you can also remove one of the audio tracks from the file (as well as transcoding it to aac). For that, you can simply remove the -map 0 flag to the command above, running instead:

ffmpeg -i bbb_sunflower_1080p_30fps_normal.mp4 -c:a aac -strict -2 -c:v copy -f mp4 bbb_1080p30fps_aac_1.mp4

Transcoding audio is also much cheaper than video, so these commands should be relatively quick (26s for that file on my run) 😄

Let me know if this fixes your issues!