I want to download a mp4 from m3u8 link using ffmpeg command.
ffmpeg -i https://hls.mediacdn.vn/vtv/2019/4/7/0704sao-mai-1554652229269816114782-af6d9.mp4/master.m3u8 -c copy -bsf:a aac_adtstoasc output1.mp4
But an error occurred when loading first segment
https://hls.mediacdn.vn/vtv/2019/4/7/0704sao-mai-1554652229269816114782-af6d9.mp4/720/seg-1-v1-a1.ts?v=664e3521
https://hls.mediacdn.vn/vtv/2019/4/7/0704sao-mai-1554652229269816114782-af6d9.mp4/master.m3u8: Invalid data found when processing input
Someone helps me to solve my problem. Thanks!
Full command
ffmpeg -i https://hls.mediacdn.vn/vtv/2019/4/7/0704sao-mai-1554652229269816114782-af6d9.mp4/master.m3u8 -c copy -bsf:a aac_adtstoasc output2.mp4ffmpeg version 4.1.1-0york1~16.04 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.11) 20160609
configuration: --prefix=/usr --extra-version='0york1~16.04' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-nonfree --enable-libfdk-aac --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
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
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
[hls,applehttp # 0x56551c942500] Opening 'https://hls.mediacdn.vn/vtv/2019/4/7/0704sao-mai-1554652229269816114782-af6d9.mp4/720.m3u8?v=664e3521' for reading
[https # 0x56551cd51280] Opening 'https://hls.mediacdn.vn/vtv/2019/4/7/0704sao-mai-1554652229269816114782-af6d9.mp4/480.m3u8?v=3f40a361' for reading
[https # 0x56551cd51280] Opening 'https://hls.mediacdn.vn/vtv/2019/4/7/0704sao-mai-1554652229269816114782-af6d9.mp4/360.m3u8?v=aefcb682' for reading
[https # 0x56551cd51280] Opening 'https://hls.mediacdn.vn/vtv/2019/4/7/0704sao-mai-1554652229269816114782-af6d9.mp4/240.m3u8?v=bda86a2a' for reading
[https # 0x56551cd51280] Opening 'https://hls.mediacdn.vn/vtv/2019/4/7/0704sao-mai-1554652229269816114782-af6d9.mp4/144.m3u8?v=431e8038' for reading
[hls,applehttp # 0x56551c942500] Opening 'https://kms.sohatv.vn/drm/55ceb3f8-4675-454a-bfc8-96cb04bbae8f.key' for reading
[hls,applehttp # 0x56551c942500] Opening 'crypto+https://hls.mediacdn.vn/vtv/2019/4/7/0704sao-mai-1554652229269816114782-af6d9.mp4/720/seg-1-v1-a1.ts?v=664e3521' for reading
[hls,applehttp # 0x56551c942500] Error when loading first segment 'https://hls.mediacdn.vn/vtv/2019/4/7/0704sao-mai-1554652229269816114782-af6d9.mp4/720/seg-1-v1-a1.ts?v=664e3521'
https://hls.mediacdn.vn/vtv/2019/4/7/0704sao-mai-1554652229269816114782-af6d9.mp4/master.m3u8: Invalid data found when processing input
The stream is encrypted, and the key is encoded in an obfuscated format. ffmepg will not be able to decrypt the stream.
Related
I have an .srt subtitle file. I want to convert it into .ttml format(or xml) using ffmpeg command. I tried using traditional way to convert this. But ffmpeg throwing an error. Is there any way to convert this in Linux platform? Or any other command line applications do this conversion?
Below is the command I tried.
ffmpeg -i my_srt.srt -y srt-to-xml.xml -v verbose
ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
configuration: --prefix=/usr --extra-version=1ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
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, srt, from 'my_srt.srt':
Duration: N/A, bitrate: N/A
Stream #0:0: Subtitle: subrip
Output #0, webm_dash_manifest, to 'srt-to-xml.xml':
Output file #0 does not contain any stream
[AVIOContext # 0x5614924ef500] Statistics: 22267 bytes read, 0 seeks
I even tried like below.
ffmpeg -i my_srt.srt -y srt_to_ttml.ttml
It didn't work too.
It looks like ffmpeg 4.4 has minimal support for converting srt into ttml: font styles and positions are not preserved.
ttconv is an alternative.
The FFmpeg TTML muxer uses the .ttml extension:
ffmpeg -i input.srt output.ttml
The TTML encoder and muxer do not have any additional options as of writing this answer (see ffmpeg -h encoder=ttml & ffmpeg -h muxer=ttml).
I have found and downloaded the m3u8 file using the developer tools in Edge. However, it won't play directly in VLC.
I then downloaded all the segments referred to in the m3u8 file as well as the key and put them in the same folder as ffmpeg. The partial contents of the m3u8 file are:
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:13
#EXT-X-MEDIA-SEQUENCE:1
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-KEY:METHOD=AES-128,URI="keyfile.txt",IV=0x00000000000000000000000000000001
#EXTINF:12,
seg-1-z.ts
#EXT-X-KEY:METHOD=AES-128,URI="keyfile.txt",IV=0x00000000000000000000000000000002
#EXTINF:12,
seg-2-z.ts
...
#EXT-X-KEY:METHOD=AES-128,URI="keyfile.txt",IV=0x0000000000000000000000000000013E
#EXTINF:8,
seg-318-z.ts
#EXT-X-ENDLIST
The keyfile.txt contents are: eyJwYXNzcGhyYXNlIjoiNjE0YjQ5NTYzYTdlYiIsImNpcGhlcnRleHQiOiJlamZOTWRSZjltY3Z4R1JRTFg2cVMralJJTmZaUGJyMXVyaFhhTVZ1QVptSUpXZVdYMkZLQ0t1Q0ZCYUQwY3FYIiwiaXYiOiIxZTNlNzg3ZjNjYmRlOGViZDdlZTBkNWVhZDA1NmEzNCIsInNhbHQiOiIwNjc3M2I1OWE1Y2IxZjA3ODdkYmEzZTAwYWZmNGIzNyJ9
This is what I get when I run ffmpeg:
C:\Test\download>ffmpeg -allowed_extensions ALL -i "play.m3u8" -c copy "test.ts"
ffmpeg version 2021-09-16-git-8f92a1862a-essentials_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 10.3.0 (Rev5, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
libavutil 57. 5.100 / 57. 5.100
libavcodec 59. 7.103 / 59. 7.103
libavformat 59. 5.100 / 59. 5.100
libavdevice 59. 0.101 / 59. 0.101
libavfilter 8. 9.100 / 8. 9.100
libswscale 6. 1.100 / 6. 1.100
libswresample 4. 0.100 / 4. 0.100
libpostproc 56. 0.100 / 56. 0.100
[hls # 000001c67608d140] Skip ('#EXT-X-VERSION:3')
[hls # 000001c67608d140] Opening 'keyfile.txt' for reading
[hls # 000001c67608d140] Opening 'crypto:seg-1-z.ts' for reading
[hls # 000001c67608d140] Error when loading first segment 'seg-1-z.ts'
play.m3u8: Invalid data found when processing input
Can anyone help? Thanks
I used the following command to transfer a rtsp stream to a .mp4 file:
ffmpeg -rtsp_transport tcp -timeout 5000000 -i "rtsp://zigong.stream.xl02.cn:557/HongTranSvr?DevId=1b038d27-858c-46a1-b803-a2984af343df&Session=1b038d27-858c-46a1-b803-a2984af343df" -vcodec copy -t 5 -y "capture.mp4"
The result is as below:
[rtsp # 0x5655577ccc00] Unable to open RTSP for listening
rtsp://zigong.stream.xl02.cn:557/HongTranSvr?DevId=1b038d27-858c-46a1-b803-a2984af343df&Session=1b038d27-858c-46a1-b803-a2984af343df: Cannot assign requested address
But it worded fine if I delete the timeout option...
the ffmpeg version is:
ffmpeg version 3.2.12-1~deb9u1 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
configuration: --prefix=/usr --extra-version='1~deb9u1' --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 --enable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --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
Try to update FFmpeg version and replace -timeout into -stimeout.
This issue was fixed a few months ago. [ref]
I am running ubuntu 18.04(bionic) and i have generated a live RTP stream from kurento-media-server and i am converting it to HLS with this command of ffmpeg:
ffmpeg -protocol_whitelist file,udp,rtp -i rtp://127.0.0.1:55000 -vcodec libx264 -acodec libfdk_aac -f hls /live-stream/kurento-rtmp/hls/playlist.m3u8
However. it shows this output and doesn't do anything and stays there. Any ideas why this is happening are really appreciated.
ffmpeg version 4.3.1-0york0~18.04 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
configuration: --prefix=/usr --extra-version='0york0~18.04' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libzimg --enable-pocketsphinx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
I believe that at this stage ffmpeg is trying to determine the duration of input stream but since it is live it will never finish. If so, how would i flag ffmpeg that it is a live stream and not a local video.
I solved the issue by using -re flag which slows down ffmpeg to not read the whole stream at once and get frame by frame however, i should have passed sdp file instead of rtp uri because it gives this error:
[rtp # 0x55bee6277180] Unable to receive RTP payload type 96 without an SDP file describing it
I am attempting to combine youtube-dl and ffmpeg to clip audio from YouTube videos. Everything was fine on my laptop, but when I moved to my server (Debian 9) I started coming across this error. Why is this? Am I missing a dependency ... if so which one?
Input
ffmpeg -f m4a $(youtube-dl -f bestaudio[ext=m4a] -g \'https://www.youtube.com/watch?v=qnjYyfkcaNI\' | sed "s/.*/-ss 0 -i &/") -to 60 -c copy -y /public/audio/test.m4a
Error
[NULL # 0x55cf161f1e60] Requested output format 'm4a' is not a
suitable output format /public/audio/test.m4a: Invalid argument
ffmpeg info
ffmpeg version 3.2.12-1~deb9u1 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
configuration: --prefix=/usr --extra-version='1~deb9u1' --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 --enable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-libopenmpt --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
The error was not with ffmpeg. The youtube-dl command was failing and resulting in the error.
Updated command
ffmpeg -f m4a $(youtube-dl -f bestaudio[ext=m4a] -g https://www.youtube.com/watch?v=qnjYyfkcaNI | sed "s/.*/-ss 0 -i &/") -to 60 -c copy -y /public/audio/test.m4a
Basically just had to remove the \'.
I also had to go one step further and give permission to the www-data apache group for the output folder since the command was being executed from a PHP script.