
Recherche avancée
Médias (1)
-
GetID3 - Bloc informations de fichiers
9 avril 2013, par
Mis à jour : Mai 2013
Langue : français
Type : Image
Autres articles (51)
-
Les autorisations surchargées par les plugins
27 avril 2010, parMediaspip core
autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs -
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir -
Support de tous types de médias
10 avril 2011Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)
Sur d’autres sites (9653)
-
Pushing on-fly transcoded video to embeded http results with no seekbar
11 juillet 2017, par BigRetroMikeI’m trying to achieve a simple home-based solution for streaming/transcoding video to low-end machine that is unable to play file properly.
I’m trying to do it with
ffmpeg
(asffserver
will be discontinued)
I found out that ffmpeg have build in http server that can be used for this.The application Im’ testing with (for
seekbar
) is vlcI’m probably doing something wrong here (or trying to do something that other does with other applications)
My ffmpeg code I use is :
d :\ffmpeg\bin\ffmpeg.exe -r 24 -i "D :\test.mkv" -threads 2 -vf
scale=1280:720 -c:v libx264 -preset medium -crf 20 -maxrate 1000k
-bufsize 2000k -c:a ac3 -seekable 1 -movflags faststart -listen 1 -f mpegts http://127.0.0.1:8080/test.mpegtsThis code also give me ability to start watching it when I want (as opposite to using rtmp via udp that would start video as soon as it transcode it)
I readed about moving
atoom
thing at file begging which should be handled bymovflags faststart
I also checked the
-re
option without any luck,-r 25
is just to suppress thePast duration 0.xx too large
warning which I read is normal thing.
test file is one from many ones with different encoder setting etc.The setting above give me a
seekbar
but it doesn’t work and no overall duration (and no progress bar), when I switch from mpegts to matroska/mkv I see duration of video (and progress) but no seekbar.If its possible with only ffmpeg I would prefer to stick to it as standalone solution without extra rtmp/others servers.
-
ffmpeg runs in terminal but returns error in subprocess.run from flatpak-installed pycharm
19 juin 2024, par nameI want to run this command in python :


ffmpeg -ss 00:00:30 -i "/home/exl/—1—ARCHIVE—1—/video/music videos/author --- a2 - name (text).webm" -vf scale=150:-2 -vframes 1 -c:v libwebp -compression_level 6 -quality 100 /home/exl/—1—ARCHIVE—1—/—3—previews—3—/734a8a0bac3a83e0f6c69416a26ec5cd211a6d742f3df63bb72bdbe6431b57c30677bc11551ba4aaaecac15ed2c48de51340a09020b7e9d9479e1e81ff766191.webp



In terminal it works fine, but in subprocess returns error. Python code :


finished_process = subprocess.run(
 [
 '/usr/bin/ffmpeg',
 '-ss', f'00:00:{seconds_shift}',
 '-i', original_path,
 '-vf', 'scale=150:-2',
 '-vframes', '1',
 '-c:v', 'libwebp',
 '-compression_level', '6',
 '-quality', '100',
 preview_path
 ],
 #stdout=subprocess.DEVNULL,
 #stderr=subprocess.DEVNULL,
 check=False,
 capture_output=True
 )



finished_process.stderr.decode()
:

ffmpeg version 5.0.1 Copyright (c) 2000-2022 the FFmpeg developers
 built with gcc 12.1.0 (GCC)
 configuration: --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu --disable-debug --disable-doc --disable-static --enable-optimizations --enable-shared --disable-everything --enable-ffplay --enable-ffprobe --enable-gnutls --enable-libaom --enable-libdav1d --enable-libfdk-aac --enable-libmp3lame --enable-libfontconfig --enable-libfreetype --enable-libopus --enable-libpulse --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-openal --enable-opengl --enable-sdl2 --enable-vulkan --enable-zlib --enable-libv4l2 --enable-libxcb --enable-vdpau --enable-vaapi --enable-encoder='ac3,alac,flac,libfdk_aac,g723_1,mp2,libmp3lame,libopus,libspeex,pcm_alaw,pcm_mulaw,pcm_f32le,pcm_s16be,pcm_s24be,pcm_s16le,pcm_s24le,pcm_s32le,pcm_u8,tta,libvorbis,wavpack,' --enable-encoder='ass,ffv1,libaom_av1,libvpx_vp8,libvpx_vp9,mjpeg_vaapi,rawvideo,theora,vp8_vaapi,libopenh264' --enable-decoder='adpcm_g722,alac,flac,g723_1,g729,libfdk_aac,libopus,libspeex,mp2,mp3,m4a,pcm_alaw,pcm_mulaw,pcm_f16le,pcm_f24le,pcm_f32be,pcm_f32le,pcm_f64be,pcm_f64le,pcm_s16be,pcm_s16be_planar,pcm_s24be,pcm_s16le,pcm_s16le_planar,pcm_s24le,pcm_s24le_planar,pcm_s32le,pcm_s32le_planar,pcm_s64be,pcm_s64le,pcm_s8,pcm_s8_planar,pcm_u8,pcm_u24be,pcm_u24le,pcm_u32be,pcm_u32le,tta,vorbis,wavpack,' --enable-decoder='ass,ffv1,mjpeg,mjpegb,libaom_av1,libdav1d,libvpx_vp8,libvpx_vp9,rawvideo,theora,vp8,vp9,libopenh264' --enable-encoder='bmp,gif,jpegls,png,tiff,webp,' --enable-decoder='bmp,gif,jpegls,png,tiff,webp,' --enable-hwaccel='vp8_vaapi,mjpeg_vaapi,' --enable-parser='aac,ac3,flac,mjpeg,mpegaudio,mpeg4video,opus,vp3,vp8,vp9,vorbis,' --enable-muxer='ac3,ass,flac,g722,gif,matroska,mp3,mpegvideo,rtp,ogg,opus,pcm_s16be,pcm_s16le,wav,webm,' --enable-demuxer='aac,ac3,ass,flac,g722,gif,image_jpeg_pipe,image_png_pipe,image_webp_pipe,matroska,mjpeg,mov,mp3,mpegvideo,ogg,pcm_mulaw,pcm_alaw,pcm_s16be,pcm_s16le,rtp,wav,' --enable-filter='crop,scale,overlay,amix,amerge,aresample,format,aformat,fps,transpose,pad,' --enable-indev='v4l2,xcbgrab,' --enable-protocol='crypto,file,pipe,rtp,srtp,rtsp,tcp,udp,unix,' --arch=x86_64 --enable-libopenh264
 libavutil 57. 17.100 / 57. 17.100
 libavcodec 59. 18.100 / 59. 18.100
 libavformat 59. 16.100 / 59. 16.100
 libavdevice 59. 4.100 / 59. 4.100
 libavfilter 8. 24.100 / 8. 24.100
 libswscale 6. 4.100 / 6. 4.100
 libswresample 4. 3.100 / 4. 3.100
Input #0, matroska,webm, from '/home/exl/—1—ARCHIVE—1—/video/music videos/author --- a2 - name (text).webm':
 Metadata:
 ENCODER : Lavf59.16.100
 Duration: 00:03:24.98, start: -0.007000, bitrate: 915 kb/s
 Stream #0:0(eng): Video: vp9 (Profile 0), yuv420p(tv, bt709), 1920x1036, SAR 1:1 DAR 480:259, 25 fps, 25 tbr, 1k tbn (default)
 Metadata:
 DURATION : 00:03:24.960000000
 Stream #0:1(eng): Audio: opus, 48000 Hz, stereo, s16 (default)
 Metadata:
 DURATION : 00:03:24.981000000
[NULL @ 0x55dd82de7d00] Unable to find a suitable output format for '/home/exl/—1—ARCHIVE—1—/—3—previews—3—/734a8a0bac3a83e0f6c69416a26ec5cd211a6d742f3df63bb72bdbe6431b57c30677bc11551ba4aaaecac15ed2c48de51340a09020b7e9d9479e1e81ff766191.webp'
/home/exl/—1—ARCHIVE—1—/—3—previews—3—/734a8a0bac3a83e0f6c69416a26ec5cd211a6d742f3df63bb72bdbe6431b57c30677bc11551ba4aaaecac15ed2c48de51340a09020b7e9d9479e1e81ff766191.webp: Invalid argument




As suggested here (FFMPEG command runs in terminal but not by subprocess) i tried using
which
determine path to correct version, but this command returns/usr/bin/ffmpeg
both in python and in terminal.

which ffmpeg
(bothsubprocess.run(['which', 'ffmpeg'], capture_output=True).stdout
and terminal) :/usr/bin/ffmpeg


ffmpeg -version
: 5.1.1-1ubuntu1

ffmpeg version 5.1.1-1ubuntu1 Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 12 (Ubuntu 12.2.0-1ubuntu1)
configuration: --prefix=/usr --extra-version=1ubuntu1 --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-libglslang --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librist --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --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 --disable-sndio --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-libplacebo --enable-shared



subprocess.run(['ffmpeg', '-version'], capture_output=True).stdout.decode()
: 5.0.1

ffmpeg version 5.0.1 Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 12.1.0 (GCC)
configuration: --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu --disable-debug --disable-doc --disable-static --enable-optimizations --enable-shared --disable-everything --enable-ffplay --enable-ffprobe --enable-gnutls --enable-libaom --enable-libdav1d --enable-libfdk-aac --enable-libmp3lame --enable-libfontconfig --enable-libfreetype --enable-libopus --enable-libpulse --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-openal --enable-opengl --enable-sdl2 --enable-vulkan --enable-zlib --enable-libv4l2 --enable-libxcb --enable-vdpau --enable-vaapi --enable-encoder='ac3,alac,flac,libfdk_aac,g723_1,mp2,libmp3lame,libopus,libspeex,pcm_alaw,pcm_mulaw,pcm_f32le,pcm_s16be,pcm_s24be,pcm_s16le,pcm_s24le,pcm_s32le,pcm_u8,tta,libvorbis,wavpack,' --enable-encoder='ass,ffv1,libaom_av1,libvpx_vp8,libvpx_vp9,mjpeg_vaapi,rawvideo,theora,vp8_vaapi,libopenh264' --enable-decoder='adpcm_g722,alac,flac,g723_1,g729,libfdk_aac,libopus,libspeex,mp2,mp3,m4a,pcm_alaw,pcm_mulaw,pcm_f16le,pcm_f24le,pcm_f32be,pcm_f32le,pcm_f64be,pcm_f64le,pcm_s16be,pcm_s16be_planar,pcm_s24be,pcm_s16le,pcm_s16le_planar,pcm_s24le,pcm_s24le_planar,pcm_s32le,pcm_s32le_planar,pcm_s64be,pcm_s64le,pcm_s8,pcm_s8_planar,pcm_u8,pcm_u24be,pcm_u24le,pcm_u32be,pcm_u32le,tta,vorbis,wavpack,' --enable-decoder='ass,ffv1,mjpeg,mjpegb,libaom_av1,libdav1d,libvpx_vp8,libvpx_vp9,rawvideo,theora,vp8,vp9,libopenh264' --enable-encoder='bmp,gif,jpegls,png,tiff,webp,' --enable-decoder='bmp,gif,jpegls,png,tiff,webp,' --enable-hwaccel='vp8_vaapi,mjpeg_vaapi,' --enable-parser='aac,ac3,flac,mjpeg,mpegaudio,mpeg4video,opus,vp3,vp8,vp9,vorbis,' --enable-muxer='ac3,ass,flac,g722,gif,matroska,mp3,mpegvideo,rtp,ogg,opus,pcm_s16be,pcm_s16le,wav,webm,' --enable-demuxer='aac,ac3,ass,flac,g722,gif,image_jpeg_pipe,image_png_pipe,image_webp_pipe,matroska,mjpeg,mov,mp3,mpegvideo,ogg,pcm_mulaw,pcm_alaw,pcm_s16be,pcm_s16le,rtp,wav,' --enable-filter='crop,scale,overlay,amix,amerge,aresample,format,aformat,fps,transpose,pad,' --enable-indev='v4l2,xcbgrab,' --enable-protocol='crypto,file,pipe,rtp,srtp,rtsp,tcp,udp,unix,' --arch=x86_64 --enable-libopenh264



Thank you in advance.


-
output stream video produced by ffmpeg gets divided into sections on screen upon streaming
22 avril 2024, par Kaustubh SonawaneI'm trying to combine cv2 frames with numpy audio array to produce a hls playlist. I'm giving input using pipe. The problem is that while streaming the output hls playlist produced by ffmpeg, the video screen is divided into 4 parts and the sizes of the 4 parts keep getting changed slowly.
Also the audio is extremely distorted.

Attaching images for reference :
at timestamp 00:00
at timestamp 00:03

Here is the script I have written until now :


import cv2
import subprocess
import numpy as np
import librosa

def create_hls_playlist(width, height, frames, audio_data, output_playlist, fps=30, sample_rate=44100):
 print(fps)
 print(height, width)
 print(audio_np.dtype)
 video_args = [
 '-y', 
 "-fflags", "+discardcorrupt",
 '-f', 'rawvideo',
 '-vcodec', 'rawvideo',
 '-s', '{}x{}'.format(width, height),
 '-pix_fmt', 'bgr24',
 '-r', str(fps),
 '-i', 'pipe:', 
 ]

 audio_args = [
 '-f', 's16le', 
 '-ar', str(sample_rate), 
 '-ac', '1', 
 '-i', 'pipe:', 
 ]


 output_args = [
 "-vf", "scale=1920x1080,setdar=16/9",
 '-an',
 '-c:v', 'libx264',
 '-preset', 'ultrafast',
 '-f', 'hls',
 '-hls_time', '2',
 '-hls_list_size', '0',
 #'-loglevel', 'debug',
 output_playlist,
 ]

 ffmpeg_command = ['ffmpeg'] + video_args + output_args

 ffmpeg_process = subprocess.Popen(ffmpeg_command, stdin=subprocess.PIPE)

 try:
 for frame in frames[:10]:
 print(f"Frame shape: {frame.shape}, Frame data type: {frame.dtype}")
 # Check for any NaN or infinite values in the frame
 if np.isnan(frame).any() or np.isinf(frame).any():
 print("Frame contains NaN or infinite values!")
 ffmpeg_process.stdin.write(frame.to_string())

 except Exception as e:
 print(f"Error occurred while writing frames: {e}")
 
 # Write audio data to ffmpeg process
 audio_bytes = audio_data
 ffmpeg_process.stdin.write(audio_bytes)

 for frame in frames[10:]:
 ffmpeg_process.stdin.write(frame)
 
 ffmpeg_process.stdin.flush()

 ffmpeg_process.stdin.close()

 ffmpeg_process.wait()

 ffmpeg_process.stdin.close()


def capture_frames(video_path):
 frames = []
 cap = cv2.VideoCapture(video_path)
 width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
 height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))

 while cap.isOpened():
 ret, frame = cap.read()
 if not ret:
 break
 frames.append(frame)

 cap.release()
 return frames, width, height

def load_audio(file_path, duration=None, sr=44100):
 audio_data, _ = librosa.load(file_path, sr=sr, duration=duration)
 print("finished audio-----------------------------------")
 print(audio_data)
 audio_duration = librosa.get_duration(y=audio_data, sr=sr)

 if duration is not None and audio_duration > duration:
 start_sample = 0
 end_sample = int(duration * sr)
 audio_data = audio_data[start_sample:end_sample]
 if np.isnan(audio_data).any() or np.isinf(audio_data).any():
 raise ValueError("Audio data contains NaN or infinite values")

 # Normalize audio data
 # audio_data /= np.max(np.abs(audio_data))
 audio_data = (audio_data * 32767).astype(np.int16)
 print(f"Audio data shape: {audio_data.shape}")
 print(f"Audio data type: {audio_data.dtype}")
 return audio_data

def get_video_frame_rate(video_path):
 cap = cv2.VideoCapture(video_path)
 if not cap.isOpened():
 raise ValueError(f"Unable to open the video file: {video_path}")

 frame_rate = cap.get(cv2.CAP_PROP_FPS)
 print(frame_rate)
 cap.release()
 return frame_rate

video_path = 'sample.mp4'

output_playlist = 'output.m3u8'
mp3_file_path = 'audio.mp3'
duration = 11 # seconds
sample_rate = 44100 # Hz


if __name__ == "__main__":
 frames, width, height = capture_frames(video_path)
 audio_np = load_audio(mp3_file_path, duration=duration, sr=sample_rate)
 create_hls_playlist(width, height, frames, audio_np, output_playlist)



And the output :


brain@brainywire:~/k/ffmpeg-e$ /bin/python3 /home//ffmpeg-e/stream_f.py
finished audio-----------------------------------
[1.7182100e-06 1.8538897e-06 1.9645518e-06 ... 5.4211184e-02 5.2549735e-02
 5.0875921e-02]
Audio data shape: (485100,)
Audio data type: int16
30
720 1280
int16
Frame shape: (720, 1280, 3), Frame data type: uint8
Error occurred while writing frames: 'numpy.ndarray' object has no attribute 'to_string'
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, rawvideo, from 'pipe:':
 Duration: N/A, start: 0.000000, bitrate: 663552 kb/s
 Stream #0:0: Video: rawvideo (BGR[24] / 0x18524742), bgr24, 1280x720, 663552 kb/s, 30 tbr, 30 tbn, 30 tbc
Guessed Channel Layout for Input Stream #1.0 : mono
Input #1, s16le, from 'pipe:':
 Duration: N/A, bitrate: 705 kb/s
 Stream #1:0: Audio: pcm_s16le, 44100 Hz, mono, s16, 705 kb/s
Stream mapping:
 Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
 Stream #1:0 -> #0:1 (pcm_s16le (native) -> aac (native))
[libx264 @ 0x5557bf4369c0] using SAR=1/1
[libx264 @ 0x5557bf4369c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x5557bf4369c0] profile High 4:4:4 Predictive, level 4.0, 4:4:4, 8-bit
[libx264 @ 0x5557bf4369c0] 264 - core 163 r3060 5db6aa6 - H.264/MPEG-4 AVC codec - Copyleft 2003-2021 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=6 threads=18 lookahead_threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=crf mbtree=0 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0
[s16le @ 0x5557bf3fcf80] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
Output #0, hls, to 'output.m3u8':
 Metadata:
 encoder : Lavf58.76.100
 Stream #0:0: Video: h264, yuv444p(tv, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 30 fps, 90k tbn
 Metadata:
 encoder : Lavc58.134.100 libx264
 Side data:
 cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
 Stream #0:1: Audio: aac (LC), 44100 Hz, mono, fltp, 69 kb/s
 Metadata:
 encoder : Lavc58.134.100 aac
[rawvideo @ 0x5557bf3e8640] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
[hls @ 0x5557bf4335c0] Opening 'output0.ts' for writingtrate=N/A speed=5.06x 
[hls @ 0x5557bf4335c0] Opening 'output.m3u8.tmp' for writing
[rawvideo @ 0x5557bf3e8640] Packet corrupt (stream = 0, dts = 345), dropping it.
[hls @ 0x5557bf4335c0] Opening 'output1.ts' for writingtrate=N/A speed=5.31x 
[hls @ 0x5557bf4335c0] Opening 'output.m3u8.tmp' for writing
frame= 345 fps=166 q=-1.0 Lsize=N/A time=00:00:11.50 bitrate=N/A speed=5.52x 
video:21389kB audio:95kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[libx264 @ 0x5557bf4369c0] frame I:2 Avg QP:21.00 size:666528
[libx264 @ 0x5557bf4369c0] frame P:343 Avg QP:24.78 size: 59968
[libx264 @ 0x5557bf4369c0] mb I I16..4: 100.0% 0.0% 0.0%
[libx264 @ 0x5557bf4369c0] mb P I16..4: 22.8% 0.0% 0.0% P16..4: 51.1% 0.0% 0.0% 0.0% 0.0% skip:26.1%
[libx264 @ 0x5557bf4369c0] coded y,u,v intra: 24.0% 3.7% 3.3% inter: 30.6% 4.9% 4.8%
[libx264 @ 0x5557bf4369c0] i16 v,h,dc,p: 43% 38% 10% 9%
[libx264 @ 0x5557bf4369c0] kb/s:15236.21
[aac @ 0x5557bf438400] Qavg: 118.713



I noticed this packet corrupt error and after some digging on stackoverflow found a flag to drop corrupt packets. But that didn't solve the problem.


If I do not drop the corrupted packets, I get this error, if it helps to give any more info :


[rawvideo @ 0x61a72571ab80] PACKET SIZE: 2764800, STRIDE: 3840
[libx264 @ 0x61a725754c40] frame= 323 QP=24.00 NAL=2 Slice:P Poc:146 I:2340 P:4474 SKIP:1346 size=62313 bytes
[rawvideo @ 0x61a72571ab80] PACKET SIZE: 2764800, STRIDE: 3840
[libx264 @ 0x61a725754c40] frame= 324 QP=24.00 NAL=2 Slice:P Poc:148 I:1538 P:4449 SKIP:2173 size=56970 bytes
[rawvideo @ 0x61a72571ab80] PACKET SIZE: 2764800, STRIDE: 3840
[libx264 @ 0x61a725754c40] frame= 325 QP=24.00 NAL=2 Slice:P Poc:150 I:2553 P:4310 SKIP:1297 size=64782 bytes
pipe:: corrupt input packet in stream 0
[rawvideo @ 0x61a72571ab80] PACKET SIZE: 2751960, STRIDE: 3822
[rawvideo @ 0x61a72571ab80] Invalid buffer size, packet size 2751960 < expected frame_size 2764800
Error while decoding stream #0:0: Invalid argument
[out_0_0 @ 0x61a72575f400] EOF on sink link out_0_0:default.
[out_0_1 @ 0x61a726577f80] EOF on sink link out_0_1:default.
No more output streams to write to, finishing.
[libx264 @ 0x61a725754c40] frame= 326 QP=24.00 NAL=2 Slice:P Poc:152 I:1076 P:4002 SKIP:3082 size=44541 bytes
[libx264 @ 0x61a725754c40] frame= 327 QP=24.00 NAL=2 Slice:P Poc:154 I:2493 P:4545 SKIP:1122 size=62617 bytes
[libx264 @ 0x61a725754c40] frame= 328 QP=24.00 NAL=2 Slice:P Poc:156 I:1383 P:4328 SKIP:2449 size=50782 bytes
[libx264 @ 0x61a725754c40] frame= 329 QP=24.00 NAL=2 Slice:P Poc:158 I:2179 P:4376 SKIP:1605 size=57972 bytes
[libx264 @ 0x61a725754c40] frame= 330 QP=24.00 NAL=2 Slice:P Poc:160 I:925 P:3772 SKIP:3463 size=37181 bytes



I tried to give bufsize flags too, but even that wouldnt help.


I'm a total beginner to ffmpeg. I tried to give the correct resolution, tried all pix_fmt from the documentation, and also experimented with different values of fps. But the problem with split screen and audio distortion continues.