Skip to content
This repository has been archived by the owner on Jun 30, 2021. It is now read-only.

Capturing audio + video : issues with transcoding to mp4 #382

Open
olberger opened this issue May 2, 2020 · 2 comments
Open

Capturing audio + video : issues with transcoding to mp4 #382

olberger opened this issue May 2, 2020 · 2 comments

Comments

@olberger
Copy link
Contributor

olberger commented May 2, 2020

Trying to capture VIDEO=true and AUDIO=true, without setting VIDEO_FILE_EXTENSION, I get "Conversion from mkv to mp4 FAILED!".

video-rec: stopped
Waiting for video to stop recording...
video-rec                        STOPPED   May 02 11:56 PM
Done waiting for video recording to stop.
Video recording stopped
--LOG 23:56:08:920508761 -- DEBUG: video-rec-stdout.log ----
[matroska @ 0xe3a780] Non-monotonous DTS in output stream 0:1; previous: 32108, current: 32098; changing to 32108. This may result in incorrect timestamps in the output file.
frame=  786 fps= 25 q=12.0 size=    8460kB time=00:00:32.55 bitrate=2128.5kbits/s    
--LOG 23:55:59:105785670 Trapped SIGTERM or SIGINT so shutting down ffmpeg gracefully...
--LOG 23:55:59:108749290 Will kill VID_TOOL_PID=602 ...
frame=  787 fps= 25 q=-1.0 Lsize=    8495kB time=00:00:32.79 bitrate=2122.1kbits/s    
video:2713kB audio:5770kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.127703%
[libx264 @ 0xe3be60] frame I:4     Avg QP:12.75  size: 91980
[libx264 @ 0xe3be60] frame P:783   Avg QP:13.95  size:  3078
[libx264 @ 0xe3be60] mb I  I16..4: 100.0%  0.0%  0.0%
[libx264 @ 0xe3be60] mb P  I16..4:  0.8%  0.0%  0.0%  P16..4:  5.2%  0.0%  0.0%  0.0%  0.0%    skip:94.0%
[libx264 @ 0xe3be60] coded y,u,v intra: 17.2% 6.0% 6.1% inter: 2.9% 0.3% 0.4%
[libx264 @ 0xe3be60] i16 v,h,dc,p: 71% 22%  3%  4%
[libx264 @ 0xe3be60] kb/s:677.69
Exiting normally, received signal 2.
--LOG 23:56:00:113074916 Tried to kill -SIGTERM VID_TOOL_PID=602
--LOG 23:56:00:116045085 Waiting up to 6s for VID_TOOL_PID=602 to end with SIGTERM...
--LOG 23:56:00:121532331 wait_pid successfully managed to SIGTERM:VID_TOOL_PID=602 within less than 6s
--LOG 23:56:00:124471604 Will try to fix the videos...
--LOG 23:56:00:632576487 Fixing perms for /home/seluser/videos/vid_chrome_25550_firefox_25551.mkv*
--LOG 23:56:00:640358217 Changing video encoding from mkv to mp4...
--LOG 23:56:00:684710206 Conversion from mkv to mp4 FAILED! in within the 20s
--LOG 23:56:00:689320665 Optimizing /home/seluser/videos/vid_chrome_25550_firefox_25551.mp4 for HTTP streaming...
Error opening file /home/seluser/videos/vid_chrome_25550_firefox_25551.mp4: Invalid IsoMedia File
--LOG 23:56:00:698305142 MP4Box got errors meaning the mp4 video file is corrupted, trying again...
Error opening file /home/seluser/videos/vid_chrome_25550_firefox_25551.mp4: Invalid IsoMedia File
--LOG 23:56:01:705475517 MP4Box got errors meaning the mp4 video file is corrupted, trying again...
Error opening file /home/seluser/videos/vid_chrome_25550_firefox_25551.mp4: Invalid IsoMedia File
--LOG 23:56:02:712680879 MP4Box got errors meaning the mp4 video file is corrupted, trying again...
Error opening file /home/seluser/videos/vid_chrome_25550_firefox_25551.mp4: Invalid IsoMedia File
--LOG 23:56:03:723196156 MP4Box got errors meaning the mp4 video file is corrupted, trying again...
Error opening file /home/seluser/videos/vid_chrome_25550_firefox_25551.mp4: Invalid IsoMedia File
--LOG 23:56:04:730348893 MP4Box got errors meaning the mp4 video file is corrupted, trying again...
Error opening file /home/seluser/videos/vid_chrome_25550_firefox_25551.mp4: Invalid IsoMedia File
--LOG 23:56:05:737278273 MP4Box got errors meaning the mp4 video file is corrupted, trying again...
Error opening file /home/seluser/videos/vid_chrome_25550_firefox_25551.mp4: Invalid IsoMedia File
--LOG 23:56:06:745299741 MP4Box got errors meaning the mp4 video file is corrupted, trying again...
Error opening file /home/seluser/videos/vid_chrome_25550_firefox_25551.mp4: Invalid IsoMedia File
--LOG 23:56:07:752434314 MP4Box got errors meaning the mp4 video file is corrupted, trying again...
--LOG 23:56:08:693483986 Failed! to mp4box_retry.sh within 8s
--LOG 23:56:08:696664741 ffmpeg shutdown complete.
--LOG 23:56:08:924253355 -- DEBUG: video-rec-stderr.log ----
/usr/bin/start-video-rec.sh: line 93: kill: (602) - No such process
ffmpeg version 2.8.15-0ubuntu0.16.04.1 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.10) 20160609
  configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
Guessed Channel Layout for  Input Stream #0.1 : stereo
Input #0, matroska,webm, from '/home/seluser/videos/vid_chrome_25550_firefox_25551.mkv':
  Metadata:
    ENCODER         : Lavf56.40.101
  Duration: 00:00:32.79, start: 0.000000, bitrate: 2122 kb/s
    Stream #0:0: Video: h264 (High 4:4:4 Predictive), yuv444p, 1080x720, SAR 1:1 DAR 3:2, 24 fps, 24 tbr, 1k tbn, 48 tbc (default)
    Metadata:
      ENCODER         : Lavc56.60.100 libx264
      DURATION        : 00:00:32.792000000
    Stream #0:1: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s (default)
    Metadata:
      DURATION        : 00:00:32.644000000
[libx264 @ 0x1637740] using SAR=1/1
[libx264 @ 0x1637740] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0x1637740] profile Constrained Baseline, level 3.1
[libx264 @ 0x1637740] 264 - core 148 r2643 5c65704 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=24 scenecut=0 intra_refresh=0 rc=crf mbtree=0 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0
[aac @ 0x14cc960] The encoder 'aac' is experimental but experimental codecs are not enabled, add '-strict -2' if you want to use it.
grid

I think maybe this is related to the fact that in

ffmpeg -i ${tmp_video_path} -vcodec libx264 ${FFMPEG_CODEC_ARGS} ${final_video_path}; \
the options are FFMPEG_CODEC_ARGS in all cases, even if AUDIO is set, in which case, the original capture was actually done with FFMPEG_CODEC_VA_ARGS, or something alike

I'm not sure the raw audio can be converted to mp4 then. Maybe that's something completely different.
(this is a followup to #147 (comment))

@olberger
Copy link
Contributor Author

olberger commented May 2, 2020

A possible workaround can be to set -e FFMPEG_CODEC_ARGS="-vcodec libx264 -preset ultrafast -pix_fmt yuv420p -strict -2 -acodec aac"

olberger added a commit to olberger/bbb-downloader that referenced this issue May 2, 2020
Producing mkv works, and with the addition of -strict -2 -acodec aac to
the defaults of FFMPEG_CODEC_ARGS, it seems mp4 works too.

As mp4 is smaller, let's keep it then, even if it's a hack ;-)
@olberger
Copy link
Contributor Author

olberger commented May 3, 2020

Or, as advised by @v0idp in #147 (comment), -e FFMPEG_CODEC_ARGS="-vcodec libx265 -preset ultrafast -pix_fmt yuv420p -strict -2 -acodec aac"

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant