Opened 12 years ago

Closed 10 years ago

#5110 closed defect (fixed)

Zero length file left after building a seek table for a video.

Reported by: mythtv@… Owned by: Isaac Richards
Priority: trivial Milestone: unknown
Component: MythTV - Mythtranscode Version: unknown
Severity: low Keywords:
Cc: Ticket locked: no

Description

mythtranscode --mpeg2 --video --buildindex --infile "$movie"

All works nicely but "$movie".tmp is created.

Attachments (1)

SWpatch_mythtranscode_131008 (2.8 KB) - added by simonwalls@… 11 years ago.
Patch for 0.21-fixes SVN 17450 to remove zero byte movie.tmp file

Download all attachments as: .zip

Change History (4)

comment:1 Changed 11 years ago by simonwalls@…

I've had a look around the source with a view to fixing this, and have come up with a patch.

Due to the complexity of the command line options of mythtranscode, it took a while to understand the logic of the options & output file creation. I think this works OK but would appreciate it being checked further.

Submitter executes: mythtranscode --mpeg2 --video --buildindex --infile "$movie" Problem: Works OK but a zero byte "movie.tmp" file is created in the current directory.

Looking at the source, mythtranscode's main.cpp calls MPEG2fixup() which creates the "$movie.tmp" file (mpeg2fix.cpp line 533 in my copy of 0.21-fixes).

Since mythtranscode does not re-write the input file (proved this by timestamp unchanged), and there is no output file specified, the results of the MPEG2fixup call must be discarded at exit. However this call cannot be skipped, as the results are required temporarily to build the filemarkup table.

The existing code contains a condition to define the output file name (eg. "movie.tmp") when one is not specified at invocation, otherwise it remains null. So this patch changes this condition to define the output file as non-null ("movie.tmp") when the required condition is present.

Furthermore, the map file is created using a filename which is defined by the output file being present. I have separated the two (using a new variable out_map_file) and added a further conditional test to prevent the zero byte ".tmp" file while allowing the .map file to be created.

Tests:

Original mythtranscode


./mythtranscode --mpeg2 --buildindex -i /mnt/video/Jet.mpg --video

... no files created. This is the desired result.

./mythtranscode --mpeg2 --buildindex -i /mnt/video/Jet.mpg --video --outfile temp.mpg

temp.mpg was created (nonzero size). temp.mpg.map was created (nonzero size). The .mpg file is not wanted.

./mythtranscode --mpeg2 -i /mnt/video/Jet.mpg --video --outfile temp.mpg

temp.mpg (nonzero size) and temp.mpg.map files were both created (nonzero size). This is the desired result.

Patched mythtranscode


./mythtranscode --mpeg2 --buildindex -i /mnt/video/Jet.mpg --video

... no files created. This is the desired result.

./mythtranscode --mpeg2 --buildindex -i /mnt/video/Jet.mpg --video --outfile temp.mpg

temp.mpg.map was created (nonzero size). This is the desired result.

./mythtranscode --mpeg2 -i /mnt/video/Jet.mpg --video --outfile temp.mpg

temp.mpg (nonzero size) and temp.mpg.map files were both created (nonzero size). This is the desired result.

Patch is attached.

Changed 11 years ago by simonwalls@…

Patch for 0.21-fixes SVN 17450 to remove zero byte movie.tmp file

comment:2 Changed 10 years ago by stuartm

Component: mythtranscodeMythTV - Mythtranscode

comment:3 Changed 10 years ago by sphery

Resolution: fixed
Status: newclosed

(In [23363]) Modify mythtranscode such that it doesn't attempt to transcode files when --buildindex is used. It also prevents mythtranscode from generating a seek table for Matroska file (since the presence of the seek table broke playback of some files until the seek table was cleared, and libav* seeking in MKV files is rather good in the Internal player).

Since mythtranscode will build a seek table after transcoding recording files, the use of --buildindex implies that no transcoding is being performed. Users who have used --buildindex along with a transcode command for MythVideo? video files may need to explicitly run a separate mythtranscode --buildindex command after the transcode (if they want a video seek table).

This patch changes the application flow sufficiently that we no longer enter the code block that was causing the 0-byte .tmp file when running a --buildindex, as reported on #5110. Therefore, this also fixes that issue.

Thanks to Simon Walls for the patch on #5110 (which was correct, but is OBE by this change) and to Taylor Ralph for this patch.

Fixes #7986. Fixes #5110.

Note: See TracTickets for help on using tickets.