[Ffmpeg-devel-irc] ffmpeg.log.20200113

burek burek at teamnet.rs
Tue Jan 14 03:05:02 EET 2020


[01:07:06 CET] <Guiri> I'm having trouble getting remuxing a VOB to MKV.  The framerate gets changed to 29.58 from 29.97, at which it plays in VLC and is specified on the case.  https://paste.centos.org/view/78eb4c88
[01:27:16 CET] <cehoyos> The vob most likely has a framerate of 30000/1001
[01:27:38 CET] <cehoyos> You forgot to paste the complete, uncut console output.
[01:28:29 CET] <cehoyos> Note that you cannot specify "vsync 1 -r xxx" with -vcodec copy -acodec copy, this cannot work
[01:33:05 CET] <Guiri> cehoyos: Thanks, so if I omit vsync and the framerate specification of -r, I still get 29.58 for some reason. Here is the complete output: https://paste.centos.org/view/1d0c217e
[01:37:41 CET] <cehoyos> You request from FFmpeg to change the framerate (I am not saying that this always works, but it is what your command line requests) and you are asking why it changes the framerate (again, I am not completely convinced that this is what happens, 30000/1001 is expected but not garanteed), what is your question?
[01:41:14 CET] <Guiri> My question is why does a stream copy result in a different framerate than what the original stream specifies? One would think that the default argument of -c:v copy would copy the framerate, which is set to 29.97
[01:41:33 CET] <Guiri> My guess is this is because I'm generating the timestamps?
[01:45:52 CET] <cehoyos> If you generate timestamps, then you cannot ask for identical framerate
[01:46:11 CET] <cehoyos> I am still not convinced that you really changed the framerate: Are you seeing A/V desync?
[01:46:23 CET] <cehoyos> What are you trying to achieve?
[01:48:01 CET] <pink_mist> Guiri: perhaps the framerate you were seeing was just from metadata, and the real framerate was never displayed to you until ffmpeg discarded the metadata (assuming it did so)
[01:48:15 CET] <cehoyos> No framerate metadata in vob files
[01:48:27 CET] <pink_mist> oh, guess that can't be it then
[01:48:27 CET] <cehoyos> (would be 90k)
[01:52:00 CET] <nicolas17> Guiri: you're still passing -r (why?)
[02:02:40 CET] <Guiri> pink_mist: good point.  And to the latter, I overlooked that
[02:10:03 CET] <danilo82> its possible to use vaapi with ffplay?
[03:04:09 CET] <danilo82> its possible to use vaapi in ffplay?
[04:09:44 CET] <zumba_addict> is there a filter that's better that deshake filter for stabilization?
[04:13:06 CET] <nicolas17> vidstab (needs two passes)
[04:16:18 CET] <zumba_addict> cool, thank you!
[04:21:38 CET] <zumba_addict> my command is this and it's working. However, how should I do 2 passes?
[04:21:41 CET] <zumba_addict> ffmpeg -i PICT0028_vid16x9.mp4 -vf vidstabdetect -vcodec libx264 -crf 22 -pix_fmt yuv420p o.mp4
[04:23:09 CET] <nicolas17> first you run it with the vidstabdetect filter, and you can even throw away the resulting video with "-f null -" as the output
[04:23:29 CET] <nicolas17> the important thing is it will generate a transforms.trf file (you can change the filename with the 'result' parameter to the filter)
[04:24:04 CET] <nicolas17> then you run it again with the vidstabtransform, which will read the .trf file and stabilize the video, this time you do your normal video output
[04:27:06 CET] <zumba_addict> ah
[04:41:54 CET] <lain98> so i ffprobe'd a video and saw that the first frame was not start at pts=0, also AVStream->start_time is incorrectly set to 0. is there a way I could fix avstream->start_time to the correct value using ffmpeg ?
[05:41:29 CET] <super8macht> Hello. is it possible to delete every 3 frame ? it's for my super8 transfer project. I run the projector with 16,66 fps and shoot it with 24 fps, because of the shutter every third frame is half of no.2 half of no.4
[07:50:10 CET] <tinystoat> super8macht: the "select" filter may do what you want.
[08:37:35 CET] <vlt> DHE: Thank you, I'll have a look at the concat demixer.
[08:38:58 CET] <vlt> Is there a way to tell ffmpeg to use exactly the same encoding properties as a given example file (or a specified video track)?
[08:44:53 CET] <nicolas17> vlt: no because video files don't store what encoding parameters they were made with
[08:45:04 CET] <nicolas17> and maybe they were made with a different encoder that doesn't even have the same options
[08:51:47 CET] <vlt> nicolas17: But ffmpeg can determine things like size, pix_fmt, framerate, codec (and "baseline", "main" or "high" for h.264). What else would I need to generate a clip I could concatenate to another video?
[08:52:20 CET] <JEEB> depends on the exact format
[08:52:30 CET] <JEEB> with H.264 and HEVC you need something with exactly the same parameter sets
[08:52:40 CET] <JEEB> which includes those things, but is definitely more than that :P
[08:53:17 CET] <JEEB> it's definitely not impossible but requires tight integration to an encoder so that you know that you can utilize the exact same parameter sets
[14:59:46 CET] <fandangos> Hi all, I'm trying to do a pull request into Kodi to fix the playback of Dolby Vision dual layer content, like UHD Blurays
[15:00:08 CET] <fandangos> the problem is that the codec tag (MKTAG) by FFMpeg is nowhere to be found on those files
[15:00:41 CET] <fandangos> is there anyway to identify Dolby Vision streams besides the MKTAG?
[15:01:29 CET] <fandangos> Here's the output from MediaInfo
[15:01:33 CET] <fandangos> https://pastebin.com/Zv2fndLF
[15:01:53 CET] <fandangos> as you can see the secondary 1080p stream (dolby vision enhancement layer) is mistaken by a secondary video stream
[15:06:25 CET] <fandangos> so how can I differenciate the first stream from the second one?
[15:06:58 CET] <fandangos> I need to drop the second one, or else it results in a green screen
[15:08:37 CET] <JEEB> I would recommend reading Dolby's specs as a base
[15:08:50 CET] <JEEB> they have container wise specs (MPEG-2 TS, MP4)
[15:09:18 CET] <fandangos> https://www.dolby.com/us/en/technologies/dolby-vision/dolby-vision-white-paper.pdf
[15:09:19 CET] <fandangos> this?
[15:09:51 CET] <JEEB> no
[15:10:08 CET] <JEEB> the white papers are generally bullshit
[15:11:10 CET] <fandangos> found it: https://www.dolby.com/us/en/technologies/dolby-vision/dolby-vision-bitstreams-in-mpeg-2-transport-stream-multiplex-v1.2.pdf
[15:11:22 CET] <JEEB> yes that sounds like a matching spec
[15:11:37 CET] <JEEB> for MPEG-2 TS
[15:13:02 CET] <fandangos> yes, I'm trying to fix it for UHD BD playback
[15:13:33 CET] <fandangos> so mpeg2 is what I'm looking at
[15:49:02 CET] <fandangos> "The value of stream_type in the PMT shall be set to 0x06." <-- for Dolby Vision enhancement layer
[15:49:28 CET] <fandangos> is PMT the same as PMT_PID in ffmpeg avformat.h?
[15:50:31 CET] <JEEB> pmt PID is just the PID on which the PMT is received (PAT which has a hard-coded PID contains a list of programs and their PMT PIDs)
[15:51:39 CET] <JEEB> not sure if the stream_type is exported to the API client
[15:52:05 CET] <DHE> I suspect not since that byte should just be mapped to the codec most of the time
[15:52:07 CET] <JEEB> or if there should be specific metadata noting it as being an enhancement layer which should be exported from FFmpeg for that AVStream
[15:53:19 CET] <JEEB> parsing the value within libavformat/mpegts.c is most definitely possible, but the problem is how do you tell the clients what you have found
[15:53:45 CET] <JEEB> problem being that in theory internals like stream_type shouldn't probably be just exported to the API client, but instead handled internally if possible
[15:54:10 CET] <JEEB> so that the client could just have generic code for "do not pick streams mapped as enhancement layers"
[15:54:13 CET] <JEEB> or something :P
[15:54:55 CET] <JEEB> (also because it doesn't make much sense to have a list of IDs in all the clients for them to handle the logic)
[15:55:04 CET] <DHE> there may need to be more disposition flags added, such as AV_DISPOSITION_VISUAL_IMPAIRED and the like
[15:55:13 CET] <DHE> (that one already exists for reference)
[15:57:19 CET] <fandangos> you may find this an utter stupid solution but looking at tons of uhd/regular blurays, the solution I came up with is just removed the stream with ID 0x1015 (every DV EL has this address)
[15:58:01 CET] <fandangos> but it would be better if a DL EL flag exists
[15:58:10 CET] <fandangos> *DV
[16:00:26 CET] <JEEB> DHE: yea disposition flag like depending or additive
[16:00:37 CET] <JEEB> (something that means that it doesn't provide a proper image by itself)
[16:01:53 CET] <fandangos> DEBUG: ffmpeg[0x1d261849710X]: [mpegts] pid=1011 pes_code=0x1e1
[16:01:54 CET] <fandangos> DEBUG: ffmpeg[0x1d261849710X]: [mpegts] pid=1015 pes_code=0x1e1
[16:02:13 CET] <fandangos> as you can see not even the pes_code changes from the main movie (pid=1011) and the EL pid=1015
[16:02:55 CET] <JEEB> the stream start location for blu-ray is probably defined
[16:03:01 CET] <JEEB> as in, the area of PIDs to utilize
[16:04:38 CET] <fandangos> it might be, but that is read by libbluray, which I don't think should be touched
[16:05:09 CET] <fandangos> this is the only open source implementation I found about reading the 'DOVI' identifier
[16:05:11 CET] <fandangos> https://github.com/Comcast/gots/blob/master/psi/pmtdescriptor.go#L283
[16:05:35 CET] <fandangos> still, this would not diferenciate the EL and the main movie with the single layer
[16:34:45 CET] <linux123> hi ,when encoding with libx265 it seems to work but the result is black (only audio working) ,any help?
[16:35:54 CET] <linux123> is libx265 working on ubuntu ??
[16:36:25 CET] <linux123> ffmpeg v 4.1.2
[16:39:30 CET] <linux123> ffmpeg -threads 8 -loop 1 -i pic.jpg -i audio.mp3 -c:v libx265 -c:a copy -shortest out.avi
[16:39:37 CET] <HickHoward> so..
[16:39:50 CET] <HickHoward> i'm trying to write a "script" that can read a LATM frame header
[16:40:12 CET] <HickHoward> is there any place i can start for doing just that?
[16:40:22 CET] <HickHoward> (aside from ffmpeg's sourcecode)
[16:49:30 CET] <HickHoward> (and i mean this in a more accessible manner)
[16:54:39 CET] <pink_mist> linux123: your ffmpeg version doesn't say anything about your libx265 version
[16:54:57 CET] <pink_mist> linux123: and it seems it's libx265 you're having issues with
[16:55:23 CET] <th3_v0ice> Why would I get "error while decoding MB, bytestream -6, concealing AC, DC, MV errors..." while using GPU transcoding? Using the API.
[16:56:01 CET] <kepstin> th3_v0ice: those are messages from the software video decoder, fwiw. perhaps your input is corrupt?
[16:57:26 CET] <th3_v0ice> kepstin: Yeah, this is what I get while trying to play my stream. Input is good, tried it with ffplay also.
[16:58:49 CET] <Hello71> linux123: ... avi?
[16:59:05 CET] <Hello71> I mean, I think it's possible, but... why
[16:59:05 CET] <pink_mist> oh lol, didn't even notice that
[16:59:13 CET] <pink_mist> why indeed
[16:59:39 CET] <linux123> ok it just worked ,does libx265  support .avi ? is
[17:00:24 CET] <linux123> I get it it needs to be mp4 ,right ?
[17:00:50 CET] <pink_mist> I'd prefer mkv personally
[17:04:32 CET] <linux123> thanks !!
[17:05:06 CET] <tomb^> Hi all, was wondering if you guys could help, i'm trying to merge 2 audio streams from a 4.0 mxf video file to a stereo stream, I try: "-filter_complex "channelsplit=channel_layout=4.0[FL][FR][BL][BR];[FL][FR]amerge=inputs=2[aout]" but keep getting an error "Filter channelsplit:BC has an unconnected output", what am I doing wrong?
[17:06:22 CET] <kepstin> th3_v0ice: please pastebin your transcoding commandline and the complete console output.
[17:14:31 CET] <th3_v0ice> kepstin: I am using the API, not the console app. But here is a pastebin https://pastebin.com/KM2Qn16F
[17:37:25 CET] <funnybunny2> Is it possible for different frames in an audio stream to have different sample formats?
[17:37:56 CET] <kepstin> th3_v0ice: is that from the transcoding command? or when you playback the transcoded file?
[17:39:45 CET] <kepstin> funnybunny2: in general, no
[17:40:58 CET] <th3_v0ice> kepstin: Input is rtmp stream and output is also rtmp stream on local network. Using FFplay to stream to my PC which is not on a local network. Errors in pastebin are from FFplay while trying to play transcoded stream using the GPU decoder/encoder pair. While using the CPU it plays the stream fine.
[17:41:08 CET] <funnybunny2> Do all the popular formats like mp3, ogg, aac forbit this?
[17:41:13 CET] <funnybunny2> *forbid
[17:41:25 CET] <kepstin> th3_v0ice: i asked to see the log output from the transcoder
[17:41:57 CET] <funnybunny2> It's just that avcodec_receive_frame takes a non-const pointer to the codec context, so it could change the sample format
[17:42:31 CET] <kepstin> funnybunny2: a single stream decoded by a single decoder shouldn't ever change the sample format mid-stream
[17:43:52 CET] <funnybunny2> I wonder if ffmpeg handles that or if it's a legal encoding according to any standard
[17:44:43 CET] <funnybunny2> I guess I'll just write my code such that it blows up and writes out garbage if the sample format changes
[17:44:45 CET] <kepstin> with mp3 i think you can do nasty things with concatenated files that cause the sample rate or channels to change
[17:44:50 CET] <kepstin> but not the sample format
[17:45:13 CET] <funnybunny2> Oh yeah, I recall being able to simple cat mp3 files together
[17:45:29 CET] <funnybunny2> Does the header contain the sample format?
[17:45:36 CET] <funnybunny2> *simply
[17:45:53 CET] <kepstin> with mp3, each individual packet contains a marker that indicates the sample rate and channels, iirc
[17:46:01 CET] <funnybunny2> But not the format?
[17:46:05 CET] <kepstin> with most lossy codecs, sample format is a property of the decoder, not the codec
[17:46:17 CET] <kepstin> ffmpeg's mp3 float decoder will always produce float
[17:49:35 CET] <funnybunny2> Right now my program is playing back an mp3 but it sounds like a helicopter :(
[17:49:41 CET] <funnybunny2> Something is wrong
[17:50:55 CET] <kepstin> is it interleaved or planar sample format? are you dealing with that correctly?
[17:52:52 CET] <funnybunny2> kepstin: Interleaved
[17:53:30 CET] <funnybunny2> I checked that the sample format is s16le and interleaved and I'm just passing it strait to ALSA as a test
[17:53:40 CET] <funnybunny2> I just die on any other formats
[17:53:59 CET] <kepstin> passing it straight to alsa how?
[17:55:32 CET] <funnybunny2> snd_pcm_writei(handle, frame->extended_data[0], frame->linesize[0]);
[17:56:32 CET] <kepstin> did you tell alsa the correct sample rate, sample format, channel count?
[17:59:21 CET] <funnybunny2> kepstin: Yep
[17:59:55 CET] <funnybunny2> I'll post some code in a sec
[18:03:31 CET] <th3_v0ice> kepstin: Do you mean this? https://pastebin.com/RK24Zuaw
[18:05:27 CET] <funnybunny2> kepstin: Here's the code https://pastebin.com/9KD9Z2Jk
[18:19:25 CET] <ePirat> durandal_1707, is seeking for .dav not implemented?
[18:34:11 CET] <funnybunny2> kepstin: Any idea?
[18:38:09 CET] <kepstin> funnybunny2: that's supposed to be a decoder, right? i think you have some confusion between frames and packets
[18:38:36 CET] <kepstin> oh, no, i'm confused
[18:40:07 CET] <funnybunny2> One thing I'm not sure of is what value to set for latency with snd_pcm_set_params https://www.alsa-project.org/alsa-doc/alsa-lib/group___p_c_m.html#ga45d50841b307f2156fce1857bfac228c
[18:40:14 CET] <kepstin> av_read_frame is just a strangely named function
[18:41:02 CET] <funnybunny2> Also, there is av_receive_frame and av_receive_packet
[18:41:10 CET] <funnybunny2> I never use av_receive_packet
[18:41:58 CET] <durandal_1707> ePirat: it is implemented, and works fine with mpv
[18:42:10 CET] <ePirat> huh weird
[18:42:26 CET] <durandal_1707> weird?
[18:42:43 CET] <ePirat> it does not in VLC for whatever reason
[18:43:33 CET] <durandal_1707> perhaps you use very old ffmpeg
[18:48:26 CET] <ePirat> durandal_1707, hm even though seeking works fine in mpv it seems it has some problems at the end of my file
[18:53:36 CET] <ePirat> durandal_1707, oh I guess its because it does not know the duration of the file
[18:56:34 CET] <durandal_1707> i added code to guess duration in master...
[18:57:19 CET] <kepstin> funnybunny2: hmm. only other thing i can think of is make sure you're not mixing up number of samples vs number of bytes
[18:57:27 CET] <ePirat> durandal_1707, theres no duration given in the dav container?
[18:57:51 CET] <funnybunny2> kepstin: But I'm just dumping the entire frame to ALSA
[18:58:14 CET] <durandal_1707> ePirat: i'm not aware of any, demuxer seeks to the end and tries to find latest packet
[18:58:20 CET] <kepstin> funnybunny2: but you have to tell alsa how long the frame is. what units does it want?
[18:58:50 CET] <kepstin> funnybunny2: does it take byte length of buffer? number of samples in the buffer? if number of samples, do you count 1 for each pair of stereo samples?
[18:59:33 CET] <funnybunny2> kepstin: That's a good point. The documentation is very vauge
[18:59:37 CET] <funnybunny2> kepstin: https://www.alsa-project.org/alsa-doc/alsa-lib/group___p_c_m.html#gabc748a500743713eafa960c7d104ca6f
[18:59:51 CET] <funnybunny2> It says "size frames to be written"
[19:00:06 CET] <funnybunny2> Along with a pointer to a buffer
[19:00:18 CET] <kepstin> in that context, "frame" means "1 sample for each channel"
[19:00:18 CET] <funnybunny2> I don't know why it's calling it "frames"
[19:00:28 CET] <kepstin> so for stereo s16, a frame would be 4 bytes
[19:00:31 CET] <funnybunny2> Seriously
[19:00:34 CET] <funnybunny2> wtf
[19:00:48 CET] <funnybunny2> So I need to divide by 4
[19:01:22 CET] <kepstin> you need to divide by number of channels, then divide by number of bytes per sample
[19:01:41 CET] <kepstin> or there might be some value in the avframe which already is the number of samples? not sure
[19:01:42 CET] <funnybunny2> Yes which is 4
[19:01:45 CET] <funnybunny2> Holy crap it worked
[19:03:16 CET] <funnybunny2> kepstin: Thanks! :)
[19:03:52 CET] <kepstin> the "choppiness" of the sound would have been from alsa overreading the provided buffer and playing some arbitrary memory :/
[19:03:53 CET] <kepstin> yay C
[19:04:05 CET] <funnybunny2> It's 2 channels and 2 bytes per sample, so 4 bytes per "frame"
[19:05:07 CET] <ePirat> durandal_1707, btw are you aware it has the original recording time in the file somewhere?
[19:05:12 CET] <funnybunny2> Now that I finally have something working with ffmpeg + ALSA, I can generalize it with a working program as a base
[19:05:55 CET] <funnybunny2> I will probably try to get a file which doesn't work with a s16 decoder and explicitly convert to s16
[19:06:43 CET] <funnybunny2> I also don't like how somewhere ffmpeg is outputting "[mp3 @ 0x56548cd35ae0] Could not update timestamps for skipped samples."
[19:07:15 CET] <funnybunny2> And "[mp3 @ 0x56548cd35ae0] Could not update timestamps for discarded samples."
[19:07:36 CET] <funnybunny2> Don't think a library should ouptut stuff like that
[19:09:56 CET] <durandal_1707> ePirat: where?
[19:10:55 CET] <ePirat> durandal_1707, I dont know yet, but it must be somewhere as the player I have here is able to display a timeline of the day with my sample video at the correct time range
[19:12:21 CET] <ePirat> durandal_1707, if you want I can share the sample and time with you if you are interested
[19:17:18 CET] <durandal_1707> ePirat: yes, current date is stored in every packet
[19:42:03 CET] <ChocolateArmpits> How does ffmpeg determine file length when the duration isn't known or the file is still growing but seekable otherwise? Does it attempt to check the size of a few frames and use that as a basis for the whole size?
[19:43:20 CET] <kepstin> depends on the container format
[19:44:08 CET] <ChocolateArmpits> I guess TS demuxer uses that approach?
[19:44:31 CET] <kepstin> if there's a header at the start which indicates a length, it'll just report that. some container formats might have estimation? not sure (probably mostly weird stuff like mp3).
[19:44:46 CET] <kepstin> i'd expect in many cases it just reports that it doesn't know the length
[20:06:51 CET] <ChocolateArmpits> I see
[20:07:18 CET] <ChocolateArmpits> Well in my case, probing a growing MXF does report a length, albeit slightly off by a few seconds
[20:08:15 CET] <ePirat> durandal_1707, Ah ok
[20:09:53 CET] <alazare619> is there a way to make sure hte output file is always same container as original?
[20:11:41 CET] <DHE> in the ffmpeg cli? no
[20:11:58 CET] <DHE> without actually specifying your desired output format which you've determined yourself ahead of time
[20:22:58 CET] <HickHoward> okay
[20:23:15 CET] <HickHoward> is there any way i can hook up an windows build of ffmpeg into a vapoursynth script?
[20:23:58 CET] <HickHoward> i don't want to use any source filter available on vapoursynth because i want ffmpeg to be the source filter i'll ever use in any of my vapoursynth scripts
[20:24:21 CET] <durandal_1707> no
[20:24:31 CET] <ChocolateArmpits> HickHoward, There's vspipe to pipe contacts from vapoursynth to ffmpeg
[20:24:34 CET] <ChocolateArmpits> contents*
[20:24:57 CET] <ChocolateArmpits> You can pipe it to anywhere but ffmpeg works absolutely fine from my experience
[20:26:33 CET] <HickHoward> vspipe is out of the question
[20:26:47 CET] <ChocolateArmpits> Oh source filter
[20:26:49 CET] <ChocolateArmpits> sorry
[20:27:07 CET] <HickHoward> right
[20:29:08 CET] <ChocolateArmpits> Would ffmpeg do something to the stream prior to it getting fed into vapoursynth or do you just want some custom input, say a network stream?
[20:30:31 CET] <HickHoward> the former, yes
[20:30:44 CET] <HickHoward> actually i want it more like the latter
[20:34:07 CET] <ChocolateArmpits> There's nothing that I know of to facilitate such workflow aside from programming that type of interaction via vapoursynth api
[20:34:41 CET] <HickHoward> heh
[20:34:44 CET] <ChocolateArmpits> HOWEVER you could try exploring mpv and see if the vapoursynth script input for filtering could be combined with your desired input
[20:35:12 CET] <ChocolateArmpits> "mpv actually provides a source filter, instead of using a native VapourSynth video source"
[20:36:07 CET] <ChocolateArmpits> I have not used this feature so can't attest how well it works or if it works at all with streaming inputs
[20:37:46 CET] <th3_v0ice> kepstin: Is this what you were looking for? https://pastebin.com/RK24Zuaw
[20:38:34 CET] <ChocolateArmpits> HickHoward, with mpv you can also reencode the content and send it off to wherever you need. It runs ffmpeg/libav/whatever api under the hood so a lot of what  you can do with ffmpeg is totally doable with mpv as well, though to a smaller degree
[20:39:17 CET] <HickHoward> nice
[20:39:51 CET] <kepstin> th3_v0ice: hmm. nothing obvious there, can you reproduce this issue with the ffmpeg cli tool?
[20:42:29 CET] <th3_v0ice> kepstin: Nope, ffmpeg works fine. Everything printed on my side looks similar to what FFmpeg is printing.
[20:43:28 CET] <kepstin> this is probably gonna end up being a "please share your code" and maybe someone can look at it and see what you're doing wrong.
[20:43:40 CET] <kepstin> (I'm too busy to look at that today)
[20:49:42 CET] <th3_v0ice> kepstin: Heheh, I will try to create small example that doesnt work. Thanks for your help!
[20:53:13 CET] <HickHoward> fine, i'll give up - i'll use L-SMASH-Works on my vapoursynth script
[20:54:15 CET] <ChocolateArmpits> HickHoward, don't forget ffms2 just in case lsmash doesn't work properly
[20:58:20 CET] <HickHoward> yes but i'm using HolyWu's LSMASH
[20:58:55 CET] <HickHoward> ffms2's latest binary release (from ffms2(user/group) github repo by the way) is there for over 3 years
[20:59:11 CET] <HickHoward> i need something updated to make my script "work"
[21:34:40 CET] <BtbN> Is there some way to segment a stream without getting weird audio glitching when stitching it back together? It seems like some of the seams have a mismatch between audio and video frames, and there's a tiny hitch.
[21:39:02 CET] <kepstin> BtbN: not possible with lossy codecs that use overlapped blocks, you should just encode the audio non-segmented
[21:39:16 CET] <BtbN> I'm not encoding at all
[21:39:21 CET] <BtbN> I'm just stream-copying
[21:39:36 CET] <BtbN> I'm recording an rtmp stream in a ton of short segments
[21:40:29 CET] <pagios> hello all, i am having a problem when transcoding some media, i get on the console this error   https://pastebin.com/rurGzX2P , if transcoding is not enabled all is good. when transocding is enabled i am getting dropped frames, vm is yet relaxed on cpu (40% only used and on RAM too, ) what could be the problem?
[21:40:40 CET] <kepstin> hmm. if you're using the ffmpeg segment muxer (or hls or similar) that should be fine
[21:41:04 CET] <kepstin> the concat demuxer should be able to put the segments back together into a single stream before decoding, so it should be good
[21:41:27 CET] <pagios> i am using ['-vf','scale='+,"-vb",,"-g",90,"-framerate",30,"-hls_time",3,"-f","hls",channelPath]
[21:41:48 CET] <ChocolateArmpits> BtbN, are you using flv to store the segments?
[21:42:06 CET] <pagios> kepstin, sorry i didnt get that
[21:42:15 CET] <BtbN> no, .ts
[21:42:18 CET] <kepstin> oh, hmm, that was supposed to trigger a bot
[21:42:35 CET] <kepstin> pagios: please share the complete ffmpeg command line *and* the full ffmpeg output.
[21:42:58 CET] <pagios> the ffmpeg is being used as a commandline inside node
[21:42:59 CET] <BtbN> kepstin, it's ffmpeg segment muxer to 4 second long .ts segments.
[21:43:20 CET] <BtbN> And when stitching them together with the concat demuxer, every now and then on the seams of the segments, there's a tiny but audible hitch
[21:43:54 CET] <kepstin> pagios it's possible that there's something in your ffmpeg command that's single-threaded and cpu limited on your machine.
[21:44:35 CET] <kepstin> use a top program that can show per-cpu processor consumption, and also check steal time if it's a vm
[21:44:44 CET] <pagios> kepstin, i am using a simple ffmpeg where i take an rtmp, use -vf scale -vb -g 90 -hls_time 3 on it
[21:44:48 CET] <kepstin> you probably just don't have enough cpu performance available
[21:45:08 CET] <pagios> kepstin, the cpu seems to be relaxed in top i only see 30 to 40% usage
[21:45:33 CET] <kepstin> pagios: check if a single cpu core is pegged, check steal time.
[21:46:16 CET] <pagios> kepstin, i am using the cx51 on this page https://www.hetzner.com/cloud
[21:46:26 CET] <pagios> it is shared cpu
[21:47:49 CET] <kepstin> shared cpu and realtime multimedia = having a bad day
[21:48:07 CET] <pagios> kepstin, even if i go dedicated cpu same problem when enabling trans
[21:48:32 CET] <pagios> kepstin, could it be disk io to write the segments/
[21:48:58 CET] <kepstin> pagios: i cannot help you futher unless you provide some of the information i've asked for, such as complete ffmpeg command line, complete console output, per-core breakdown of cpu usage.
[21:49:11 CET] <kepstin> it could be disk io if your transcoding makes the file bigger
[21:49:29 CET] <pagios> no it is small chunks
[21:49:55 CET] <kepstin> by "makes the file bigger" i mean "results in a higher bitrate than not transcoding"
[21:56:03 CET] <pagios> kepstin, here is the log, https://pastebin.com/38immBEm
[21:57:00 CET] <kepstin> oh, you're doing multiple scales and encodes in a single command
[21:57:18 CET] <kepstin> the filter chain is single-threaded in the ffmpeg cli tool, so it's probably cpu limited doing the scaling
[21:57:23 CET] <pagios> yes
[21:57:27 CET] <pagios> oh
[21:57:36 CET] <kepstin> doing separate processes per resolution would work better
[21:57:51 CET] <pagios> you mean to fire 4 ffmpeg seperately?
[21:58:12 CET] <pagios> commands
[21:58:29 CET] <kepstin> sure, that's one way of doing it if you don't need them perfectly synced.
[21:58:42 CET] <pagios> yea no need to have them synced
[21:59:06 CET] <pagios> kepstin, but how come "top" doesnt show cpu saturation?
[21:59:30 CET] <kepstin> you need to look at per-core stats
[21:59:42 CET] <kepstin> and even then it might not be obvious if the process gets bounced between cores
[21:59:54 CET] <kepstin> a per-thread breakdown of the ffmpeg process could show it too
[22:01:08 CET] <pagios> kepstin, inside top, i pressed 1 , thats how i see per core ?
[22:03:38 CET] <saber1> does anyone know why timestamp overlay added video has different pts_time compare to the original video? I'd expect them to be the same, since all I wanted was to add overlays to existing frames
[22:04:18 CET] <saber1> could it be related how filtering works? as it has to decodes and reencodes the video?
[22:05:13 CET] <kepstin> sefeng211: the ffmpeg cli tool applies some "cleanups" to timestamp values during decoding (these can be mostly disabled with appropriate options).
[22:05:33 CET] <kepstin> filters can of course also modify timestamps, but you have to explicitly include a filter which does that
[22:05:55 CET] <pagios>  <kepstin> a per-thread breakdown of the ffmpeg process could show it too < -- how can i do that
[22:06:15 CET] <saber1> kepstin: okie, thanks, do you know which options to disable that off hand?
[22:06:58 CET] <kepstin> sefeng211: check out the -copyts and -vsync options in the docs for the ffmpeg cli command, might want to try one or another or both.
[22:08:07 CET] <kepstin> pagios: by going "man top" and searching for "thread" and finding out that in the version of top on my system, the "H" key causes it to display individual threads.
[22:08:18 CET] <kepstin> (this might not match your system)
[22:08:36 CET] <pagios> thanks i will have a look at the man page
[22:13:18 CET] <saber1> kepstin: tried vsync 0, 1 and 2, with and witout copyts, they generated some different pts_time, however one of them matches the ones from the original video
[22:13:47 CET] <BtbN> So I figure there is simply no way to properly segment a stream? oO
[22:14:09 CET] <BtbN> Unless I go the super dumb route that just cuts 188 byte chunks ignoring any contents somehow
[22:19:02 CET] <kepstin> BtbN: I'd honestly expect that to work. It's not clear what's going wrong.
[22:20:00 CET] <BtbN> It's not every seam. Like, maybe once every few minutes it messes up
[22:20:07 CET] <BtbN> but in a 4h long video it's still annoying
[22:20:51 CET] <kepstin> might be some sort of timestamp issue. what's the command/output that you're using to put the segments back together?
[22:27:12 CET] <BtbN> https://github.com/esamarathon/VodManager/blob/master/tools/nginx/ffmpeg_rec.sh that's the recording command
[22:27:40 CET] <BtbN> https://github.com/esamarathon/VodManager/blob/master/VodManager/Services/VideoCombineService.cs#L153 and that what stitches it together
[22:34:32 CET] <BtbN> really nothing complicated to it
[22:34:43 CET] <kepstin> hmm. i wonder if it's an issue with the concat demuxer's timestamp handling.
[22:35:04 CET] <kepstin> have you tried just concatenating the ts files directly? or using the concat protocol instead of format? (both are equivalent)
[22:36:34 CET] <BtbN> not yet unfortunately. Since we are only now starting to notice this, way after the fact
[22:38:09 CET] <void09> trying to encode a .dv video file:  Duration: 00:04:51.24, start: 0.000000, bitrate: 28800 kb/s
[22:38:09 CET] <void09>     Stream #0:0: Video: dvvideo, yuv420p, 720x576 [SAR 64:45 DAR 16:9], 25000 kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc
[22:38:09 CET] <void09>     Stream #0:1: Audio: pcm_s16le, 32000 Hz, stereo, s16, 1024 kb/s
[22:38:09 CET] <void09>     Stream #0:2: Audio: pcm_s16le, 32000 Hz, stereo, s16, 1024 kb/s
[22:38:25 CET] <void09> and I get this: [dv @ 0x65ad940] Can't initialize DV format!
[22:38:25 CET] <void09> Make sure that you supply exactly two streams:
[22:38:25 CET] <void09>      video: 25fps or 29.97fps, audio: 2ch/48|44|32kHz/PCM
[22:38:49 CET] <kepstin> BtbN: iirc the concat demuxer does some extra work to ensure the audio/video packets in each segment are aligned by adjusting timestamps and that could possibly be the cause of the issue.
[22:39:11 CET] <void09> that's probably 2 mono audio streams meant to be interpreted as stereo. as switching to the second one in mpv results in no audio being played
[22:39:11 CET] <BtbN> So just using the concat protocol might help?
[22:39:33 CET] <BtbN> Or, well, just not using ffmpeg at all and naively concating the segments.
[22:39:37 CET] <kepstin> yes, that's equivalent to doing "cat file1.ts file2.ts | ffmpeg -i -"
[22:40:00 CET] <void09> oh ts cutting.. i gave up on that with ffmpeg :\
[22:40:09 CET] <BtbN> cutting works just fine it seems
[22:40:17 CET] <BtbN> the putting it back together does not
[22:40:32 CET] <kepstin> the segment muxer cuts them fine, but the concat muxer isn't the recommended tool for putting them back together
[22:40:55 CET] <kepstin> concat demuxer*
[22:40:59 CET] <void09> I still have some cut pieces  I have no idea how to merge (without glitches at the merging points)
[22:41:14 CET] <void09> cutting commercials from .ts tv recordings
[22:41:31 CET] <kepstin> with the segment muxer, the resulting files are actually a single continuous ts stream that's just been split over multiple files
[22:41:53 CET] <kepstin> ... i think
[22:41:56 CET] <kepstin> you know, I'm not actually sure. I hope that's the case.
[22:42:26 CET] <kepstin> if it's initializing a separate ts muxer for each segment, it might just be a bad time for everyone :/
[22:42:34 CET] <BtbN> Well, if you actually cut out segments, you can get some glitches, cause there's a mismatch there
[22:42:41 CET] <BtbN> That's not surprising at least
[22:43:11 CET] <kepstin> BtbN: i wonder if the hls muxer might actually work better for you than the segment muxer :/
[22:43:26 CET] <BtbN> Don't they use the same code?
[22:43:48 CET] <BtbN> For all I'm aware, the HLS muxer can't realtime-timestamp the segments
[22:46:14 CET] <void09> BtbN: there shouldn't be any glitches though, cutting at keyframes
[22:46:25 CET] <BtbN> kepstin, looking at the segment.c code, I probably want to set -individual_header_trailer 0
[22:47:00 CET] <BtbN> http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavformat/segment.c;h=bf9e706c1c301f41929e0c9e46451cd4cc217b9a;hb=HEAD#l931 passed to segment_start here
[22:47:01 CET] <BtbN> http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavformat/segment.c;h=bf9e706c1c301f41929e0c9e46451cd4cc217b9a;hb=HEAD#l239
[22:47:12 CET] <BtbN> And there, if it's true, it will re-init the context on each segment
[22:47:18 CET] <BtbN> so probably, for .ts, I want to set it to 0.
[22:47:52 CET] <kepstin> void09: i'd expect audio glitches when cutting on keyframes, but video should be fine assuming the keyframes are actually where you hope they are.
[22:48:35 CET] <kepstin> usually programs go to/from commercial breaks on silence tho, so that's probably not gonna be any noticable audio issues
[22:50:16 CET] <void09> kepstin: i exported the pieces with avidemux, cutting only on keyframes. joining them back resulted in glitches (2 seconds of video pause at joining points)
[22:50:51 CET] <kepstin> void09: well, there's many possible reasons for that.
[22:53:39 CET] <kepstin> one fairly common thing is that you have some extra audio packets that are timestamped either before the first video frame or after the last video frame.
[22:56:39 CET] <void09> yeah i thought of that.. but no idea how to fix it
[22:59:58 CET] <BtbN> kepstin, yeah, I'm pretty confident that -individual_header_trailer 0 is what I need
[23:00:50 CET] <BtbN> Maybe even -write_header_trailer 0
[23:00:58 CET] <BtbN> Not sure if that even does anything for .ts
[23:03:03 CET] <kepstin> might as well leave the -write_header_trailer on, it does an extra flush at the end that couldn't hurt
[23:03:23 CET] <kepstin> mpegts muxer doesn't even have a write header function, iirc
[23:08:43 CET] <BtbN> But the segment muxer does have special code for mpegts
[23:08:54 CET] <BtbN> it sets av_opt_set(oc->priv_data, "mpegts_flags", "+resend_headers", 0); every segment start
[23:09:13 CET] <BtbN> which in the mpegts muxer is a special flag which it resets/consumes, and triggers it to re-write the PAT/PMT
[23:10:25 CET] <BtbN> Just re-discovered this lovely script I came up with, to put an intro in front of one of the segments, while keeping timestamps intact, with crossfade: https://github.com/esamarathon/VodManager/blob/master/tools/combine_video.sh
[23:23:48 CET] <void09>  ffmpeg -i dvgrab-001.dv -c:a copy -c:v copy lol.mkv
[23:23:54 CET] <void09> ffmpeg -y -i lol.mkv -an -sn -pix_fmt yuv420p -c:v libaom-av1 -aq-mode 1 -crf 23 -b:v 0 -cpu-used 3 -g -1 -strict -2 -pass 1 -passlogfile 'dvgrab-001.dv1' -f matroska /dev/null && ffmpeg -y -i lol.mkv -an -sn -pix_fmt yuv420p -c:v libaom-av1 -aq-mode 1 -crf 23 -b:v 0 -cpu-used 3 -g -1 -strict -2 -pass 2 -passlogfile 'dvgrab-001.dv1' 'dvgrab-001-1.dv'
[23:24:02 CET] <void09> first pass works, but second pass fails with this:
[23:25:29 CET] <void09> nevermind, figured it out
[23:25:35 CET] <void09> i kept the .dv extension for output :\
[00:00:00 CET] --- Tue Jan 14 2020


More information about the Ffmpeg-devel-irc mailing list