Re: [FFmpeg-user] XDcam MXF wrong field order

2021-05-18 Thread Marton Balint



On Tue, 18 May 2021, Bouke wrote:



Trying to make broadcast compliant (XDcam style) MXF files, but those fail on 
wrong field order, if the source is progressive.
This used to work fine. (ffmpeg version 3.2.2 has no issues with this, and has 
done literally thousands of good / compliant files)

FFmpeg always reports "top coded first (swapped))", and MediaInfo says:
Scan order   : Bottom Field First

If I swap out -top 1 for -field_order tt it does not help at all.

Now, it ’should’ not be an issue, except that Baton / pre baton scripts bitch 
about it, and the files get rejected.


Well, you should try to bisect when it went wrong. Also have you tried the 
-vf setfield filter to force a field order? Maybe that helps?


Regards,
Marton




Bouke

Stripped down line: (To indicate the problem, this will not make a compliant 
file, I know.)

/Applications/ffmpeg -i /Volumes/Data/17-05-2021_14-34-56_1.mov -c:v mpeg2video -b:v 5k -maxrate 5k -bufsize 3835k -minrate 5k -r 25 -flags +ilme+ildct -top 1 -pix_fmt yuv422p -profile:v 0 -level:v 2 -t 1 /Volumes/Data/interlacetest.mxf -y 


ffmpeg version 4.4-tessus  https://evermeet.cx/ffmpeg/  Copyright (c) 2000-2021 
the FFmpeg developers
 built with Apple clang version 11.0.0 (clang-1100.0.33.17)
 configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus 
--enable-avisynth --enable-fontconfig --enable-gpl --enable-libaom 
--enable-libass --enable-libbluray --enable-libdav1d --enable-libfreetype 
--enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libmysofa 
--enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 
--enable-libopenjpeg --enable-libopus --enable-librubberband --enable-libshine 
--enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora 
--enable-libtwolame --enable-libvidstab --enable-libvmaf 
--enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp 
--enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid 
--enable-libzimg --enable-libzmq --enable-libzvbi --enable-version3 
--pkg-config-flags=--static --disable-ffplay
 libavutil  56. 70.100 / 56. 70.100
 libavcodec 58.134.100 / 58.134.100
 libavformat58. 76.100 / 58. 76.100
 libavdevice58. 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
 libpostproc55.  9.100 / 55.  9.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 
'/Volumes/Data/17-05-2021_14-34-56_1.mov':
 Metadata:
   major_brand : qt
   minor_version   : 512
   compatible_brands: qt
   encoder : Lavf58.65.101
 Duration: 00:00:15.20, start: 0.00, bitrate: 276385 kb/s
 Stream #0:0: Video: prores (HQ) (apch / 0x68637061), yuv422p10le(tv, top coded 
first (swapped)), 1920x1080, 274850 kb/s, 25 fps, 25 tbr, 12800 tbn, 12800 tbc 
(default)
   Metadata:
 handler_name: VideoHandler
 vendor_id   : FFMP
 encoder : Lavc58.117.101 prores
 timecode: 12:34:59:00
 Stream #0:1: Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, stereo, s16, 1536 
kb/s (default)
   Metadata:
 handler_name: SoundHandler
 vendor_id   : [0][0][0][0]
 Stream #0:2(eng): Data: none (tmcd / 0x64636D74), 0 kb/s
   Metadata:
 handler_name: TimeCodeHandler
 timecode: 12:34:59:00
Stream mapping:
 Stream #0:0 -> #0:0 (prores (native) -> mpeg2video (native))
 Stream #0:1 -> #0:1 (pcm_s16le (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, mxf, to '/Volumes/Data/interlacetest.mxf':
 Metadata:
   major_brand : qt
   minor_version   : 512
   compatible_brands: qt
   encoder : Lavf58.76.100
 Stream #0:0: Video: mpeg2video (4:2:2), yuv422p(tv, progressive), 1920x1080, 
q=2-31, 5 kb/s, 25 fps, 25 tbn (default)
   Metadata:
 handler_name: VideoHandler
 vendor_id   : FFMP
 timecode: 12:34:59:00
 encoder : Lavc58.134.100 mpeg2video
   Side data:
 cpb: bitrate max/min/avg: 5000/5000/5000 buffer size: 3835000 
vbv_delay: N/A
 Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s (default)
   Metadata:
 handler_name: SoundHandler
 vendor_id   : [0][0][0][0]
 encoder : Lavc58.134.100 pcm_s16le
frame=1 fps=0.0 q=0.0 size=   0kB time=00:00:00.16 bitrate=   0.0kbits/sframe=   24 fps=0.0 q=2.0 size=5632kB time=00:00:00.96 bitrate=48059.7kbits/frame=   25 fps=0.0 q=1.6 Lsize=6216kB time=00:00:00.96 bitrate=53043.7kbits/s speed=1.79x 
video:5986kB audio:188kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.681476%

___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

___

Re: [FFmpeg-user] Python / Qprocess misfires commands.

2021-05-18 Thread Nicolas George
Moritz Barsnick (12021-05-18):
> Sure. I don't understand QProcess (yet, or anymore), so I have no idea
> what to debug. I don't know what to make of the return code 6 either.

That could be a signal number incorrectly interpreted as a return code.

That would make the signal probably SIGABRT, and therefore probably the
sign of a failed assert.

It is almost certain more diagnostic appears in ffmpeg's output. I do
not know if Qt allows to capture it, but it would be unforgivable not
to. Anyway, the ffmpeg-user mailing list is not the place to learn Qt
programming, nor generic system programming.

Regards,

-- 
  Nicolas George


signature.asc
Description: PGP signature
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-user] image2pipe to RTMP issues ("faster than realtime")

2021-05-18 Thread Travis Skindzier
Hello,

My goal is to stream to YouTube Live via RTMP as output, using the following 2 
inputs:

1) Icecast audio stream... ffprobe output: Stream #0:0: Audio: mp3, 44100 Hz, 
stereo, fltp, 128 kb/s
2) Headless chrome startScreencast api which is recording a webpage. Based on 
my knowledge it appears Chrome sends roughly 10 FPS, but without being certain, 
I assume this frame rate could vary based on page load, etc.

According to YouTube, these are the requirements for 720p @ 30:
- Resolution: 1280x720
- CBR encoding
- Bitrate Range: 1,500-4,000 Kbps
- 2 second keyframe

Issue #1) I’m getting the following error from YouTube currently: "Your encoder 
is sending data faster than realtime (you must send 1 second of video for each 
second)”

This error is the primary issue I’m trying to solve, but I have listed several 
sub-issues that my intuition tell me MAY be wrong as well. My understanding of 
video/ffmpeg is not in my expertise, so there could be many gross 
inefficiencies or bad approaches in my command. I would gladly welcome any 
critiques or suggestions for any other issues that stand out that I’m not 
seeing.

Issue #2) I remember reading somewhere that I may need to set an explicit 
framerate on the audio so it’s not “locked” to the video. Is this correct, and 
how would I do that?

Issue #3) I have seen several examples of RTMP streaming explicitly setting 
-threads 0. Is this recommended for live/realtime streaming? If so, how do I 
input them into the command?

Issue #4) I currently see that Chrome sends about 10 fps. My current 
implementation which I found is interpolating frames via a javascript loop. The 
solution seems very hacky and poorly written, and I’m wondering if there is a 
native way to do this in ffmpeg so that chrome can output 10 fps and ffmpeg can 
duplicate frames up to 30 fps.

Issue #5) Any other glaring issues you see I would love to hear them. I 
essentially crafted this command as a golden retriever would play with a tennis 
ball.

Below are my current flags (they are in exact order, but I added line breaks 
and comment headings for easier reading). Thank you!

// input audio
-thread_queue_size 1024
-i http://x.x.x.x/stream,

// input video
-thread_queue_size 1024
-f image2pipe
-i -

// output
-framerate 30
-pix_fmt yuv420p
-strict -2
-c:v libx264
-x264-params keyint=60
-preset veryfast
-b:v 2500k
-minrate:v 4000k
-maxrate:v 4000k
-bufsize:v 8000k
-f flv
rtmp://a.rtmp.youtube.com/live2/STREAM_KEY

___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-user] Python / Qprocess misfires commands.

2021-05-18 Thread Moritz Barsnick
On Tue, May 18, 2021 at 12:05:40 +0200, Bouke wrote:
> > Then you're capturing your output incorrectly.

> Nah, this was an apology for an earlier message where I ment ’nothing except 
> the banner'

Hmm. Your attached reports indicate that there were more log messages.
I wonder where they went...

> > If QProcess terminates it unconditionally, there's nothing we can do(?).
>
> I understand, but now it’s the blame game, what happens where / when / why?

Sure. I don't understand QProcess (yet, or anymore), so I have no idea
what to debug. I don't know what to make of the return code 6 either.
it doesn't come from ffmpeg, as far as I can tell from the latter's
source.

ffmpeg isn't stuck at that point, it just terminates, right?

> > If ffmpeg crashes, that's bad. You would have to convince your system
> > to create a core dump, and would have to look at a backtrace. (Or run
> > ffmpeg within gdb.)
>
> Eeh, I’m a simple scripter, not a coder, no clue how to do that...

(If you can operate QProcess, you're no longer a "simple" scripter.)

Well, if MacOS happens to have gdb, it would work by replacing your
ffmpeg command line with:

$ gdb -ex r -ex bt --args ffmpeg [further command line options]

i.e. prepending gdb. The ffmpeg binary should not be stripped for this
to work properly.

MacOS may have lldb instead of gdb, but I have no experience in
operating that.

> > Do you need to run it in bash? Can you not set cmd to "ffmpeg" and
> > properly pass the arguments?
>
> Normally I do that, especially as that saves tons of headaches on escaping 
> stuff.
> But this was a suggestion from the QT forum, hoping it would provide a bit 
> more insight.
> https://forum.qt.io/topic/126674/escaping-colon-in-command-line-argument/8 
> 
>
> Trust me, it makes no difference if I use separate args or run it as bash.

I trust you. I was just speculating.

Moritz
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-user] Python / Qprocess misfires commands.

2021-05-18 Thread Bouke

> On 18 May 2021, at 09:33, Moritz Barsnick  wrote:
> 
> On Mon, May 17, 2021 at 09:19:46 +0200, Bouke wrote:
>>> You will have to show/look at the console output of both commands.
>>> (It's there for a reason, and most likely says what the issue is.)
>> 
>> I know, but there was ’nothing’ on stdErr / stdOut.
> 
> Then you're capturing your output incorrectly.

Nah, this was an apology for an earlier message where I ment ’nothing except 
the banner'

> 
>> It turns out that FFmpeg crashes, nothing wrong with the command line.
>> QProcess sees an error, and either QProcess terminates FFmpeg (I don’t think 
>> so) or FFmpeg crashes by itself.
> 
> If QProcess terminates it unconditionally, there's nothing we can do(?).

I understand, but now it’s the blame game, what happens where / when / why?

> If ffmpeg crashes, that's bad. You would have to convince your system
> to create a core dump, and would have to look at a backtrace. (Or run
> ffmpeg within gdb.)

Eeh, I’m a simple scripter, not a coder, no clue how to do that...

> 
>> in Python:
>> cmd = "bash"
>> args = ["-c", "/Applications/ffmpeg -loglevel trace -report -f avfoundation 
>> -i :0 /Volumes/Data/test.mov"]
> 
> Do you need to run it in bash? Can you not set cmd to "ffmpeg" and
> properly pass the arguments?

Normally I do that, especially as that saves tons of headaches on escaping 
stuff.
But this was a suggestion from the QT forum, hoping it would provide a bit more 
insight.
https://forum.qt.io/topic/126674/escaping-colon-in-command-line-argument/8 


Trust me, it makes no difference if I use separate args or run it as bash.

Bouke


> 
> Regards,
> Moritz
> ___
> ffmpeg-user mailing list
> ffmpeg-user@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
> 
> To unsubscribe, visit link above, or email
> ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-user] XDcam MXF wrong field order

2021-05-18 Thread Bouke

Trying to make broadcast compliant (XDcam style) MXF files, but those fail on 
wrong field order, if the source is progressive.
This used to work fine. (ffmpeg version 3.2.2 has no issues with this, and has 
done literally thousands of good / compliant files)

FFmpeg always reports "top coded first (swapped))", and MediaInfo says:
Scan order   : Bottom Field First

If I swap out -top 1 for -field_order tt it does not help at all.

Now, it ’should’ not be an issue, except that Baton / pre baton scripts bitch 
about it, and the files get rejected.


Bouke

Stripped down line: (To indicate the problem, this will not make a compliant 
file, I know.)

/Applications/ffmpeg -i /Volumes/Data/17-05-2021_14-34-56_1.mov -c:v mpeg2video 
-b:v 5k -maxrate 5k -bufsize 3835k -minrate 5k -r 25 -flags 
+ilme+ildct -top 1 -pix_fmt yuv422p -profile:v 0 -level:v 2 -t 1 
/Volumes/Data/interlacetest.mxf -y 

ffmpeg version 4.4-tessus  https://evermeet.cx/ffmpeg/  Copyright (c) 2000-2021 
the FFmpeg developers
  built with Apple clang version 11.0.0 (clang-1100.0.33.17)
  configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg 
--extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl 
--enable-libaom --enable-libass --enable-libbluray --enable-libdav1d 
--enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame 
--enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb 
--enable-libopenh264 --enable-libopenjpeg --enable-libopus 
--enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr 
--enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab 
--enable-libvmaf --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx 
--enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs 
--enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi 
--enable-version3 --pkg-config-flags=--static --disable-ffplay
  libavutil  56. 70.100 / 56. 70.100
  libavcodec 58.134.100 / 58.134.100
  libavformat58. 76.100 / 58. 76.100
  libavdevice58. 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
  libpostproc55.  9.100 / 55.  9.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 
'/Volumes/Data/17-05-2021_14-34-56_1.mov':
  Metadata:
major_brand : qt  
minor_version   : 512
compatible_brands: qt  
encoder : Lavf58.65.101
  Duration: 00:00:15.20, start: 0.00, bitrate: 276385 kb/s
  Stream #0:0: Video: prores (HQ) (apch / 0x68637061), yuv422p10le(tv, top 
coded first (swapped)), 1920x1080, 274850 kb/s, 25 fps, 25 tbr, 12800 tbn, 
12800 tbc (default)
Metadata:
  handler_name: VideoHandler
  vendor_id   : FFMP
  encoder : Lavc58.117.101 prores
  timecode: 12:34:59:00
  Stream #0:1: Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, stereo, s16, 
1536 kb/s (default)
Metadata:
  handler_name: SoundHandler
  vendor_id   : [0][0][0][0]
  Stream #0:2(eng): Data: none (tmcd / 0x64636D74), 0 kb/s
Metadata:
  handler_name: TimeCodeHandler
  timecode: 12:34:59:00
Stream mapping:
  Stream #0:0 -> #0:0 (prores (native) -> mpeg2video (native))
  Stream #0:1 -> #0:1 (pcm_s16le (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, mxf, to '/Volumes/Data/interlacetest.mxf':
  Metadata:
major_brand : qt  
minor_version   : 512
compatible_brands: qt  
encoder : Lavf58.76.100
  Stream #0:0: Video: mpeg2video (4:2:2), yuv422p(tv, progressive), 1920x1080, 
q=2-31, 5 kb/s, 25 fps, 25 tbn (default)
Metadata:
  handler_name: VideoHandler
  vendor_id   : FFMP
  timecode: 12:34:59:00
  encoder : Lavc58.134.100 mpeg2video
Side data:
  cpb: bitrate max/min/avg: 5000/5000/5000 buffer size: 3835000 
vbv_delay: N/A
  Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s (default)
Metadata:
  handler_name: SoundHandler
  vendor_id   : [0][0][0][0]
  encoder : Lavc58.134.100 pcm_s16le
frame=1 fps=0.0 q=0.0 size=   0kB time=00:00:00.16 bitrate=   
0.0kbits/sframe=   24 fps=0.0 q=2.0 size=5632kB time=00:00:00.96 
bitrate=48059.7kbits/frame=   25 fps=0.0 q=1.6 Lsize=6216kB 
time=00:00:00.96 bitrate=53043.7kbits/s speed=1.79x
video:5986kB audio:188kB subtitle:0kB other streams:0kB global headers:0kB 
muxing overhead: 0.681476%
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-user] Python / Qprocess misfires commands.

2021-05-18 Thread Moritz Barsnick
On Mon, May 17, 2021 at 09:19:46 +0200, Bouke wrote:
> > You will have to show/look at the console output of both commands.
> > (It's there for a reason, and most likely says what the issue is.)
>
> I know, but there was ’nothing’ on stdErr / stdOut.

Then you're capturing your output incorrectly.

> It turns out that FFmpeg crashes, nothing wrong with the command line.
> QProcess sees an error, and either QProcess terminates FFmpeg (I don’t think 
> so) or FFmpeg crashes by itself.

If QProcess terminates it unconditionally, there's nothing we can do(?).
If ffmpeg crashes, that's bad. You would have to convince your system
to create a core dump, and would have to look at a backtrace. (Or run
ffmpeg within gdb.)

> in Python:
> cmd = "bash"
> args = ["-c", "/Applications/ffmpeg -loglevel trace -report -f avfoundation 
> -i :0 /Volumes/Data/test.mov"]

Do you need to run it in bash? Can you not set cmd to "ffmpeg" and
properly pass the arguments?

Regards,
Moritz
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-user] Preserving AAC LC status when converting to fragmented MP4

2021-05-18 Thread Moritz Barsnick
On Mon, May 17, 2021 at 23:34:45 +0100, Simon Brown wrote:
> Thank you for your reply.  If it is the bitstream filter could you point me
> to the relevant source file that is responsible for this filter?

Sure, it's here:
https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/aac_adtstoasc_bsf.c

> mp4info doesn't deal with TS, as you surmise.  FFMpeg reports the output
> file as AAC (not LC).  I'm not sure VLC gives that detail.  But given that
> the ffmpeg processor and the mp4info program both seem to concur when there
> is or isn't AAC-LC I'm not sure there is much value in trying a third
> tool.

You could also try mediainfo. I also found a tool capable of parsing
and deconstruction AAC headers (https://p23.nl/projects/aac-header/),
but I don't trust it since it isn't capable of recognizing e.g.
HE-AACv2 (though I haven't taken the time to understand all the headers
myself).

I couldn't reproduce the loss of this information with the input
samples I have. Can you share your input file? Since it's an MPEG-TS.
perhaps the first MB (or five) suffice.

> I will download the latest prebuilt binaries for Windows and give it a try
> with those.  I'd still be interested in the source file responsible as the
> version on the embedded system I'm using is not the most recent build, and
> rebuilding for that isn't something I want to do at this stage.

I understand.

Cheers,
Moritz
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".