mp4 like Adobe premiere result

Questions and answers on how to get the most out of FFAStrans
User avatar
Wahyu
Posts: 49
Joined: Sun Nov 15, 2020 12:27 am

Re: mp4 like Adobe premiere result

Post by Wahyu »

Thanks for your information @FranceBB, :D
emcodem wrote: Wed Sep 08, 2021 8:52 am Also, please just try to export some 50p from adobe and test on playout. If it works, please upload the file, it will be VERY useful for us to also make your interlaced files work.
I've create 50p and playout is working

here's an experiment that :

ffmpeg export h264+mp2+ts directly -> playout fail
ffmpeg export libx264+mp2+ts directly -> playout fail
ffmpeg export h264_nvenc+mp2+ts directly -> playout fail
ffmpeg export h264_qsv+mp2+ts directly -> playout fail
x264 export x264+mp2+ts directly -> playout fail
avidemux export x264+mp2 -> ffmpeg mpegts(create ts) -> playout fail

premiere export h264+mp2 -> ffmpeg mpegts(create ts) -> playout works
Mainconcept export h264+mp2+ts directly -> playout works (this sample from them, i don't have MainConcept)
emcodem
Posts: 1811
Joined: Wed Sep 19, 2018 8:11 am

Re: mp4 like Adobe premiere result

Post by emcodem »

Ok, that means that your playout accepts the h264 video from adobe but not the ts container from adobe,
in difference it does NOT accept any h264 from ffmpeg but it accepts the ts container from ffmpeg.
In the end this just means you always have to use ffmpeg to rewrap to ts before you send to playout, no matter who encodes the file :D No need for mp4 in the chain at all. Well, it might be possible to tune the adobe .ts exporter to work on the playout as well but this is not the goal here :D
But this is what we already "knew".

As you successfully tested 50p from premiere now, we have it A LOT easier to check out whats disturbing in the ffmpeg x264 version.

First thing, can you please upload a short and definitely working 50p example from premiere (wrapped to ts by ffmpeg)?

After that, we will
-) send you first a "default 50p x264 file" to check if this also does not work. (i assume that it will also not work)
-) after you confirmed that the 50p from libx264 is also not working, we will try to tune the h264 syntax generated by x264 to match exactly the adobe version.
-) If by any luck this leads to a successfully playing 50p from x264, i believe we have an easy time to generate an interlaced version, hopefully in all encoders, nvenc, qsv or x264

I am sorry that this takes so long but if you keep working with us like you do currently, i have a feeling that this will lead to success in the end.
emcodem, wrapping since 2009 you got the rhyme?
User avatar
Wahyu
Posts: 49
Joined: Sun Nov 15, 2020 12:27 am

Re: mp4 like Adobe premiere result

Post by Wahyu »

I sent 2 file, First h264(mp4) from premiere and second ts container ffmpeg

1. https://www.dropbox.com/s/rpq252giowi02 ... r.mp4?dl=0
2. https://www.dropbox.com/s/wx2qywykj3zpo ... S.mpg?dl=0
emcodem
Posts: 1811
Joined: Wed Sep 19, 2018 8:11 am

Re: mp4 like Adobe premiere result

Post by emcodem »

Just to let you know... we received your sample and it is just perfect, this is a good start. @FranceBB will try to generate a matching x264 version which we then - as described above - need to test (it should fail) before we go on.
emcodem, wrapping since 2009 you got the rhyme?
User avatar
FranceBB
Posts: 264
Joined: Sat Jun 25, 2016 3:43 pm
Contact:

Re: mp4 like Adobe premiere result

Post by FranceBB »

Ok, so, here's a new sample: https://wetransfer.com/downloads/fd4532 ... 148/0bfa38

Here's the comparison (Mainconcept Left, x264 Right):

Image

One more thing, of course, since color bars are digital and static, both MainConcept and x264 don't need so much bitrate to encode them, but the playout accepts CBR only so both encoders are trying to fill it with bogus values (zero-filling) which results in FF in the bitstream like so:

Image

So we had to work a bit to get that done as FF as we were getting the encoder to zero-fill instead.
For instance, when we were trying with Intel QuickSync, we were getting zeroes so 00 instead of FF, which was adding yet another question mark to the whole thing...
Anyway, now we've got the fillers to be FF so we're good 'cause it's what we wanted and we also managed to preserve it while muxing.
So, we've got closer and closer, but we still have a few differences like:

has_b_frames=1 in Mainconcept Left, has_b_frames=2 in x264 Right

and

id=0x100 Mainconcept, Left, id=0x150 x264 right


Image
Image

This is the final BAT:

Code: Select all

x264.exe "\\mibctvan000\Ingest\MEDIA\temp\AVS Script.avs" --preset medium --profile Main --level 4.2 --ref 4 --bitrate 6000 --vbv-maxrate 6000 --vbv-bufsize 6000 --deblock -4:-4 --min-keyint 1 --keyint 50 --range tv --log-level info --thread-input --opencl --colormatrix bt709 --transfer bt709 --colorprim bt709 --videoformat component --nal-hrd cbr --output "\\mibctvan000\Ingest\MEDIA\temp\raw_video.h264"

ffmpeg.exe -i "\\mibctvan000\Ingest\MEDIA\temp\AVS Script.avs" -c:a pcm_s24le -ar 48000 -af loudnorm=I=-24:LRA=12:tp=-2 -f wav -y "\\mibctvan000\Ingest\MEDIA\temp\audio.wav"

ffmpeg.exe -i "\\mibctvan000\Ingest\MEDIA\temp\audio.wav" -filter_complex "channelsplit=channel_layout=4.0[CH1][CH2][CH3][CH4]" -map "[CH1]" -c:a pcm_s24le -ar 48000 "\\mibctvan000\Ingest\MEDIA\temp\ch1.wav" -map "[CH2]" -c:a pcm_s24le -ar 48000 "\\mibctvan000\Ingest\MEDIA\temp\ch2.wav" -map "[CH3]" -c:a pcm_s24le -ar 48000 "\\mibctvan000\Ingest\MEDIA\temp\ch3.wav" -map "[CH4]" -c:a pcm_s24le -ar 48000 "\\mibctvan000\Ingest\MEDIA\temp\ch4.wav"

ffmpeg.exe -i "\\mibctvan000\Ingest\MEDIA\temp\ch1.wav" -i "\\mibctvan000\Ingest\MEDIA\temp\ch2.wav" -filter_complex "[0:a][1:a]join=inputs=2:channel_layout=stereo[a]" -map "[a]" -c:a libtwolame -b:a 384k -ar 48000 -f mp2 "\\mibctvan000\Ingest\MEDIA\temp\ch12.mp2"

ffmpeg.exe -i "\\mibctvan000\Ingest\MEDIA\temp\ch3.wav" -i "\\mibctvan000\Ingest\MEDIA\temp\ch4.wav" -filter_complex "[0:a][1:a]join=inputs=2:channel_layout=stereo[a]" -map "[a]" -c:a libtwolame -b:a 384k -ar 48000 -f mp2 "\\mibctvan000\Ingest\MEDIA\temp\ch34.mp2"

ffmpeg.exe -use_wallclock_as_timestamps 1 -i "\\mibctvan000\Ingest\MEDIA\temp\raw_video.h264" -i "\\mibctvan000\Ingest\MEDIA\temp\ch12.mp2" -i "\\mibctvan000\Ingest\MEDIA\temp\ch34.mp2" -map 0:0 -map 1:0 -map 2:0 -c:v copy -c:a copy -f mpegts -muxrate 20000000 -metadata provider_name="Avisynth" -metadata service_provider="Avisynth" -metadata service_name="Avisynth" -mpegts_original_network_id 0x1122 -mpegts_transport_stream_id 0x3344 -mpegts_service_id 0x5566 -mpegts_pmt_start_pid 0x1500 -mpegts_start_pid 0x150 -mpegts_service_type "digital_tv" -mpegts_flags "resend_headers" -y "\\mibctvan000\Ingest\MEDIA\temp\output1.ts"

pause


Again I have low expectations, but please let us know if it works or if it fails and thank you for bearing with us and working with us and being as responsive and active as you've been, we appreciate it a lot.
User avatar
Wahyu
Posts: 49
Joined: Sun Nov 15, 2020 12:27 am

Re: mp4 like Adobe premiere result

Post by Wahyu »

I've tested and the results are still not working in playout. The sample you provide is 1 second long? the duration of the video does not match the results of the general title (mpeg-ts) on mediainfo.
User avatar
FranceBB
Posts: 264
Joined: Sat Jun 25, 2016 3:43 pm
Contact:

Re: mp4 like Adobe premiere result

Post by FranceBB »

Well I knew it wasn't going to work anyway...
Well I secretly hoped it was going to work, but anyway...
I guess I'm gonna pass the ball back to emcodem but even if I'm the one who posted it we've been working on this together...

By the way it should have been 500 frames of colour bars, so in a 50p stream that would be 10 seconds, in fact the dimension is around 24 MB which is pretty much like yours.
emcodem
Posts: 1811
Joined: Wed Sep 19, 2018 8:11 am

Re: mp4 like Adobe premiere result

Post by emcodem »

Ok great, thanks for testing this out @Wayhu
This test was more or less just prove that it is not (only) about PAFF vs MBAFF interlaced encoding here.
As said, we will now dive into some details of the h264 syntax and try to align the remaining differences. The expectation is that there is one single (little) difference in the h264 syntax that makes your playout rejecting all the ffmpeg versions.

But could you tell us how you did measure 1s duration for @FranceBB's file? All my decoders/players say it is about 10 seconds.
emcodem, wrapping since 2009 you got the rhyme?
User avatar
Wahyu
Posts: 49
Joined: Sun Nov 15, 2020 12:27 am

Re: mp4 like Adobe premiere result

Post by Wahyu »

I saw showing duration in the playout. then I checked through mediainfo and I saw the difference between the duration of the TS and the duration of the video. what reads on playout is the duration of the video.
Attachments
dur.png
dur.png (145.54 KiB) Viewed 5829 times
User avatar
FranceBB
Posts: 264
Joined: Sat Jun 25, 2016 3:43 pm
Contact:

Re: mp4 like Adobe premiere result

Post by FranceBB »

Uhm... I think I know what happened. I hope not, but I think I know... I'll come back on Monday with more tests and since we're at this I'll try to play with --bframes 3 --b-adapt 1 --no-weightb 1 in x264.
Post Reply