Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Invalid output video when using very short video and large number of threads #46

Open
nikhiljangra264 opened this issue Oct 19, 2024 · 6 comments
Labels
bug Something isn't working core Media processing component, the core C++ binary.

Comments

@nikhiljangra264
Copy link
Contributor

Describe the bug
When using a video that is very short for example 3 seconds and using threads greater then 3 the output video file doesn't run.

To Reproduce
Steps to reproduce the behavior:

  1. Using this youtube or any very short video, process
  2. Make sure using threads greater than length of video
  3. See output video file

Expected behavior
A valid video file

Logs and Debug Information
No error information showed.

System and software (please complete the following information):

  • OS: kali-linux
  • ffmpeg version 7.0.2-3 Copyright (c) 2000-2024 the FFmpeg developers built with gcc 14 (Debian 14.2.0-2)

Additional context
All settings are default.

@nikhiljangra264 nikhiljangra264 added bug Something isn't working triage labels Oct 19, 2024
@omeryusufyagci
Copy link
Owner

@nikhiljangra264 thanks for reporting this. I gave it a try and the playback was available in my case. However, the video is cut short perhaps by a second or so. So, indeed it seems we have an issue for very short videos, but I was not able to reproduce the problem exactly as you described.

@omeryusufyagci omeryusufyagci added core Media processing component, the core C++ binary. and removed triage labels Oct 19, 2024
@nikhiljangra264
Copy link
Contributor Author

nikhiljangra264 commented Oct 20, 2024

I guess you run in docker.
When i run in docker no issue occured It only occur when i run manually.
When I'm making unit test cases.

@omeryusufyagci
Copy link
Owner

Hi @nikhiljangra264, I just checked this, sorry for the delay. Unfortunately I couldn't reproduce this problem either way.

Could you confirm if uploads is populated by the processed files? Had ffmpeg failed, you'd seen the logs though. Perhaps give it a try by directly running it?

MediaProcessor/build/MediaProcessor uploads/test-video.ext

@nikhiljangra264
Copy link
Contributor Author

nikhiljangra264 commented Oct 29, 2024

Here is the command i manually runned which i guess is the problem or running with problem audio. It give me output audio of length 0 seconds.

Try to merge the processed audio generated using 10 threads.

invalid command

ffmpeg -y -i chunk_0.wav -i chunk_1.wav -i chunk_2.wav -i chunk_3.wav -i chunk_4.wav -i chunk_5.wav -i chunk_6.wav -i chunk_7.wav -i chunk_8.wav -i chunk_9.wav -filter_complex "[0:a][1:a]acrossfade=d=0.500000:c1=tri:c2=tri[a0]; [a0][2:a]acrossfade=d=0.500000:c1=tri:c2=tri[a1]; [a1][3:a]acrossfade=d=0.500000:c1=tri:c2=tri[a2]; [a2][4:a]acrossfade=d=0.500000:c1=tri:c2=tri[a3]; [a3][5:a]acrossfade=d=0.500000:c1=tri:c2=tri[a4]; [a4][6:a]acrossfade=d=0.500000:c1=tri:c2=tri[a5]; [a5][7:a]acrossfade=d=0.500000:c1=tri:c2=tri[a6]; [a6][8:a]acrossfade=d=0.500000:c1=tri:c2=tri[a7]; [a7][9:a]acrossfade=d=0.500000:c1=tri:c2=tri[a8]; [a8]amerge=inputs=1[outa]" -map "[outa]" -c:a pcm_s16le  -ar 48000 output.wav

ffmpeg -y -i chunk_0.wav -i chunk_1.wav -i chunk_2.wav -i chunk_3.wav -i chunk_4.wav -i chunk_5.wav -i chunk_6.wav -i chunk_7.wav -i chunk_8.wav -i chunk_9.wav -filter_complex "[0:a][1:a]acrossfade=d=0.500000:c1=tri:c2=tri[a0]; [a0][2:a]acrossfade=d=0.500000:c1=tri:c2=tri[a1]; [a1][3:a]acrossfade=d=0.500000:c1=tri:c2=tri[a2]; [a2][4:a]acrossfade=d=0.500000:c1=tri:c2=tri[a3]; [a3][5:a]acrossfade=d=0.500000:c1=tri:c2=tri[a4]; [a4][6:a]acrossfade=d=0.500000:c1=tri:c2=tri[a5]; [a5][7:a]acrossfade=d=0.500000:c1=tri:c2=tri[a6]; [a6][8:a]acrossfade=d=0.500000:c1=tri:c2=tri[a7]; [a7][9:a]acrossfade=d=0.500000:c1=tri:c2=tri[a8]; [a8]amerge=inputs=1[outa]" -map "[outa]" -c:a pcm_s16le -ar 48000 output.wav

and here is the output of the command

invalid command output

ffmpeg version 7.0.2-3 Copyright (c) 2000-2024 the FFmpeg developers
  built with gcc 14 (Debian 14.2.0-2)
  configuration: --prefix=/usr --extra-version=3 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --disable-libmfx --disable-omx --enable-gnutls --enable-libaom --enable-libass --enable-libbs2b --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libharfbuzz --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-openal --enable-opencl --enable-opengl --disable-sndio --enable-libvpl --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-ladspa --enable-libbluray --enable-libcaca --enable-libdvdnav --enable-libdvdread --enable-libjack --enable-libpulse --enable-librabbitmq --enable-librist --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libx264 --enable-libzmq --enable-libzvbi --enable-lv2 --enable-sdl2 --enable-libplacebo --enable-librav1e --enable-pocketsphinx --enable-librsvg --enable-libjxl --enable-shared
  libavutil      59.  8.100 / 59.  8.100
  libavcodec     61.  3.100 / 61.  3.100
  libavformat    61.  1.100 / 61.  1.100
  libavdevice    61.  1.100 / 61.  1.100
  libavfilter    10.  1.100 / 10.  1.100
  libswscale      8.  1.100 /  8.  1.100
  libswresample   5.  1.100 /  5.  1.100
  libpostproc    58.  1.100 / 58.  1.100
[aist#0:0/pcm_s16le @ 0x56007cebe4c0] Guessed Channel Layout: mono
Input #0, wav, from 'chunk_0.wav':
  Duration: 00:00:01.03, bitrate: 768 kb/s
  Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, mono, s16, 768 kb/s
[aist#1:0/pcm_s16le @ 0x56007cebe300] Guessed Channel Layout: mono
Input #1, wav, from 'chunk_1.wav':
  Duration: 00:00:01.03, bitrate: 768 kb/s
  Stream #1:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, mono, s16, 768 kb/s
[aist#2:0/pcm_s16le @ 0x56007cebe680] Guessed Channel Layout: mono
Input #2, wav, from 'chunk_2.wav':
  Duration: 00:00:01.03, bitrate: 768 kb/s
  Stream #2:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, mono, s16, 768 kb/s
[aist#3:0/pcm_s16le @ 0x56007cf0b680] Guessed Channel Layout: mono
Input #3, wav, from 'chunk_3.wav':
  Duration: 00:00:01.03, bitrate: 768 kb/s
  Stream #3:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, mono, s16, 768 kb/s
[aist#4:0/pcm_s16le @ 0x56007cf82c40] Guessed Channel Layout: mono
Input #4, wav, from 'chunk_4.wav':
  Duration: 00:00:01.03, bitrate: 768 kb/s
  Stream #4:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, mono, s16, 768 kb/s
[aist#5:0/pcm_s16le @ 0x56007cf678c0] Guessed Channel Layout: mono
Input #5, wav, from 'chunk_5.wav':
  Duration: 00:00:01.03, bitrate: 768 kb/s
  Stream #5:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, mono, s16, 768 kb/s
[aist#6:0/pcm_s16le @ 0x56007cfcedc0] Guessed Channel Layout: mono
Input #6, wav, from 'chunk_6.wav':
  Duration: 00:00:01.03, bitrate: 768 kb/s
  Stream #6:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, mono, s16, 768 kb/s
[aist#7:0/pcm_s16le @ 0x56007cf413c0] Guessed Channel Layout: mono
Input #7, wav, from 'chunk_7.wav':
  Duration: 00:00:01.03, bitrate: 768 kb/s
  Stream #7:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, mono, s16, 768 kb/s
[aist#8:0/pcm_s16le @ 0x56007d01af80] Guessed Channel Layout: mono
Input #8, wav, from 'chunk_8.wav':
  Duration: 00:00:01.03, bitrate: 768 kb/s
  Stream #8:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, mono, s16, 768 kb/s
[aist#9:0/pcm_s16le @ 0x56007cf8d340] Guessed Channel Layout: mono
Input #9, wav, from 'chunk_9.wav':
  Duration: 00:00:00.53, bitrate: 768 kb/s
  Stream #9:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, mono, s16, 768 kb/s
Stream mapping:
  Stream #0:0 (pcm_s16le) -> acrossfade
  Stream #1:0 (pcm_s16le) -> acrossfade
  Stream #2:0 (pcm_s16le) -> acrossfade
  Stream #3:0 (pcm_s16le) -> acrossfade
  Stream #4:0 (pcm_s16le) -> acrossfade
  Stream #5:0 (pcm_s16le) -> acrossfade
  Stream #6:0 (pcm_s16le) -> acrossfade
  Stream #7:0 (pcm_s16le) -> acrossfade
  Stream #8:0 (pcm_s16le) -> acrossfade
  Stream #9:0 (pcm_s16le) -> acrossfade
  amerge:default -> Stream #0:0 (pcm_s16le)
Press [q] to stop, [?] for help
[Parsed_amerge_9 @ 0x7f6520012540] No channel layout for input 1
[aost#0:0/pcm_s16le @ 0x56007cf8dc00] No filtered frames for output stream, trying to initialize anyway.
Output #0, wav, to 'output.wav':
  Metadata:
    ISFT            : Lavf61.1.100
  Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, mono, s16, 768 kb/s
      Metadata:
        encoder         : Lavc61.3.100 pcm_s16le
[out#0/wav @ 0x56007cf8d4c0] video:0KiB audio:0KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: unknown
[out#0/wav @ 0x56007cf8d4c0] Output file is empty, nothing was encoded(check -ss / -t / -frames parameters if used)
size=       0KiB time=N/A bitrate=N/A speed=N/A

@nikhiljangra264
Copy link
Contributor Author

nikhiljangra264 commented Oct 29, 2024

It says output file is empty
But i couldn't get the actual problem.
Please take a look.

@nikhiljangra264
Copy link
Contributor Author

nikhiljangra264 commented Oct 29, 2024

Here is the output of another command which generates valid output audio

Try to merge the processed audio generated using 3 threads

valid command

ffmpeg -y -i chunk_0.wav -i chunk_1.wav -i chunk_2.wav -filter_complex "[0:a][1:a]acrossfade=d=0.500000:c1=tri:c2=tri[a0]; [a0][2:a]acrossfade=d=0.500000:c1=tri:c2=tri[a1]; [a1]amerge=inputs=1[outa]" -map -"[outa]" -c:a pcm_s16le -ar 48000 output.wav

ffmpeg -y -i chunk_0.wav -i chunk_1.wav -i chunk_2.wav -filter_complex "[0:a][1:a]acrossfade=d=0.500000:c1=tri:c2=tri[a0]; [a0][2:a]acrossfade=d=0.500000:c1=tri:c2=tri[a1]; [a1]amerge=inputs=1[outa]" -map -"[outa]" -c:a pcm_s16le -ar 48000 output.wav

and here is the output

valid command output

ffmpeg version 7.0.2-3 Copyright (c) 2000-2024 the FFmpeg developers
  built with gcc 14 (Debian 14.2.0-2)
  configuration: --prefix=/usr --extra-version=3 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --disable-libmfx --disable-omx --enable-gnutls --enable-libaom --enable-libass --enable-libbs2b --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libharfbuzz --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-openal --enable-opencl --enable-opengl --disable-sndio --enable-libvpl --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-ladspa --enable-libbluray --enable-libcaca --enable-libdvdnav --enable-libdvdread --enable-libjack --enable-libpulse --enable-librabbitmq --enable-librist --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libx264 --enable-libzmq --enable-libzvbi --enable-lv2 --enable-sdl2 --enable-libplacebo --enable-librav1e --enable-pocketsphinx --enable-librsvg --enable-libjxl --enable-shared
  libavutil      59.  8.100 / 59.  8.100
  libavcodec     61.  3.100 / 61.  3.100
  libavformat    61.  1.100 / 61.  1.100
  libavdevice    61.  1.100 / 61.  1.100
  libavfilter    10.  1.100 / 10.  1.100
  libswscale      8.  1.100 /  8.  1.100
  libswresample   5.  1.100 /  5.  1.100
  libpostproc    58.  1.100 / 58.  1.100
[aist#0:0/pcm_s16le @ 0x56360ee36440] Guessed Channel Layout: mono
Input #0, wav, from 'chunk_0.wav':
  Duration: 00:00:02.35, bitrate: 768 kb/s
  Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, mono, s16, 768 kb/s
[aist#1:0/pcm_s16le @ 0x56360ee8f580] Guessed Channel Layout: mono
Input #1, wav, from 'chunk_1.wav':
  Duration: 00:00:02.35, bitrate: 768 kb/s
  Stream #1:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, mono, s16, 768 kb/s
[aist#2:0/pcm_s16le @ 0x56360eed49c0] Guessed Channel Layout: mono
Input #2, wav, from 'chunk_2.wav':
  Duration: 00:00:01.85, bitrate: 768 kb/s
  Stream #2:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, mono, s16, 768 kb/s
Stream mapping:
  Stream #0:0 (pcm_s16le) -> acrossfade
  Stream #1:0 (pcm_s16le) -> acrossfade
  Stream #2:0 (pcm_s16le) -> acrossfade
  amerge:default -> Stream #0:0 (pcm_s16le)
Press [q] to stop, [?] for help
[Parsed_amerge_2 @ 0x7f077c006f00] No channel layout for input 1
Output #0, wav, to 'output.wav':
  Metadata:
    ISFT            : Lavf61.1.100
  Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, mono, s16, 768 kb/s
      Metadata:
        encoder         : Lavc61.3.100 pcm_s16le
[out#0/wav @ 0x56360eed4bc0] video:0KiB audio:519KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 0.014664%
size=     520KiB time=00:00:05.54 bitrate= 768.1kbits/s speed=1.55e+03x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working core Media processing component, the core C++ binary.
Projects
None yet
Development

No branches or pull requests

2 participants