I have a simple gif. I am not in general familiar with FFmpeg commands so I assume it's just my syntax being wrong, but what I'm using is straight from an answer here so I thought it would work.
I'm trying to add a delay on the last frame of my gif.
ffmpeg -i out.gif -vf tpad=stop_mode=clone:stop_duration=2 out2.gif
But I'm getting this when I try it:
ffmpeg version 3.4.11-0ubuntu0.1 Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
configuration: --prefix=/usr --extra-version=0ubuntu0.1 --toolchain=hardened - -libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enabl e-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-lib caca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreet ype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --en able-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enabl e-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-li bsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora -- enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enabl e-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --e nable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enabl e-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-f rei0r --enable-libopencv --enable-libx264 --enable-shared
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, gif, from 'out.gif':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: gif, bgra, 780x530, 6 fps, 15 tbr, 100 tbn, 100 tbc
Stream mapping:
Stream #0:0 -> #0:0 (gif (native) -> gif (native))
Press [q] to stop, [?] for help
[AVFilterGraph # 0x5609c471d520] No such filter: 'tpad'
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #0:0
Conversion failed!
Related
I'm trying to scale my input video to standard 1280x720 resolution, but my output looks blurred when compared to the input.
FFMPEG CMD
ffmpeg -i input.webm -filter_complex "[0:v] scale=1280.0:720.0 [v0]" -map [v0] output.webm
Input File FFProbe
ffprobe version 4.4.2 Copyright (c) 2007-2021 the FFmpeg developers
built with Apple clang version 13.1.6 (clang-1316.0.21.2.5)
configuration: --prefix='/opt/homebrew/Cellar/ffmpeg#4/4.4.2_3' --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-avresample --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
Input #0, matroska,webm, from 'input.webm':
Metadata:
ENCODER : Lavf58.76.100
Duration: 00:00:20.01, start: 0.000000, bitrate: 1929 kb/s
Stream #0:0: Video: vp9 (Profile 0), yuv420p(tv, bt470bg/bt709/bt709, progressive), 1512x982, SAR 1:1 DAR 756:491, 29.08 fps, 29.08 tbr, 1k tbn, 1k tbc (default)
Metadata:
ENCODER : Lavc58.134.100 libvpx-vp9
DURATION : 00:00:20.011000000
Output File FFProbe
ffprobe version 4.4.2 Copyright (c) 2007-2021 the FFmpeg developers
built with Apple clang version 13.1.6 (clang-1316.0.21.2.5)
configuration: --prefix='/opt/homebrew/Cellar/ffmpeg#4/4.4.2_3' --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-avresample --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
Input #0, matroska,webm, from 'output.webm':
Metadata:
ENCODER : Lavf58.76.100
Duration: 00:00:20.01, start: 0.000000, bitrate: 1699 kb/s
Stream #0:0: Video: vp9 (Profile 0), yuv420p(tv, bt470bg/bt709/bt709, progressive), 1280x720, SAR 1109:1280 DAR 1109:720, 29.08 fps, 29.08 tbr, 1k tbn, 1k tbc (default)
Metadata:
ENCODER : Lavc58.134.100 libvpx-vp9
DURATION : 00:00:20.011000000
Input Video:
Output Video:
I use MediaRecorder to record the audio from the browser and then upload it to my server (ARM-based Linux machine - AWS Lambda Function, if it matters). Based on the browser type, I get either an MP4 file (for the Safari browser) OR a WEBM file (for every other browser) from the MediaRecorder. The audio is converted to Base64 string and posted to my server with FFMPEG.
MediaRecorder implementation
const audioStream = await navigator.mediaDevices.getUserMedia(mediaConstraints);
const MediaRecorder = window['MediaRecorder'];
const mimeType = MediaRecorder.isTypeSupported('audio/webm') ? 'audio/webm' : 'audio/mp4';
const recordingFileExtension = MediaRecorder.isTypeSupported('audio/webm') ? 'webm' : 'mp4';
mediaRecorder = new MediaRecorder(audioStream, { mimeType });
mediaRecorder.ondataavailable = convertBlobAndUploadChunk;
mediaRecorder.start(30 * 1000); // timeslice needs to be in ms
// When user stops recording
mediaRecorder.stop();
audioStream.getTracks().forEach( t => { t.stop(); });
// To convert the audio blob to string
function convertBlobToBase64(blob) {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(blob);
reader.onload = () => {
const tmpStr = reader.result.toString();
resolve(tmpStr.substring(tmpStr.indexOf('base64,') + 7));
};
reader.onerror = error => reject(error);
});
}
let blobCount = 0;
async function convertBlobAndUploadChunk(blobEvent) {
if (!blobEvent.data || blobEvent.data.size === 0) return;
blobCount++;
const recordData = JSON.stringify({
M: {
blobCount,
//some other meta data
},
D: await convertBlobToBase64(audioBlob),
});
await angularHttpClient.post(apiUrl, recordData, new HttpHeaders({
'Content-Type': 'application/json',
'x-api-key': apiKey,
})).toPromise();
}
On my server, I convert the WEBM/MP4 file to an MP3 file for better cross-browser compatibility and to enable scrubbing.
Backend Lambda Implementation
const FFMpegCommand = require('fluent-ffmpeg'); // v2.1.2
new FFMpegCommand()
.input(originalFile)
.on('end', (error, stdOut, stdError) => {
if (error) {
console.error(error);
}
})
.save(convertedFile);
This works perfectly fine 99.9% of the time but FFMPEG throws one of the following errors for 0.1% of the time:
Error 1: Invalid data found when processing input
error reading header
ffmpeg version 4.4-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2021 the
FFmpeg developers
built with gcc 8 (Debian 8.3.0-6)
configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
[mov,mp4,m4a,3gp,3g2,mj2 # 0x7232f40] could not find corresponding trex (id 1)
[mov,mp4,m4a,3gp,3g2,mj2 # 0x7232f40] could not find corresponding track id 0
[mov,mp4,m4a,3gp,3g2,mj2 # 0x7232f40] trun track id unknown, no tfhd was found
[mov,mp4,m4a,3gp,3g2,mj2 # 0x7232f40] error reading header
/tmp/long-filename-of-140chars-to-keep-files-unique.mp4: Invalid data found when processing input
EBML Header parsing failed
ffmpeg version 4.4-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 8 (Debian 8.3.0-6)
configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
[matroska,webm # 0x7595f40] Format matroska,webm detected only with low score of 1, misdetection possible!
[matroska,webm # 0x7595f40] EBML header parsing failed
/tmp/long-filename-of-140chars-to-keep-files-unique.webm: Invalid data found when processing input
No specific details
ffmpeg version 4.4-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 8 (Debian 8.3.0-6)
configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
/tmp/long-filename-of-140chars-to-keep-files-unique.webm: Invalid data found when processing input
Error 2: Output file #0 does not contain any stream
ffmpeg version 4.4-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 8 (Debian 8.3.0-6)
configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
[mpegts # 0x5d19f40] Format mpegts detected only with low score of 2, misdetection possible!
[mpegts # 0x5d19f40] Could not detect TS packet size, defaulting to non-FEC/DVHS
Input #0, mpegts, from '/tmp/long-filename-of-140chars-to-keep-files-unique.webm':
Duration: N/A, bitrate: N/A
Output #0, mp3, to '/tmp/long-filename-of-140chars-to-keep-files-unique.mp3':
Output file #0 does not contain any stream
Thanks for reading, any help/suggestion is highly appreciated.
It's a little tricky to debug this without more code but I think Brad is on to something, sounds like the data isn't complete or mangled.
If it is corrupted data being ingested then you might want to consider putting something before the conversion to ensure that it is valid.
As a proof of concept I created this Dockerfile:
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update
RUN apt-get install -y ffmpeg
COPY valid.sh /valid.sh
RUN chmod 755 valid.sh
ENTRYPOINT [ "/valid.sh" ]
and created a file called valid.sh:
#!/bin/bash
export INPUT_FILE
export OUTPUT_FILE
echo Looking for ${INPUT_FILE} exporting to $OUTPUT_FILE
/usr/bin/ffmpeg -v error -i /input/${INPUT_FILE} -f null - 2>errors.log
if [[ $(cat errors.log) ]]; then
echo "Errors found! Source video isn't valid."
exit 1
fi
/usr/bin/ffmpeg -i /input/${INPUT_FILE} -vn -ab 128k -ar 44100 -y /output/${OUTPUT_FILE};
To run it:
docker build -t test ./
docker run -it --env INPUT_FILE=broken.webm --env OUTPUT_FILE=test123.mp3 --rm --name test -v C:/Users/me/Desktop/example:/input -v C:/Users/me/Desktop/output:/output test:latest
If the webm file is invalid it returns:
Looking for broken.webm exporting to test123.mp3
Errors found! Source video isn't valid.`
... otherwise:
Looking for working.webm exporting to test123.mp3
ffmpeg version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 11 (Ubuntu 11.2.0-19ubuntu1)
configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --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-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
Input #0, matroska,webm, from '/input/working.webm':
Metadata:
encoder : http://sourceforge.net/projects/yamka
creation_time : 2010-05-20T12:00:13.000000Z
Duration: 00:01:57.70, start: 0.000000, bitrate: 582 kb/s
Stream #0:0(eng): Video: vp8, yuv420p(progressive), 540x360, SAR 1:1 DAR 3:2, 23.98 fps, 23.98 tbr, 1k tbn, 1k tbc (default)
Stream #0:1(eng): Audio: vorbis, 44100 Hz, mono, fltp (default)
Stream mapping:
Stream #0:1 -> #0:0 (vorbis (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
Output #0, mp3, to '/output/test123.mp3':
Metadata:
TSSE : Lavf58.76.100
Stream #0:0(eng): Audio: mp3, 44100 Hz, mono, fltp, 128 kb/s (default)
Metadata:
encoder : Lavc58.134.100 libmp3lame
size= 1840kB time=00:01:57.71 bitrate= 128.1kbits/s speed= 209x
video:0kB audio:1840kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.024520%
Hi I am trying to capture desktop with ffmpeg gdigrab. I am using SSH connection to remotely use admin cmd on windows 10 pc. When i execute this command normally it works but remotely it doesnt.
ffmpeg -f gdigrab -framerate 30 -i desktop output.mkv
error message
ffmpeg version 4.4-essentials_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 10.2.0 (Rev6, 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 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
[gdigrab # 000001f3e781e600] Capturing whole desktop as 1024x768x32 at (0,0)
[gdigrab # 000001f3e781e600] Failed to capture image (error 5)
[gdigrab # 000001f3e781e600] Could not find codec parameters for stream 0 (Video: bmp, none, 754987 kb/s): unspecified size
Consider increasing the value for the 'analyzeduration' (15000000) and 'probesize' (70000000) options
Input #0, gdigrab, from 'desktop':
Duration: N/A, bitrate: 754987 kb/s
Stream #0:0: Video: bmp, none, 754987 kb/s, 30 fps, 1000k tbr, 1000k tbn, 1000k tbc
Output #0, matroska, to 'pipe:':
Output file #0 does not contain any stream
I tried to increase analyzeduration and probesize to max integer but it doesnt help.
While concatenating audio files with
ffmpeg -safe 0 -f concat
-segment_time_metadata 1
-i {m3u_file_name}
-vf select=concatdec_select
-af aselect=concatdec_select,aresample=async=1 {ogg_file_name}
I get the following output
ffmpeg version 3.4.8-0ubuntu0.2 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
configuration: --prefix=/usr --extra-version=0ubuntu0.2 --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-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --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-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
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, concat, from 'fm3u.m3u':
Duration: N/A, start: -0.006500, bitrate: N/A
Stream #0:0: Audio: opus, 48000 Hz, mono, fltp
Stream mapping:
Stream #0:0 -> #0:0 (opus (native) -> vorbis (libvorbis))
Press [q] to stop, [?] for help
Output #0, ogg, to 'fout.ogg':
Metadata:
encoder : Lavf57.83.100
Stream #0:0: Audio: vorbis (libvorbis), 48000 Hz, mono, fltp
Metadata:
encoder : Lavc57.107.100 libvorbis
[opus # 0x558b2c245400] Error parsing the packet header.
Error while decoding stream #0:0: Invalid data found when processing input
[opus # 0x558b2c245400] Error parsing the packet header.
Error while decoding stream #0:0: Invalid data found when processing input
[opus # 0x558b2c245400] Error parsing the packet header.
...
...
Error while decoding stream #0:0: Invalid data found when processing input
[opus # 0x558b2c245400] Error parsing the packet header.
Error while decoding stream #0:0: Invalid data found when processing input
size= 47kB time=00:00:10.84 bitrate= 35.2kbits/s speed=4.38x
video:0kB audio:42kB subtitle:0kB other streams:0kB global headers:3kB muxing overhead: 10.251080%
/fout.ogg
The final audio sounds good.
ffprobe on the 2 participating files looks like
# ffprobe <FILE>
ffprobe version 3.4.8-0ubuntu0.2 Copyright (c) 2007-2020 the FFmpeg developers
built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
configuration: --prefix=/usr --extra-version=0ubuntu0.2 --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-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --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-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
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, ogg, from 'f1.ogg':
Duration: 00:00:01.08, start: 0.000000, bitrate: 34 kb/s
Stream #0:0: Audio: opus, 48000 Hz, mono, fltp
# ffprobe <FILE>
ffprobe version 3.4.8-0ubuntu0.2 Copyright (c) 2007-2020 the FFmpeg developers
built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
configuration: --prefix=/usr --extra-version=0ubuntu0.2 --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-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --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-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
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, ogg, from 'f2.ogg':
Duration: 00:00:05.00, start: 0.000000, bitrate: 6 kb/s
Stream #0:0: Audio: vorbis, 48000 Hz, mono, fltp, 80 kb/s
Metadata:
ENCODER : Lavc57.107.100 libvorbis
What is the reason of the error?
As explained in this answer
"file-level concatenation (-f concat) requires all files in the listing to have the exact same codec parameters. "
In this case, the input files have codecs opus and vorbis.
To resolve the issue, I recreated some files (silence files) so they all have the same CODEC as the files I am mixing them with.
In particular, instead of creating them using:
ffmpeg -f lavfi -i anullsrc=r=48000:cl=mono -t 5.8 -c:a libvorbis silence-5.8.ogg
I use now (note libopus)
ffmpeg -f lavfi -i anullsrc=r=48000:cl=mono -t 5.8 -c:a libopus silence-5.8.ogg
And the "concat with ffmpeg" works without any problem.
I also tried
ffmpeg -f lavfi -i anullsrc=r=48000:cl=mono -t 5.8 -c:a opus silence-5.8.ogg
But that returns with
[opus # 0x5607f1765900] The encoder 'opus' is experimental but experimental codecs are not enabled, add '-strict -2' if you want to use it.
[opus # 0x5607f1765900] Alternatively use the non experimental encoder 'libopus'.
So, libopus works just fine (no need for opus)
I want decode the wma type file use the FFmpeg,
compiled it with options
--enable-decoder=wmav1 --enable-decoder=wmav2, --enable-encoder=wmav1, --enable-encoder=wmav2 --enable-demuxer=xwma
and the source code i use it like this:
av_register_all();
//avcodec_register_all();
if ((ret = avformat_open_input(&fmt_ctx, src_filename, 0, 0)) < 0) {
LOG("Could not open source file %s, ret:%d", src_filename, ret);
return;
}
if ((ret = avformat_find_stream_info(fmt_ctx, 0)) < 0) {
LOG("Could not find stream information---ret:%d", ret);
return;
}
and avformat_find_stream_info fail with ret:-541478725
and add ffmpeg -i <inputfile> commandline log:
D:\Downloads\ffmpeg-static\bin>ffmpeg.exe -i ring.wma
ffmpeg version N-76684-g1fe82ab Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 5.2.0 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --
enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-l
ibilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enab
le-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --en
able-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --ena
ble-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc
--enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enabl
e-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --
enable-lzma --enable-decklink --enable-zlib
libavutil 55. 6.100 / 55. 6.100
libavcodec 57. 15.100 / 57. 15.100
libavformat 57. 14.100 / 57. 14.100
libavdevice 57. 0.100 / 57. 0.100
libavfilter 6. 15.100 / 6. 15.100
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, asf, from 'ring.wma':
Metadata:
WMFSDKNeeded : 0.0.0.0000
DeviceConformanceTemplate: L3
WMFSDKVersion : 11.0.6001.7001
IsVBR : 0
PeakValue : 18081
AverageLevel : 1915
Duration: 00:00:07.80, start: 0.000000, bitrate: 206 kb/s
Stream #0:0: Audio: wmav2 (a[1][0][0] / 0x0161), 44100 Hz, 2 channels, fltp,
192 kb/s
any tips?
And which option must be include when i want to decode a special type file?
thank you.
You need --enable-demuxer=asf. xwma is a fringe format which isn't really used very much, wma audio is typically packed in the asf container. These files will still have the '.wma' extension.