Codec h264_cuvid is not supported - ffmpeg

======================= Environment =======================
System: ubuntu 18.04
Architecture: x86_64
Display Card: NVIDIA GeForce 820m
Display Card Driver: NVIDIA-Linux-x86_64-390.87
gcc: 6.5.0
CUDA: 9.1.85 (also tried 9.0.176)
FFmpeg: 3.4 (also tried 4.0, 4.1)
==================== FFmpeg Compilation ====================
./configure \
--prefix="$DIR_BUILD" \
--bindir="$DIR_BIN" \
--enable-cuda \
--enable-cuvid \
--enable-nvenc \
--enable-nonfree \
--enable-libnpp \
--extra-cflags=-I/usr/local/cuda/include \
--extra-ldflags=-L/usr/local/cuda/lib64
======================= Verification =======================
Driver Verification:
(I have downgrade my gcc from 7.3 to 6.5, I don't know why there still shows gcc version 7.3)
$ cat /proc/driver/nvidia/version
NVRM version: NVIDIA UNIX x86_64 Kernel Module 390.87 Tue Aug 21 12:33:05 PDT 2018
GCC version: gcc version 7.3.0 (Ubuntu 7.3.0-27ubuntu1~18.04)
CUDA Verification:
$nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2017 NVIDIA Corporation
Built on Fri_Nov__3_21:07:56_CDT_2017
Cuda compilation tools, release 9.1, V9.1.85
$./deviceQuery
Rsult = PASS
$./bandwidthTest
Result = PASS
FFmpeg Decoder Verification:
$ ffmpeg -codecs | grep cuvid
ffmpeg version 3.4.5 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 6.5.0 (Ubuntu 6.5.0-2ubuntu1~18.04) 20181026
configuration: --prefix=/home/cavalry/Downloads/compile_ffmpeg/ffmpeg_build --bindir=/home/cavalry/Downloads/compile_ffmpeg/bin --enable-cuda --enable-cuvid --enable-nvenc --enable-nonfree --enable-libnpp --extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
DEV.LS h264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (decoders: h264 h264_v4l2m2m h264_vdpau h264_cuvid ) (encoders: h264_nvenc h264_v4l2m2m h264_vaapi nvenc nvenc_h264 )
DEV.L. hevc H.265 / HEVC (High Efficiency Video Coding) (decoders: hevc hevc_cuvid ) (encoders: nvenc_hevc hevc_nvenc hevc_vaapi )
DEVIL. mjpeg Motion JPEG (decoders: mjpeg mjpeg_cuvid ) (encoders: mjpeg mjpeg_vaapi )
DEV.L. mpeg1video MPEG-1 video (decoders: mpeg1video mpeg1video_vdpau mpeg1_v4l2m2m mpeg1_cuvid )
DEV.L. mpeg2video MPEG-2 video (decoders: mpeg2video mpegvideo mpegvideo_vdpau mpeg2_v4l2m2m mpeg2_cuvid ) (encoders: mpeg2video mpeg2_vaapi )
DEV.L. mpeg4 MPEG-4 part 2 (decoders: mpeg4 mpeg4_v4l2m2m mpeg4_vdpau mpeg4_cuvid ) (encoders: mpeg4 mpeg4_v4l2m2m )
D.V.L. vc1 SMPTE VC-1 (decoders: vc1 vc1_vdpau vc1_v4l2m2m vc1_cuvid )
DEV.L. vp8 On2 VP8 (decoders: vp8 vp8_v4l2m2m vp8_cuvid ) (encoders: vp8_v4l2m2m vp8_vaapi )
DEV.L. vp9 Google VP9 (decoders: vp9 vp9_v4l2m2m vp9_cuvid ) (encoders: vp9_vaapi )
FFmpeg Encoder Verification:
$ ffmpeg -codecs | grep nvenc
ffmpeg version 3.4.5 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 6.5.0 (Ubuntu 6.5.0-2ubuntu1~18.04) 20181026
configuration: --prefix=/home/cavalry/Downloads/compile_ffmpeg/ffmpeg_build --bindir=/home/cavalry/Downloads/compile_ffmpeg/bin --enable-cuda --enable-cuvid --enable-nvenc --enable-nonfree --enable-libnpp --extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
DEV.LS h264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (decoders: h264 h264_v4l2m2m h264_vdpau h264_cuvid ) (encoders: h264_nvenc h264_v4l2m2m h264_vaapi nvenc nvenc_h264 )
DEV.L. hevc H.265 / HEVC (High Efficiency Video Coding) (decoders: hevc hevc_cuvid ) (encoders: nvenc_hevc hevc_nvenc hevc_vaapi )
================== Exec ffmepg command line ===================
All things seem goes right, then I executed the following command:
ffmpeg -c:v h264_cuvid -i ./holidy.mp4 output.mkv
But it turns out:
[h264_cuvid # 0x55f93a512200] Codec h264_cuvid is not supported.
Here is the whole information:
$ ffmpeg -c:v h264_cuvid -i ./holidy.mp4 output.mkv
ffmpeg version 3.4.5 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 6.5.0 (Ubuntu 6.5.0-2ubuntu1~18.04) 20181026
configuration: --prefix=/home/cavalry/Downloads/compile_ffmpeg/ffmpeg_build --bindir=/home/cavalry/Downloads/compile_ffmpeg/bin --enable-cuda --enable-cuvid --enable-nvenc --enable-nonfree --enable-libnpp --extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './holidy.mp4':
Metadata:
major_brand : isom
minor_version : 1
compatible_brands: isomavc1iso6
creation_time : 2018-01-29T09:18:23.000000Z
album : Yinyuetai
artist : yinyuetai.com
comment : Yinyuetai-1TR1166
date : 01/29/18 17:18:23
Duration: 00:04:15.21, start: 0.000000, bitrate: 4210 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 4087 kb/s, 24 fps, 24 tbr, 24k tbn, 48 tbc (default)
Metadata:
creation_time : 2018-01-29T09:18:23.000000Z
handler_name : 264#GPAC0.5.1-DEV-rev5472
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 120 kb/s (default)
Metadata:
creation_time : 2018-01-29T09:17:31.000000Z
handler_name : Sound Media Handler
[h264_cuvid # 0x55f3e05ca1c0] Codec h264_cuvid is not supported.
Stream mapping:
Stream #0:0 -> #0:0 (h264 (h264_cuvid) -> mpeg4 (native))
Stream #0:1 -> #0:1 (aac (native) -> ac3 (native))
Error while opening decoder for input stream #0:0 : Invalid argument
I have tried width CUDA9.0, CUDA9.1, FFmpeg3.4, FFmpeg4.0, FFmpeg 4.1, but it reports the same error. Can anyone help me? I will appreciate you greatly !

According to Nvidia Video Encode and Decode GPU Support Matrix(snapshot),
GeForce 820m support NVENC & NVDEC. If my understanding is correct, a Nvidia graphic card that support NVENC & NVDEC should support h264_cuvid decoder in FFmpeg as well. So I think the answer of #halfelf was wrong.

Just give up.
Unfortunately, GeForce 820m is a Fermi based GPU without cuvid at all.

Related

converting eac3 to aac with ffmpeg

I have a number of video files stored on my Synology of which the audio doesn't play on when opening them with DS File. This is because DS File does not support eac3. I would like to convert those files to aac using ffmpeg, but when doing so, all audio is lost.
This is the file info:
Input #0, matroska,webm, from '<file>.mkv':
Metadata:
encoder : libebml v1.4.2 + libmatroska v1.6.4
Duration: 00:48:43.42, start: 0.000000, bitrate: 6566 kb/s
Stream #0:0: Video: h264 (High), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
Stream #0:1(eng): Audio: eac3, 48000 Hz, 5.1 (default)
Stream #0:2(eng): Subtitle: subrip
Metadata:
title : English [SDH]
Stream #0:3(ara): Subtitle: subrip
Metadata:
title : Arabic
Stream #0:4(chi): Subtitle: subrip
This is my attempt:
ffmpeg -i <file>.mkv -map 0:v -map 0:a:0 -map 0:s -c copy -c:a aac -b:a 640k output.mkv
Subtitles are kept, but audio is completely removed. I would like to automate the process if possible.
This is my ffmpeg configuration:
ffmpeg version 4.1.8 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 8.5.0 (GCC)
configuration: --prefix=/usr --incdir='${prefix}/include/ffmpeg' --arch=i686 --target-os=linux --cross-prefix=/usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu- --enable-cross-compile --enable-optimizations --enable-pic --enable-gpl --enable-shared --disable-static --disable-stripping --enable-version3 --enable-encoders --enable-pthreads --disable-protocols --disable-protocol=rtp --enable-protocol=file --enable-protocol=pipe --disable-muxer=image2 --disable-muxer=image2pipe --disable-swscale-alpha --disable-ffplay --disable-ffprobe --disable-doc --disable-devices --disable-bzlib --disable-altivec --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libmp3lame --disable-vaapi --disable-cuvid --disable-nvenc --disable-decoder=aac --disable-decoder=aac_fixed --disable-encoder=aac --disable-decoder=amrnb --disable-decoder=ac3 --disable-decoder=ac3_fixed --disable-encoder=zmbv --disable-encoder=dca --disable-decoder=dca --disable-encoder=ac3 --disable-encoder=ac3_fixed --disable-encoder=eac3 --disable-decoder=eac3 --disable-encoder=truehd --disable-decoder=truehd --disable-encoder=hevc_vaapi --disable-decoder=hevc --disable-muxer=hevc --disable-demuxer=hevc --disable-parser=hevc --disable-bsf=hevc_mp4toannexb --x86asmexe=yasm --cc=/usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-wrap-gcc --enable-yasm --enable-libx264 --enable-encoder=libx264
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
Synology does not support eac3 out of the box. So is this even possible?
Try adding channels for audio as well along side bit rate to the command line after aac.
for 5.1 audio add:
-ac 6 -b:a 384k
For stereo audio add:
-ac 2 -b:a 128k
The final command would be like
ffmpeg -i <file>.mkv -map 0:v -map 0:a:0 -map 0:s -c copy -c:a aac -ac 6 -b:a 640k output.mkv
Found it, I was apparently using the built-in ffmpeg, while I should be using the community package: https://synocommunity.com/packages
/path/to/ffmpeg -i "input.mkv" -map 0 -c:s copy -c:v copy -c:a ac3 -b:a 640k "output.mkv"

ffmpeg volume not work in complex filter

"volume" filter does not work in complex filter. The volume is not affected in the converted audio.
env: Mac OS 10.12.6
ffmpeg -i /path/bg.mp3 -y -filter_complex [0:0]volume=0[output] -map
[output] -acodec libmp3lame -write_xing 0 /path/mixed.mp3
full log =====================================================================
liqideMacBook-Pro:pinyin-api work$ ffmpeg -i
/Users/work/dev/codebase/pinyin/pinyin-api/test/resources/bg_audio2.mp3
-y -filter_complex [0:0]volume=0.1[output] -map [output] -acodec
libmp3lame -f mp3 -write_xing 0 /Users/work/dev/codebase/pinyin/pinyin-
api/test/resources/mixed3.mp3
ffmpeg version 3.4.1 Copyright (c) 2000-2017 the FFmpeg developers
built with Apple LLVM version 9.0.0 (clang-900.0.39.2)
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.4.1 --enable-
shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --
enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-
gpl --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-
opencl --enable-videotoolbox --disable-lzma
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libavresample 3. 7. 0 / 3. 7. 0
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100
Input #0, mp3, from '/Users/work/dev/codebase/pinyin/pinyin-
api/test/resources/bg_audio2.mp3':
Metadata:
title : 喜洋洋
album : 贺岁新年音乐会
encoder : Lavf56.4.101
Duration: 00:02:43.58, start: 0.025057, bitrate: 128 kb/s
Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16p, 128 kb/s
Stream mapping:
Stream #0:0 (mp3) -> volume
volume -> Stream #0:0 (libmp3lame)
Press [q] to stop, [?] for help
Output #0, mp3, to '/Users/work/dev/codebase/pinyin/pinyin-
api/test/resources/mixed3.mp3':
Metadata:
TIT2 : 喜洋洋
TALB : 贺岁新年音乐会
TSSE : Lavf57.83.100
Stream #0:0: Audio: mp3 (libmp3lame), 44100 Hz, stereo, fltp
Metadata:
encoder : Lavc57.107.100 libmp3lame
[libmp3lame # 0x7fad80001a00] Trying to remove 1152 samples, but the
queue is empty
size= 2556kB time=00:02:43.57 bitrate= 128.0kbits/s speed=51.7x
video:0kB audio:2556kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 0.003782%
liqideMacBook-Pro:pinyin-api work$
=====================================================================

thread_queue_size during Live Streaming from ffmpeg

I'm trying to stream a webcam stream froma RaspberryPi-B to Youtube. The webcam used is a Logitech C920. If I use the h264 stream from the camera itself, it works fine using
ffmpeg -f alsa -i hw:1,0 -f v4l2 -vcodec h264 -video_size 854x480 -r 25 -i /dev/video0 -acodec aac -b:a 64000 -ar 48000 -bufsize 64k -b:v 1200k -bufsize 1024k -maxrate 1800k -vcodec copy -g 60 -r 30 -f flv
rtmp://a.rtmp.youtube.com/live2/stream_here
So, for this to work with other non h264 cameras like the Pi Cam or any other cheaper webcam, it needs to work with the raw stream and get converted to h264 using libx264. This is the whole point of using the Pi. Hence the second command set.
ffmpeg -f alsa -ac 2 -i hw:1,0 -f v4l2 -i /dev/video0 -framerate 25 -video_size 1280x720 -c:v libx264 -preset veryfast -maxrate 1984k -bufsize 3968k -vf "format=yuv420p" -g 60 -c:a aac -b:a 128k -ar 44100 -f flv rtmp://a.rtmp.youtube.com/live2/stream_name
So this results in the following issue.
ffmpeg version git-2017-03-03-68ee800 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 4.9.2 (Raspbian 4.9.2-10)
configuration: --arch=armhf --target-os=linux --enable-gpl --enable-libx264 --enable-nonfree --extra-libs=-lasound --enable-pthreads
libavutil 55. 47.101 / 55. 47.101
libavcodec 57. 82.100 / 57. 82.100
libavformat 57. 66.103 / 57. 66.103
libavdevice 57. 3.100 / 57. 3.100
libavfilter 6. 74.100 / 6. 74.100
libswscale 4. 3.101 / 4. 3.101
libswresample 2. 4.100 / 2. 4.100
libpostproc 54. 2.100 / 54. 2.100
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, alsa, from 'hw:1,0':
Duration: N/A, start: 1488650966.446293, bitrate: 1024 kb/s
Stream #0:0: Audio: pcm_s16le, 32000 Hz, stereo, s16, 1024 kb/s
Input #1, video4linux2,v4l2, from '/dev/video0':
Duration: N/A, start: 2227.042654, bitrate: 159252 kb/s
Stream #1:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 864x480, 159252 kb/s, 24 fps, 24 tbr, 1000k tbn, 1000k tbc
Stream mapping:
Stream #1:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
Stream #0:0 -> #0:1 (pcm_s16le (native) -> aac (native))
Press [q] to stop, [?] for help
[video4linux2,v4l2 # 0x2e42310] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
Illegal instruction
pi#raspberrypi:~ $
If I add
thread_queue_size 512
I end up with
pi#raspberrypi:~ $ ffmpeg -f alsa -ac 2 -i hw:1,0 -f v4l2 -thread_queue_size 512 -i /dev/video0 -framerate 25 -video_size 1280x720 -c:v libx264 -preset veryfast -maxrate 1984k -bufsize 3968k -vf "format=yuv420p" -g 60 -c:a aac -b:a 128k -ar 44100 -f flv rtmp://a.rtmp.youtube.com/live2/zqg7-98wy-60b6-f2yx
ffmpeg version git-2017-03-03-68ee800 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 4.9.2 (Raspbian 4.9.2-10)
configuration: --arch=armhf --target-os=linux --enable-gpl --enable-libx264 --enable-nonfree --extra-libs=-lasound --enable-pthreads
libavutil 55. 47.101 / 55. 47.101
libavcodec 57. 82.100 / 57. 82.100
libavformat 57. 66.103 / 57. 66.103
libavdevice 57. 3.100 / 57. 3.100
libavfilter 6. 74.100 / 6. 74.100
libswscale 4. 3.101 / 4. 3.101
libswresample 2. 4.100 / 2. 4.100
libpostproc 54. 2.100 / 54. 2.100
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, alsa, from 'hw:1,0':
Duration: N/A, start: 1488651430.836193, bitrate: 1024 kb/s
Stream #0:0: Audio: pcm_s16le, 32000 Hz, stereo, s16, 1024 kb/s
Input #1, video4linux2,v4l2, from '/dev/video0':
Duration: N/A, start: 2691.407641, bitrate: 159252 kb/s
Stream #1:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 864x480, 159252 kb/s, 24 fps, 24 tbr, 1000k tbn, 1000k tbc
Stream mapping:
Stream #1:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
Stream #0:0 -> #0:1 (pcm_s16le (native) -> aac (native))
Press [q] to stop, [?] for help
Illegal instruction
pi#raspberrypi:~ $
Where exactly does
thread_queue_size
Belong?
Notes:
ffmpeg was built using this reference
–extra-libs=-lasound & --enable=pthreads was used
I totally forgot that the RaspberryPI had hardware support for H264.
So I followed this tutorial and we're live on 30% CPU usage with realtime streaming on the Raspberry Pi B (ARMV6).

Duration of source video and subtracted audio are different

The duration of source video and subtracted wav audio is different , why?
I'm recorgnizing subtitle from audio, and I need to add subtitle back to video. So I want the duration of audio and video the same.
ffmpeg -i http://cdn.live.360.cn/huikan_news/vod-media/_XW_203286B417B7C6466B3B_20160627185953.m3u8 -vn test.wav -y
My CLI:
[zhangpengcheng#mobiledev03v ifly]$ ffprobe http://cdn.live.360.cn/huikan_news/vod-media/_XW_203286B417B7C6466B3B_20160627185953.m3u8 2>&1 | grep Duration
Duration: 00:06:51.99, start: 1.400000, bitrate: 0 kb/s
[zhangpengcheng#mobiledev03v ifly]$ ffmpeg -i http://cdn.live.360.cn/huikan_news/vod-media/_XW_203286B417B7C6466B3B_20160627185953.m3u8 -vn test.wav -y
ffmpeg version 3.1.3 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-17)
configuration: --prefix=./build/ --enable-shared --enable-static --enable-libx264 --enable-avisynth --enable-libass --enable-libfdk-aac --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libopencv --enable-librtmp --enable-gpl --enable-nonfree
libavutil 55. 28.100 / 55. 28.100
libavcodec 57. 48.101 / 57. 48.101
libavformat 57. 41.100 / 57. 41.100
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 47.100 / 6. 47.100
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 1.100 / 2. 1.100
libpostproc 54. 0.100 / 54. 0.100
Input #0, hls,applehttp, from 'http://cdn.live.360.cn/huikan_news/vod-media/_XW_203286B417B7C6466B3B_20160627185953.m3u8':
Duration: 00:06:51.99, start: 1.400000, bitrate: 0 kb/s
Program 0
Metadata:
variant_bitrate : 0
Stream #0:0: Video: h264 (Baseline) ([27][0][0][0] / 0x001B), yuv420p(tv, smpte170m/bt709/bt709), 668x376, 15 tbr, 90k tbn, 180k tbc
Stream #0:1: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, mono, fltp, 65 kb/s
[wav # 0x10182e0] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Output #0, wav, to 'test.wav':
Metadata:
ISFT : Lavf57.41.100
Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, mono, s16, 705 kb/s
Metadata:
encoder : Lavc57.48.101 pcm_s16le
Stream mapping:
Stream #0:1 -> #0:0 (aac (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
size= 31904kB time=00:06:51.84 bitrate= 634.6kbits/s speed= 146x
video:0kB audio:31904kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000239%
[zhangpengcheng#mobiledev03v ifly]$ ffprobe test.wav 2>&1 | grep Duration
Duration: 00:06:10.40, bitrate: 705 kb/s
Looks like there are gaps in the original audio.
Use
ffmpeg -i http://cdn.live.360.cn/huikan_news/vod-media/_XW_203286B417B7C6466B3B_20160627185953.m3u8 -af aresample=async=1 -vn test.wav -y
The audio filter will fill in the gaps.

Detect rotation angle and rotate final video using ffmpeg version 2.8

I used to work on ffmpeg 2.2 until now and was detecting rotation angle of video uploaded from android / iPhone mobiles and rotate the resulting video so that it run perfectly on a correct angle.
But since I have updated the ffmpeg to version 2.8 I am getting this rotation problem. My queries are not rotating the videos as they were earlier.
Here'r the commands I was using:
To check rotation angle:
ffprobe -of json -show_streams {$input} | grep rotate
below is my final command to convert a video to mp4
"ffmpeg -i {$input} -strict -2 -vcodec libx264 -preset slow -vb 500k -maxrate 500k -bufsize 1000k -vf 'scale=-1:480 ".fix_video_orientation($input)."' -threads 0 -ab 64k -s {$resolution} -movflags faststart -metadata:s:v:0 rotate=0 {$output}";
"fix_video_orientation" function is given below. It detect the angle of rotation of the initial video and output optimal option for rotating the final video.
function fix_video_orientation($input){
$return= ", transpose=1 ";
$dd= exec("ffprobe -of json -show_streams {$input} | grep rotate");
if(!empty($dd)){
$dd=explode(":",$dd);
$rotate=str_replace(",","",str_replace('"',"",$dd[1]));
if($rotate=="90")return $return;
else if ($rotate=="180") return ", transpose=2,transpose=2 ";
else if($rotate == "270") return ", transpose=2 ";
}
Currently above script is supporting "flv","avi","mp4","mkv","mpg","wmv","asf","webm","mov","3gp","3gpp" extensions, also the script is supporting the resulting .mp4 file to play on all browsers and devices.
Now the ffprobe command is not returning rotation angle and so a portrait video if uploaded from iphone is showing as landscape on the website.
Output console of ffprobe command:
ffprobe version N-77455-g4707497 Copyright (c) 2007-2015 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04)
configuration: --extra-libs=-ldl --prefix=/opt/ffmpeg --mandir=/usr/share/man --enable-avresample --disable-debug --enable-nonfree --enable-gpl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb --enable-libpulse --enable-libdcadec --enable-libfreetype --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libvorbis --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr --enable-libxvid --enable-libvo-aacenc --enable-libvidstab
libavutil 55. 11.100 / 55. 11.100
libavcodec 57. 20.100 / 57. 20.100
libavformat 57. 20.100 / 57. 20.100
libavdevice 57. 0.100 / 57. 0.100
libavfilter 6. 21.101 / 6. 21.101
libavresample 3. 0. 0 / 3. 0. 0
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/standard/PORTRAIT.m4v':
Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
creation_time : 2016-02-03 05:25:18
com.apple.quicktime.make: Apple
com.apple.quicktime.model: iPhone 4S
com.apple.quicktime.software: 9.2.1
com.apple.quicktime.creationdate: 2016-02-03T10:52:11+0530
Duration: 00:00:03.34, start: 0.000000, bitrate: 7910 kb/s
Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 63 kb/s (default)
Metadata:
creation_time : 2016-02-03 05:25:18
handler_name : Core Media Data Handler
Stream #0:1(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 720x1280 [SAR 1:1 DAR 9:16], 7832 kb/s, 29.97 fps, 29.97 tbr, 600 tbn, 50 tbc (default)
Metadata:
creation_time : 2016-02-03 05:25:18
handler_name : Core Media Data Handler
encoder : H.264
Stream #0:2(und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
Metadata:
creation_time : 2016-02-03 05:25:18
handler_name : Core Media Data Handler
Stream #0:3(und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
Metadata:
creation_time : 2016-02-03 05:25:18
handler_name : Core Media Data Handler
Unsupported codec with id 0 for input stream 2
Unsupported codec with id 0 for input stream 3
If latest version of ffmpeg (2.8) is used to auto rotate the video, can you please suggest me what option I need to add or remove from my final command.
Try asking this in superuser.com.
ffmpeg -i in.mp4 -c copy -metadata:s:v:0 rotate=0 -an out.mp4
Source:
https://superuser.com/questions/1092951/how-to-delete-a-single-metadata-item-from-an-mp4-file

Resources