FFmpeg videoeditor only works with audio and video available

Steps to reproduce

The ffmpeg command of the videoeditor uses a filter which needs audio [0:a]. So a video without audio will fail processing:

ffmpeg -y -i track.mov -filter_complex [0:v]trim=0.00:duration=10.44,setpts=PTS-STARTPTS,fade=t=in:st=0:d=2.0,fade=t=out:st=8.44:d=2.0[v0];[0:a]atrim=0.00:duration=10.44,asetpts=PTS-STARTPTS,afade=t=in:st=0:d=2.0,afade=t=out:st=8.44:d=2.0[a0] -strict -2 -preset veryfast -crf 18 -tune film -map [a0] -map [v0] -c:v libx264 -c:a aac work_track.mov.mp4

Make sure the ffmpeg command does only add the necessary audio/video filters if a audio or video track is available.

Activity

Show:
Greg Logan
June 8, 2015, 8:13 PM

Running org.opencastproject.videoeditor.ffmpeg.FFmpegTest
14:11:10 INFO (FFmpegEdit:121) - executing command: ffmpeg -y -i /home/gdl420/matterhorn/upstream/modules/matterhorn-videoeditor-ffmpeg-impl/target/test-classes/testresources/testvideo_320x180.mp4 -filter_complex [0:v]trim=0.00:duration=10.00,setpts=PTS-STARTPTS,fade=t=in:st=0:d=2.0,fade=t=out:st=8.00:d=2.0[v0];[0:a]atrim=0.00:duration=10.00,asetpts=PTS-STARTPTS,afade=t=in:st=0:d=2.0,afade=t=out:st=8.00:d=2.0[a0];[0:v]trim=25.00:duration=19.00,setpts=PTS-STARTPTS,fade=t=in:st=0:d=2.0,fade=t=out:st=17.00:d=2.0[v1];[0:a]atrim=25.00:duration=19.00,asetpts=PTS-STARTPTS,afade=t=in:st=0:d=2.0,afade=t=out:st=17.00:d=2.0[a1];[v0][v1]concat=n=2:unsafe=1[ov0];[a0][a1]concat=n=2:v=0:a=1[oa0] -strict -2 -preset faster -crf 18 -map [oa0] -map [ov0] /home/gdl420/matterhorn/upstream/modules/matterhorn-videoeditor-ffmpeg-impl/target/testoutput/mux.mp4
14:11:10 INFO (FFmpegEdit:131) - ffmpeg version 2.1.3 Copyright (c) 2000-2013 the FFmpeg developers
14:11:10 INFO (FFmpegEdit:131) - built on Apr 7 2015 11:51:01 with gcc 4.9.2 (Debian 4.9.2-10)
14:11:10 INFO (FFmpegEdit:131) - configuration: --prefix=/usr/local --enable-gpl --enable-version3 --enable-nonfree --disable-ffplay --disable-ffserver --extra-cflags='-I${LOCAL_PREFIX}/include' --extra-ldflags='-L${LOCAL_PREFIX}/lib -Wl,-rpath,${LOCAL_PREFIX}/lib' --enable-libxvid --extra-libs=-lxvidcore --enable-libx264 --extra-libs='-lx264 -lpthread' --enable-libmp3lame --extra-libs=-lmp3lame --enable-libfaac --extra-libs=-lfaac --enable-libvorbis --extra-libs=-lvorbis --enable-libtheora --extra-libs=-ltheora --enable-libvpx --extra-libs=-lvpx --enable-runtime-cpudetect
14:11:10 INFO (FFmpegEdit:131) - libavutil 52. 48.101 / 52. 48.101
14:11:10 INFO (FFmpegEdit:131) - libavcodec 55. 39.101 / 55. 39.101
14:11:10 INFO (FFmpegTest:109) - Ffmpeg concat 2 clips from 1 file OK!
14:11:11 INFO (FFmpegEdit:121) - executing command: ffmpeg -y -i /home/gdl420/matterhorn/upstream/modules/matterhorn-videoeditor-ffmpeg-impl/target/test-classes/testresources/testvideo_320x180.mp4 -i /home/gdl420/matterhorn/upstream/modules/matterhorn-videoeditor-ffmpeg-impl/target/test-classes/testresources/testvideo_320x180.mp4 -filter_complex [0:v]trim=0.00:duration=10.00,scale=320x180,setpts=PTS-STARTPTS,fade=t=in:st=0:d=2.0,fade=t=out:st=8.00:d=2.0[v0];[0:a]atrim=0.00:duration=10.00,asetpts=PTS-STARTPTS,afade=t=in:st=0:d=2.0,afade=t=out:st=8.00:d=2.0[a0];[1:v]trim=25.00:duration=19.00,scale=320x180,setpts=PTS-STARTPTS,fade=t=in:st=0:d=2.0,fade=t=out:st=17.00:d=2.0[v1];[1:a]atrim=25.00:duration=19.00,asetpts=PTS-STARTPTS,afade=t=in:st=0:d=2.0,afade=t=out:st=17.00:d=2.0[a1];[v0][v1]concat=n=2:unsafe=1[ov0];[a0][a1]concat=n=2:v=0:a=1[oa0] -strict -2 -preset faster -crf 18 -map [oa0] -map [ov0] /home/gdl420/matterhorn/upstream/modules/matterhorn-videoeditor-ffmpeg-impl/target/testoutput/mux.mp4
14:11:11 INFO (FFmpegEdit:131) - ffmpeg version 2.1.3 Copyright (c) 2000-2013 the FFmpeg developers
14:11:11 INFO (FFmpegEdit:131) - built on Apr 7 2015 11:51:01 with gcc 4.9.2 (Debian 4.9.2-10)
14:11:11 INFO (FFmpegEdit:131) - configuration: --prefix=/usr/local --enable-gpl --enable-version3 --enable-nonfree --disable-ffplay --disable-ffserver --extra-cflags='-I${LOCAL_PREFIX}/include' --extra-ldflags='-L${LOCAL_PREFIX}/lib -Wl,-rpath,${LOCAL_PREFIX}/lib' --enable-libxvid --extra-libs=-lxvidcore --enable-libx264 --extra-libs='-lx264 -lpthread' --enable-libmp3lame --extra-libs=-lmp3lame --enable-libfaac --extra-libs=-lfaac --enable-libvorbis --extra-libs=-lvorbis --enable-libtheora --extra-libs=-ltheora --enable-libvpx --extra-libs=-lvpx --enable-runtime-cpudetect
14:11:11 INFO (FFmpegEdit:131) - libavutil 52. 48.101 / 52. 48.101
14:11:11 INFO (FFmpegEdit:131) - libavcodec 55. 39.101 / 55. 39.101
14:11:12 INFO (FFmpegTest:133) - Ffmpeg concat 2 clips from 2 files OK!
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.539 sec - in org.opencastproject.videoeditor.ffmpeg.FFmpegTest
Running org.opencastproject.videoeditor.impl.VideoEditorTest
14:11:12 INFO (VideoEditorServiceImpl:211) - Start processing srcfile /home/gdl420/matterhorn/upstream/modules/matterhorn-videoeditor-ffmpeg-impl/target/test-classes/testresources/testvideo_320x180.mp4
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 2.577 sec <<< FAILURE! - in org.opencastproject.videoeditor.impl.VideoEditorTest
testAnalyze(org.opencastproject.videoeditor.impl.VideoEditorTest) Time elapsed: 2.456 sec <<< FAILURE!
java.lang.AssertionError: Audiovisual content expected
at org.junit.Assert.fail(Assert.java:88)
at org.junit.Assert.assertTrue(Assert.java:41)
at org.junit.Assert.assertNotNull(Assert.java:621)
at org.opencastproject.videoeditor.impl.VideoEditorTest.testAnalyze(VideoEditorTest.java:254)

Results :

Failed tests:
VideoEditorTest.testAnalyze:254 Audiovisual content expected

Greg Logan
June 12, 2015, 4:27 PM

Grabbing this to take it out of in-progress

Greg Logan
June 12, 2015, 4:28 PM

Fixes the issue, although it exposed several issues in the UI and workflows. Merged with e8a3fb6.

Assignee

Waldemar Smirnow

Reporter

Lukas Rohner

Severity

Non Functioning

Tags (folksonomy)

None

Components

Fix versions

Affects versions

Priority

Blocker
Configure