August 14, 2022, 01:31:38 PM

News:

--


Aspect ratio changes when adding vid to Avidemux

Started by SquidgyBidge, December 02, 2021, 04:23:50 PM

Previous topic - Next topic

SquidgyBidge

December 02, 2021, 04:23:50 PM Last Edit: December 02, 2021, 06:36:06 PM by SquidgyBidge Reason: adding what I am running on:
Hey there

When I drop a .ts file into Avidemux it drastically changes the aspect ratio of the video.

The original aspect is around 16:9, as it a TV broadcast that I've brought off of my Humax to create space on it, as I am once again running out of room on it. When the file opens in Avidemux it looks closer to 1:1.

I had thought that since I was bringing the vids down onto my Mac that I may as well attempt to remove the adverts, but the aspect ratio going crazy, as such I've parked that notion unless I can resolve what's going on with the aspect ratio.

I have copied the properties of the video as Avidemux sees them. This doesn't really mean anything to me, as I an utter newb at this sort of thing, but hopefully it gives someone here an idea of where I am going wrong and how I can resolve it.

=====================================================
Video
=====================================================
Codec 4CC: MPEG
Image Size: 544 x 576
Aspect Ratio: Unknown (32:17)
Frame Rate: 50.000 fps
Total Duration: 00:57:48.669

=====================================================
Extra Video Properties
=====================================================
ExtraDataSize: 00

=====================================================
Audio (1 active track)
=====================================================
Codec: MP2
Channels: Stereo
Bitrate: 16000 Bps / 128 kbps
Frequency: 48000 Hz
Total Duration: 00:57:47.376


Cheers in advance for any help given.

Probably helpful to know that I am running Big Sur 11.6.1 and Avidemux 2.7.8

OK I've managed to confirm using VLC that that the video believes the image size is indeed 544 x 576, as it says the same, but when i open it in VLC it looks around 16:9.

Thus the question remains. How do I get it to look like 16:9 in Avidemux?

eumagga0x2a

Avidemux is not a video player but a video editor. By design, it displays video with 1:1 pixel aspect ratio, so that anamorphic videos look stretched or compressed.

If the video is expected to be displayed at 16:9 display aspect ratio and you are saving it to mp4 or mkv (if mp4, you would need to re-encode it as I don't think that the muxer accepts MPEG-2), don't forget to specify display aspect ratio in the configuration of the respective muxer.

If you edit it in copy mode and export it again as MPEG-TS, you don't need to take care of display aspect ratio at all as this information is stored in the MPEG-2 video stream.

SquidgyBidge

Thank you for coming back to me and sorry about my poor explanations. I don't yet have an understanding of these things or the correct terms to use.

I think that is what is happening with the vids, when I drop them into Avidemux, they are compressing horizontally into the 1:1 view. The vids that I edited (I tried a couple of times), when I exported them, they retained that 1:1 view when I then opened them in VLC.

I exported them in a couple of different Mpeg 4 options and also in a couple of different AAC audio options. I'm guessing there is a deeper level that I need to do something at.

I have also tried running the .ts files through Handbrake to make them mp4, before dropping them into Avidemux, but ended up with the same result after editing and export.

I'm unsure as to what I need to change in Avidemux, so that when I export them and play them in VLC they appear 16:9 ish again.

eumagga0x2a

The videos are displayed by Avidemux as-is, without anamorphic transformations, so if the source is 544:576, it will be displayed with width/height = 17/18 =~ 0.9444. This is how it is supposed to be, you cannot change this, this is by design.

Quote from: SquidgyBidge on December 02, 2021, 07:43:48 PMThe vids that I edited (I tried a couple of times), when I exported them, they retained that 1:1 view when I then opened them in VLC.

Which muxer did you use? When saved in copy mode to MPEG-TS or MPEG-PS, players like VLC should display it at whatever display aspect ratio is specified in the video stream. If you used a different muxer (e.g. MKV), you need to specify the desired aspect ratio in the configuration of the muxer, which is possible only for MKV and MP4 muxers.

Quote from: SquidgyBidge on December 02, 2021, 07:43:48 PMI exported them in a couple of different Mpeg 4 options

If the source is interlaced, you should deinterlace it prior to re-encoding (some encoders offer special switches to enable proper handling of interlaced input, so either you deinterlace or you use that switch, but doing neither would ruin the output). Regarding different Mpeg4 options, there are two popular and useful codecs from that codec family: H.264 (AVC) and HEVC (also called H.265). Everything else are legacy codecs without much relevance nowadays.

SquidgyBidge

Sorry I have no idea how to quote sections from your reply, so as to make it clear as to what parts I am replying too. Its been many, many years since I used forums and I've forgotten all the skills on how to use them, doh!

I can live with and understand that it doesn't show it anamorphic, just so long as when I export it, it looks like it should, when it run it a player.

The muxer was the MP4 muxer, I can't remember now, whether or not I did anything with any aspect ratio settings or not.I'll look into that again and maybe get a fix there.

I can try it with both the MPEG-TS and MPEG-PS muxer to see if that solves the issue. Fingers crossed.

I gave up on copy mode, because after removing adverts, I was getting an issue with "Key Frames",  I could not figure out how identify what a key frame was.

I was using Mpeg4 .264, I understand that .265 is the more modern variant. I didn't use it (and probably should have) simply because I vaguely remembered there were issues with it and Youtube and that put me off, even though I have no intention of putting the stuff anywhere near Youtube.

SquidgyBidge

Yay, got one to work. Found the bit at the bottom with the B & I to mark the key frames. I can now view it back on my HUumax PVR box with no adverts and the correct aspect ratio.

Changed the output format to MPEG-TS. Would there be an advantage to using PS over TS?

Will try a few more, just incase this one was luck.

Thank you again, you managed to get moving in the right direction.

eumagga0x2a

Quote from: SquidgyBidge on December 04, 2021, 09:48:55 AMI have no idea how to quote sections from your reply

Once you have selected the part of the post you want to quote, a button "Quote selected text" appears next to the "Quote" button below the post. The quote is inserted into your reply at the current cursor position in the field.

Quote from: SquidgyBidge on December 04, 2021, 09:48:55 AMI gave up on copy mode, because after removing adverts, I was getting an issue with "Key Frames",  I could not figure out how identify what a key frame was.

When you use only the navigation slider, the thumb slider or up and down arrow keys to seek in a video, you will always be at a keyframe. In copy mode in case of MPEG-2 and legacy varieties of MPEG-4 (and in case of VP9 and AV1), this is enough to proceed with a cut and the result should be fine (losing a few pictures before the beginning of deleted range is normal and depends on whether the original stream was created using open GOP structure). In case of H.264 and HEVC the situation is much more complex. Avidemux will warn you if the combination of the start and end of a deletion looks especially troublesome.

Quote from: SquidgyBidge on December 04, 2021, 09:48:55 AMI was using Mpeg4 .264

H.264 (generated by encoder called "x264") is fine if you target a mobile device or face storage space constraints as all smartphones and tablets have energy saving hardware decoders for H.264. Please don't forget what I wrote you about deinterlacing of interlaced source when you re-encode.

Quote from: SquidgyBidge on December 04, 2021, 09:48:55 AMI understand that .265 is the more modern variant.

Yes, HEVC (generated by the encoder called "x265") is younger and offers excellent quality despite high compression rate, but is very expensive computationally both for encoding and decoding. Use HEVC only if you are sure you can play it on your target device using a hardware decoder. The licensing is also bad which is the main reason why codecs like VP9 and AV1 were developed (great quality-wise, but encoders are terribly slow and few devices offer hardware decoders).

Both codecs are lossy. Use copy mode to preserve original quality when storage space is not overly constrained and in case of MPEG-2, if you don't intend to play the video on mobile devices.

Quote from: SquidgyBidge on December 04, 2021, 10:16:38 AMWould there be an advantage to using PS over TS?

Less overhead (smaller size) at cost of very limited codec support (video: only MPEG-1 or MPEG-2, audio: only AC3, MP2 or LPCM), not well suitable for network streaming, the format is specifically required for video DVDs.