Quicktime not playing a h264 aac encoded file - why? - compatibility

Quicktime says "This file isn't compatible with quicktime player" when I try to play an mp4 file.
The info shows the encoding as :
H.264, AAC, QuickTime Text
The file plays fine with VLC.
I need this file in my iTunes library so that I can stream it, hence the importance of this question.
Strange thing is I have other files with similar codes that QT can play fine.
How can I check why this file is incompatible?
Here is the log from ffprobe:
ffprobe test4.mp4
ffprobe version 4.2.1 Copyright (c) 2007-2019 the FFmpeg developers
built with Apple LLVM version 9.0.0 (clang-900.0.39.2)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.2.1_2 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags='-I/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/include/darwin' --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test4.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
title : Joker
encoder : Lavf58.29.100
Duration: 00:34:49.05, start: 0.000000, bitrate: 78 kb/s
Chapter #0:0: start 0.000000, end 602.942000
Metadata:
title : Chapter 10
Chapter #0:1: start 602.942000, end 1130.427000
Metadata:
title : Chapter 11
Chapter #0:2: start 1130.427000, end 1725.063000
Metadata:
title : Chapter 12
Chapter #0:3: start 1725.063000, end 2089.052000
Metadata:
title : Chapter 13
Stream #0:0(und): Video: h264 (High 10) (avc1 / 0x31637661), yuv420p10le, 1920x1080 [SAR 180:173 DAR 320:173], 2295 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 6 channels, fltp, 394 kb/s (default)
Metadata:
handler_name : SoundHandler
Stream #0:2(eng): Data: bin_data (text / 0x74786574)
Metadata:
handler_name : SubtitleHandler
Unsupported codec with id 100359 for input stream 2

Please try to add "-vf format=yuv420p".
I have the same issue, I have a video of
Stream #0:0(und): Video: hevc (Main) (hvc1 / 0x31637668), yuv420p10le(tv, bt709/unknown/unknown), 1170x2532, 2534 kb/s, 42.16 fps, 600 tbr, 600 tbn, 600 tbc (default)
And then I do:
ffmpeg -i in.mp4 -r 25 -vf scale=300x500 o.mp4
I got the o.mp4 as
Stream #0:0(und): Video: h264 (High 10) (avc1 / 0x31637661), yuv420p10le(tv, bt709/unknown/unknown), 300x500, 53 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
I can't play it with QT.
Then I changed to
ffmpeg -i in.mp4 -c:v libx264 -profile:v high10 -level:v 4.0 -vf scale=300:-1 -vf format=yuv420p o.mp4
The video is good now. I supposed "-vf format=yuv420p" is the crucial, and szatmary might be right, "QT can't play 10bits with High 10".
The final video is
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709/unknown/unknown), 1170x2532, 415 kb/s, 42.16 fps, 42.16 tbr, 2380950.00 tbn, 84.32 tbc (default)

Stream #0:0(und): Video: h264 (High 10) (avc1 / 0x31637661), yuv420p10le, 1920x1080 [SAR 180:173 DAR 320:173], 2295 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default)
Quicktime can not play 10 bit h.264, hence:
This file isn't compatible with quicktime player

Related

Decrypting fragmented mpeg-dash using ffmpeg

I have an mpeg-dash which I want to decrypt. I have the CENC decryption key. But I am unable to get it working. The dash uses segment template. Here is the dash
<?xml version="1.0" ?>
<MPD mediaPresentationDuration="PT1H55M53.987S" minBufferTime="PT6.00S" profiles="urn:mpeg:dash:profile:isoff-live:2011" type="static" xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:cenc="urn:mpeg:cenc:2013" xmlns:mspr="urn:microsoft:playready">
<!-- Created with Bento4 mp4-dash.py, VERSION=1.8.0-629 -->
<Period>
<!-- Video -->
<AdaptationSet maxHeight="720" maxWidth="1280" mimeType="video/mp4" segmentAlignment="true" startWithSAP="1">
<Accessibility schemeIdUri="urn:scte:dash:cc:cea-608:2015" value="eng"/>
<Viewpoint schemeIdUri="urn:mpeg:dash:role:2011" value="vp2"/>
<!-- MPEG Common Encryption -->
<ContentProtection cenc:default_KID="3cb715f2-4eac-cb21-a459-5c4a671dbb0a" schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc"/>
<!-- PlayReady -->
<ContentProtection schemeIdUri="urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95">
<mspr:pro>pAIAAAEAAQCaAjwAVwBSAE0ASABFAEEARABFAFIAIAB4AG0AbABuAHMAPQAiAGgAdAB0AHAAOgAvAC8AcwBjAGgAZQBtAGEAcwAuAG0AaQBjAHIAbwBzAG8AZgB0AC4AYwBvAG0ALwBEAFIATQAvADIAMAAwADcALwAwADMALwBQAGwAYQB5AFIAZQBhAGQAeQBIAGUAYQBkAGUAcgAiACAAdgBlAHIAcwBpAG8AbgA9ACIANAAuADAALgAwAC4AMAAiAD4APABEAEEAVABBAD4APABQAFIATwBUAEUAQwBUAEkATgBGAE8APgA8AEsARQBZAEwARQBOAD4AMQA2ADwALwBLAEUAWQBMAEUATgA+ADwAQQBMAEcASQBEAD4AQQBFAFMAQwBUAFIAPAAvAEEATABHAEkARAA+ADwALwBQAFIATwBUAEUAQwBUAEkATgBGAE8APgA8AEsASQBEAD4AOABoAFcAMwBQAEsAeABPAEkAYwB1AGsAVwBWAHgASwBaAHgAMgA3AEMAZwA9AD0APAAvAEsASQBEAD4APABDAEgARQBDAEsAUwBVAE0APgBBAGQARgAvAFEAcwBzAHEATQBhAEEAPQA8AC8AQwBIAEUAQwBLAFMAVQBNAD4APABMAEEAXwBVAFIATAA+AGgAdAB0AHAAOgAvAC8AcAByAC4AcwBlAHIAdgBpAGMAZQAuAGUAeABwAHIAZQBzAHMAcABsAGEAeQAuAGMAbwBtAC8AcABsAGEAeQByAGUAYQBkAHkALwBSAGkAZwBoAHQAcwBNAGEAbgBhAGcAZQByAC4AYQBzAG0AeAA8AC8ATABBAF8AVQBSAEwAPgA8AC8ARABBAFQAQQA+ADwALwBXAFIATQBIAEUAQQBEAEUAUgA+AA==</mspr:pro>
</ContentProtection>
<!-- Widevine -->
<ContentProtection schemeIdUri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed">
<cenc:pssh>AAAAQ3Bzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAACMIARIQPLcV8k6syyGkWVxKZx27ChoKaW50ZXJ0cnVzdCIBKg==</cenc:pssh>
</ContentProtection>
<SegmentTemplate duration="6000" initialization="$RepresentationID$/init.mp4" media="$RepresentationID$/seg-$Number$.m4s" startNumber="1" timescale="1000"/>
<Representation bandwidth="634478" codecs="avc1.4D401F" frameRate="2997/100" height="288" id="video/avc1/1" scanType="progressive" width="512"/>
<Representation bandwidth="789637" codecs="avc1.4D401F" frameRate="2997/100" height="360" id="video/avc1/2" scanType="progressive" width="640"/>
<Representation bandwidth="1562569" codecs="avc1.4D401F" frameRate="2997/100" height="432" id="video/avc1/3" scanType="progressive" width="768"/>
<Representation bandwidth="2124583" codecs="avc1.4D401F" frameRate="2997/100" height="720" id="video/avc1/4" scanType="progressive" width="1280"/>
</AdaptationSet>
<!-- Audio -->
<AdaptationSet lang="en" mimeType="audio/mp4" segmentAlignment="true" startWithSAP="1">
<!-- MPEG Common Encryption -->
<ContentProtection cenc:default_KID="3cb715f2-4eac-cb21-a459-5c4a671dbb0a" schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc"/>
<!-- PlayReady -->
<ContentProtection schemeIdUri="urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95">
<mspr:pro>pAIAAAEAAQCaAjwAVwBSAE0ASABFAEEARABFAFIAIAB4AG0AbABuAHMAPQAiAGgAdAB0AHAAOgAvAC8AcwBjAGgAZQBtAGEAcwAuAG0AaQBjAHIAbwBzAG8AZgB0AC4AYwBvAG0ALwBEAFIATQAvADIAMAAwADcALwAwADMALwBQAGwAYQB5AFIAZQBhAGQAeQBIAGUAYQBkAGUAcgAiACAAdgBlAHIAcwBpAG8AbgA9ACIANAAuADAALgAwAC4AMAAiAD4APABEAEEAVABBAD4APABQAFIATwBUAEUAQwBUAEkATgBGAE8APgA8AEsARQBZAEwARQBOAD4AMQA2ADwALwBLAEUAWQBMAEUATgA+ADwAQQBMAEcASQBEAD4AQQBFAFMAQwBUAFIAPAAvAEEATABHAEkARAA+ADwALwBQAFIATwBUAEUAQwBUAEkATgBGAE8APgA8AEsASQBEAD4AOABoAFcAMwBQAEsAeABPAEkAYwB1AGsAVwBWAHgASwBaAHgAMgA3AEMAZwA9AD0APAAvAEsASQBEAD4APABDAEgARQBDAEsAUwBVAE0APgBBAGQARgAvAFEAcwBzAHEATQBhAEEAPQA8AC8AQwBIAEUAQwBLAFMAVQBNAD4APABMAEEAXwBVAFIATAA+AGgAdAB0AHAAOgAvAC8AcAByAC4AcwBlAHIAdgBpAGMAZQAuAGUAeABwAHIAZQBzAHMAcABsAGEAeQAuAGMAbwBtAC8AcABsAGEAeQByAGUAYQBkAHkALwBSAGkAZwBoAHQAcwBNAGEAbgBhAGcAZQByAC4AYQBzAG0AeAA8AC8ATABBAF8AVQBSAEwAPgA8AC8ARABBAFQAQQA+ADwALwBXAFIATQBIAEUAQQBEAEUAUgA+AA==</mspr:pro>
</ContentProtection>
<!-- Widevine -->
<ContentProtection schemeIdUri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed">
<cenc:pssh>AAAAQ3Bzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAACMIARIQPLcV8k6syyGkWVxKZx27ChoKaW50ZXJ0cnVzdCIBKg==</cenc:pssh>
</ContentProtection>
<SegmentTemplate duration="6000" initialization="$RepresentationID$/init.mp4" media="$RepresentationID$/seg-$Number$.m4s" startNumber="1" timescale="1000"/>
<Representation audioSamplingRate="48000" bandwidth="136225" codecs="mp4a.40.2" id="audio/en/mp4a">
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
</Representation>
</AdaptationSet>
</Period>
</MPD>
I have produced an mp4 file by combining all the segments like this
init.mp4+seg-1.m4s+seg-2.m4s+....+seg-1159.m4s
But I end up with following error
ffmpeg version N-99631-g9018257751-anan5a-2020-10-19 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 8 (Debian 8.3.0-6)
configuration: --extra-version=anan5a-2020-10-19 --enable-gpl --enable-version3 --disable-shared --enable-static --enable-small --enable-avisynth --enable-chromaprint --enable-frei0r --enable-gmp --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-librtmp --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtesseract --enable-libtheora --enable-libtwolame --enable-libv4l2 --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libxml2 --enable-libzmq --enable-libzvbi --enable-lv2 --enable-openal --enable-opencl --enable-opengl --enable-libdrm --enable-nonfree --enable-libfdk-aac --enable-libbluray --enable-libzimg --enable-libsvtav1
libavutil 56. 60.100 / 56. 60.100
libavcodec 58.111.101 / 58.111.101
libavformat 58. 62.100 / 58. 62.100
libavdevice 58. 11.102 / 58. 11.102
libavfilter 7. 87.100 / 7. 87.100
libswscale 5. 8.100 / 5. 8.100
libswresample 3. 8.100 / 3. 8.100
libpostproc 55. 8.100 / 55. 8.100
[mov,mp4,m4a,3gp,3g2,mj2 # 0x557789b49300] Incorrect number of samples in encryption info
[mov,mp4,m4a,3gp,3g2,mj2 # 0x557789b49300] Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none, 512x288, 616 kb/s): unspecified pixel format
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '../videos/enc.0a7bd4e9ec72b6e0-5549.mkv':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41iso5iso6
Duration: 01:55:47.95, bitrate: 625 kb/s
Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), none, 512x288, 616 kb/s, SAR 1:1 DAR 16:9, 29.97 fps, 11988 tbr, 11988 tbn, 23976 tbc (default)
Metadata:
handler_name : Bento4 Video Handler
Side data:
unknown side data type 24 (779 bytes)
Output #0, matroska, to '../videos/dec.0a7bd4e9ec72b6e0-5549.mkv':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41iso5iso6
encoder : Lavf58.62.100
Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), none, 512x288 [SAR 1:1 DAR 16:9], q=2-31, 616 kb/s, 29.97 fps, 11988 tbr, 1k tbn, 11988 tbc (default)
Metadata:
handler_name : Bento4 Video Handler
Side data:
unknown side data type 24 (779 bytes)
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[mov,mp4,m4a,3gp,3g2,mj2 # 0x557789b49300] Incorrect number of samples in encryption info
../videos/enc.0a7bd4e9ec72b6e0-5549.mkv: Invalid data found when processing input
frame= 0 fps=0.0 q=-1.0 Lsize= 1kB time=00:00:00.00 bitrate=N/A speed= 0x
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
How can I achieve the decryption without error??
After some trial and error, I am able to solve this. It's not exactly as simple as joining the files. So here is my solution
The init.mp4 has to be used for every single segment to achieve decryption. So here is the solution
init.mp4+seg-1.m4s <-- now this can be decrypted
init.mp4+seg-2.m4s <-- this can be as well!
And finally merge them using ffmpeg copy mapping .

I am not able to create an RTMP stream using ffmpeg

I have set up an rtmp server using Nginx and that seems to be working fine. But when I try to create a RTMP stream using FFmpeg, it gets stuck at a frame and streaming doesn't work(just keeps buffering).
The FFmpeg command run:
ffmpeg -re -i CD_Final_compress.mp4 -vcodec copy -loop -1 -c:a aac -b:a 160k -ar 44100 -strict -2 -f flv rtmp://127.0.0.1/live/bbb
Output:
ffmpeg version N-98112-g7aa7d68 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
configuration: --prefix=/home/navneet/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/navneet/ffmpeg_build/include --extra-ldflags=-L/home/navneet/ffmpeg_build/lib --extra-libs='-lpthread -lm' --bindir=/home/navneet/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
libavutil 56. 53.100 / 56. 53.100
libavcodec 58. 92.100 / 58. 92.100
libavformat 58. 46.101 / 58. 46.101
libavdevice 58. 11.100 / 58. 11.100
libavfilter 7. 86.100 / 7. 86.100
libswscale 5. 8.100 / 5. 8.100
libswresample 3. 8.100 / 3. 8.100
libpostproc 55. 8.100 / 55. 8.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'CD_Final_compress.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.33.100
Duration: 00:17:33.85, start: 0.000000, bitrate: 521 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 386 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 126 kb/s (default)
Metadata:
handler_name : SoundHandler
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
Output #0, flv, to 'rtmp://127.0.0.1/live/bbb':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.46.101
Stream #0:0(und): Video: h264 (High) ([7][0][0][0] / 0x0007), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 386 kb/s, 30 fps, 30 tbr, 1k tbn, 15360 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) ([10][0][0][0] / 0x000A), 44100 Hz, stereo, fltp, 160 kb/s (default)
Metadata:
handler_name : SoundHandler
encoder : Lavc58.92.100 aac
frame= 1652 fps= 30 q=-1.0 size= 4895kB time=00:00:54.96 bitrate= 729.5kbits/s speed=0.999x
Note: I am running this on WSL 1 Ubuntu on Windows

ffmpeg error or success

I have a file sample.aif on which I want to apply the below filters :
Trim sample to a maximum duration of 2 seconds
Compression applied with settings : threshold 0.1,ratio=2,attack=5
20 milliseconds fade out at end .
I am running the below ffmpeg command : ffmpeg -i kick.aif -af atrim=0:120 -af acompressor=threshold=0.1:ratio=2:attack=5 -af afade=d=0.02 kick.ogg 2>error.out
When I check the return code I see it is 0 however my error. Out file has the below output :
cat error.out
ffmpeg version 2.8.14-0ubuntu0.16.04.1 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.9) 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.0 : stereo
Input #0, aiff, from 'kick.aif':
Duration: 00:00:01.54, start: 0.000000, bitrate: 3072 kb/s
Stream #0:0: Audio: pcm_f32be (fl32 / 0x32336C66), 48000 Hz, 2 channels, flt, 3072 kb/s
Output #0, ogg, to 'kick.ogg':
Metadata:
encoder : Lavf56.40.101
Stream #0:0: Audio: vorbis (libvorbis), 48000 Hz, stereo, fltp
Metadata:
encoder : Lavc56.60.100 libvorbis
Stream mapping:
Stream #0:0 -> #0:0 (pcm_f32be (native) -> vorbis (libvorbis))
Press [q] to stop, [?] for help
size= 6kB time=00:00:01.52 bitrate= 33.9kbits/s
video:0kB audio:2kB subtitle:0kB other streams:0kB global headers:4kB muxing overhead: 175.053040%
I am absolutely new to ffmpeg. Can someone tell me where I am going wrong ?
Many thanks in advance.
Multiple filters acting on a single input should be specified in the same filterchain, so
ffmpeg -i kick.aif -af atrim=0:120,acompressor=threshold=0.1:ratio=2:attack=5,afade=out:st=119.8:d=0.02 kick.ogg 2>error.out
Note that atrim is keeping the first two minutes. The afade needs to be set of type out, else it will fade-in, and its start time should be set to 20 ms before the end.

HLS files(.m3u8, .ts) does not created on nginx_rtmp_module

I want to treanscode RTSP to RTMP to HLS using ffmpeg and nginx_rtmp_module.
But HLS files(.m3u8, .ts) do not created.
I'm testing on Docker(amazonlinux image).
I can access and play rtmp://localhost:1935/live/camera1 by VLC Player, but can not access http://localhost:8088/live/camera1.m3u8.
docker run command:
docker run -it -p 8088:8088 -p 1935:1935 -v $(pwd):/tmp/share amazonlinux bash
nginx.conf:
user root;
worker_processes 1;
error_log /var/log/nginx/error.log debug;
events {
worker_connections 1024;
}
rtmp {
server {
listen 1935;
access_log /var/log/nginx/rtmp_access.log;
application live {
live on;
hls on;
hls_path /usr/local/nginx/html/hls;
hls_fragment 5s;
hls_type live;
hls_nested on;
}
}
}
http {
server {
listen 8088;
location / {
root /usr/local/nginx/html/;
}
location /hls {
types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
text/html html;
}
alias /usr/local/nginx/html/hls;
}
}
}
ffmpeg command: (using sample video rtsp://184.72.239.149/vod/mp4:BigBuckBunny_175k.mov)
nohup /root/ffmpeg_sources/ffmpeg/ffmpeg -i "rtsp://184.72.239.149/vod/mp4:BigBuckBunny_175k.mov" -f flv -s 320x240 -an "rtmp://localhost:1935/live/camera1" </dev/null &
ffmpeg version:
bash-4.2# /root/ffmpeg_sources/ffmpeg/ffmpeg -version
ffmpeg version N-90214-gdd3f1e3 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-11)
configuration: --prefix=/root/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/root/ffmpeg_build/include --extra-ldflags=-L/root/ffmpeg_build/lib --extra-libs=-lpthread --extra-libs=-lm --bindir=/root/bin --enable-gpl --enable-libx264 --enable-nonfree
libavutil 56. 8.100 / 56. 8.100
libavcodec 58. 13.102 / 58. 13.102
libavformat 58. 10.100 / 58. 10.100
libavdevice 58. 2.100 / 58. 2.100
libavfilter 7. 12.100 / 7. 12.100
libswscale 5. 0.102 / 5. 0.102
libswresample 3. 0.101 / 3. 0.101
libpostproc 55. 0.100 / 55. 0.100
nginx version: nginx version: nginx/1.13.9
nginx_rtmp_module version: nginx-rtmp-module-1.2.1
and directory permission:
bash-4.2# pwd
/usr/local/nginx/html
bash-4.2# ls -l
total 48
-rw-r--r-- 1 root root 537 Mar 5 07:24 50x.html
drwxrwxrwx 2 root root 4096 Mar 6 04:46 hls
-rw-r--r-- 1 root root 612 Mar 5 07:24 index.html
-rw------- 1 root root 36262 Mar 6 04:46 nohup.out
Help...
I Solved myself.
I found Incoming stream must be in H264/AAC. written in README.
So, I add -vcodec libx264 into the ffmpeg command:
nohup /root/ffmpeg_sources/ffmpeg/ffmpeg -stream_loop -1 -i "rtsp://184.72.239.149/vod/mp4:BigBuckBunny_175k.mov" -vcodec libx264 -f flv -s 320x240 -an "rtmp://localhost:1935/live/camera1" </dev/null &

working ffmpeg command fails when using in nginx with rtmp module

I have a tested code I did in a "bash" file. It works perfect on shell. I change only params to get it to work with nginx rtmp module, but ffmpeg says always and understandable error. This is the code:
exec_push ffmpeg -re -y -i rtmp://localhost:1935/live/$name \
-c:v libx264 -c:a aac \
-g 24 -keyint_min 24 -preset veryfast -tune zerolatency -movflags +faststart -vsync passthrough \
-filter_complex '[0:v]format=pix_fmts=yuv420p,split=3[in1][in2][in3];[in1]scale=320:-2[320x];[in2]scale=640:-2[HQ640x];[in3]scale=1280:-2[HD1280x];[0:a]aresample=44100[audio]' \
-map '[320x]' -profile:v baseline -level 3.0 -crf 31 -maxrate 170k -bufsize 170k -f mp4 rtmp://localhost:1935/rtmp_hls/$name_320x \
-map '[HQ640x]' -profile:v baseline -level 3.1 -crf 25 -maxrate 1000k -bufsize 1000k -f mp4 rtmp://localhost:1935/rtmp_hls/$name_HQ640x \
-map '[HD1280x]' -profile:v main -level 3.1 -crf 19 -maxrate 4000k -bufsize 4000k -f mp4 rtmp://localhost:1935/rtmp_hls/$name_HD1280x \
-map '[audio]' -b 128k -f mp4 rtmp://localhost:1935/rtmp_hls/$name_audio 2>>/var/www/html/ffmpeg-live-output-$name.log;
And this is the error launched by mmpeg
ffmpeg version 3.2.4-1~bpo8+1 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 4.9.2 (Debian 4.9.2-10)
configuration: --prefix=/usr --extra-version='1~bpo8+1' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --disable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librubberband --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-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
libavutil 55. 34.101 / 55. 34.101
libavcodec 57. 64.101 / 57. 64.101
libavformat 57. 56.101 / 57. 56.101
libavdevice 57. 1.100 / 57. 1.100
libavfilter 6. 65.100 / 6. 65.100
libavresample 3. 1. 0 / 3. 1. 0
libswscale 4. 2.100 / 4. 2.100
libswresample 2. 3.100 / 2. 3.100
libpostproc 54. 1.100 / 54. 1.100
[flv # 0x55e430547740] video stream discovered after head already parsed
[flv # 0x55e430547740] audio stream discovered after head already parsed
Input #0, flv, from 'rtmp://localhost:1935/live/directo':
Metadata:
Server : NGINX RTMP (github.com/sergey-dryabzhinsky/nginx-rtmp-module)
displayWidth : 1280
displayHeight : 720
fps : 24
profile :
level :
Duration: 00:00:00.00, start: 26.023000, bitrate: N/A
Stream #0:0: Video: h264 (Constrained Baseline), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], 24.42 fps, 24 tbr, 1k tbn, 48 tbc
Stream #0:1: Audio: aac (LC), 44100 Hz, mono, fltp
[NULL # 0x55e4305e0b40] Unable to find a suitable output format for '
'
: Invalid argument
Does anyone could help me?
Thank you
There's no need for line breaks \. Nginx usess regular expressions to parse the configuration:
exec_push ffmpeg line 1
line 2
...
line n;

Resources